我已经使用了Autohotkey
一段时间了,尽管以前没有编程经验,但我已经能够为各种应用程序创建许多有用的快捷方式。
但是我正在努力创建一个简单的脚本来执行以下操作;
- 在应用程序中打开一个窗口
Ninjatrader 7
(标题为“市场分析器”) - 打开“右键单击”菜单(此窗口中没有菜单栏),
- 选择此菜单中的项目,打开一个“子菜单”,
- 现在,我可以选择项目(大约 30 个)。名称和数量每天都会有所不同。
我可以使用“ENTER”来选择一个项目,这会将信息加载到窗口中(它是行和列格式),
这一切我都能做到。问题是目前它会加载列表中的每个项目!
我希望能够指定一些项目以从列表中“排除”加载。我不明白 AHK 在突出显示项目/字段时如何查看它?它看到的是“文本”、“屏幕位置”、ASCII 还是什么?一旦我知道如何引用这些信息,我就可以创建一个“变量”来比较它。
恐怕我在这方面的知识非常有限,尽管我正在尽可能多地阅读以找到答案,但这非常令人沮丧。
我不是在找人为我做这一切,只是一个帮助我前进的解释。我确信这将是一个简单的练习,但目前它似乎超出了我的能力范围,我迫切希望为自己做这件事。
这是我到目前为止的代码。
; This is rough example of what I'm trying to achieve.
; I am aware this doesn't work at the moment but it shows the process as I see it!
; I don't know how to loop and select the next line down in the menu each time round?
; The list changes on a daily basis which is why I need to recognise the text as opposed
; to just having a preset number of down arrow commands which would have solved my problem.
; I know it's a bit crude but it should show you what I mean!
^+I::
WinActivate Market Analyzer
var1 = "Default""Forex""RSS" ; example of items that I want to omit from being selected
Loop 6 ; example number of loops
SEND +{F10}{DOWN 2}{Right}
IfInString, var1, "Default""Forex""RSS"
{
; Do nothing
}
else
{
Send {Enter}
}
SEND +{F10}{DOWN 2}{Right}{Down 1}
IfInString, var1, "Default""Forex""RSS"
{
; Do nothing
}
else
{
Send {Enter}
}
SEND +{F10}{DOWN 2}{Right}{Down 2}
IfInString, var1, "Default""Forex""RSS"
{
; Do nothing
}
else
{
Send {Enter}
}
SEND +{F10}{DOWN 2}{Right}{Down 3}
IfInString, var1, "Default""Forex""RSS"
{
; Do nothing
}
else
{
Send {Enter}
}
SEND +{F10}{DOWN 2}{Right}{Down 4}
IfInString, var1, "Default""Forex""RSS"
{
; Do nothing
}
else
{
Send {Enter}
}
SEND +{F10}{DOWN 2}{Right}{Down 5}
IfInString, var1, "Default""Forex""RSS"
{
; Do nothing
}
else
{
Send {Enter}
}
return
^+I::
WinActivate Market Analyzer
SEND +{F10}{DOWN 2}{RIGHT}{ENTER} ;INSTRUMENT 1
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 1}{ENTER} ;INSTRUMENT 2
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 2}{ENTER} ;INSTRUMENT 3
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 3}{ENTER} ;INSTRUMENT 4
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 4}{ENTER} ;INSTRUMENT 5
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 5}{ENTER} ;INSTRUMENT 6
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 6}{ENTER} ;INSTRUMENT 7
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 7}{ENTER} ;INSTRUMENT 8
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 8}{ENTER} ;INSTRUMENT 9
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 9}{ENTER} ;INSTRUMENT 10
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 10}{ENTER} ;INSTRUMENT 11
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 11}{ENTER} ;INSTRUMENT 12
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 12}{ENTER} ;INSTRUMENT 13
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 13}{ENTER} ;INSTRUMENT 14
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 14}{ENTER} ;INSTRUMENT 15
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 15}{ENTER} ;INSTRUMENT 16
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 16}{ENTER} ;INSTRUMENT 17
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 17}{ENTER} ;INSTRUMENT 18
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 18}{ENTER} ;INSTRUMENT 19
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 19}{ENTER} ;INSTRUMENT 20
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 20}{ENTER} ;INSTRUMENT 21
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 21}{ENTER} ;INSTRUMENT 22
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 22}{ENTER} ;INSTRUMENT 23
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 23}{ENTER} ;INSTRUMENT 24
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 24}{ENTER} ;INSTRUMENT 25
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 25}{ENTER} ;INSTRUMENT 26
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 26}{ENTER} ;INSTRUMENT 27
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 27}{ENTER} ;INSTRUMENT 28
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 28}{ENTER} ;INSTRUMENT 29
SEND +{F10}{DOWN 2}{RIGHT}{DOWN 29}{ENTER} ;INSTRUMENT 30
RETURN
您能提供的任何帮助将不胜感激!