定义变量并将其打印出来
嘿伙计们!
我刚刚找到AHK,我喜欢它!
我正在编写一个脚本,它允许我从下拉列表中选择一些不同的选项,然后它会自动从特定字段中的该下拉列表中输入值:
现在我的问题是,当我的例子选择“SPIRIT”时 - 由于某种原因它会输入这些数字:
“643232442221”而不是它应该的数字:“6432324422”
就像它在场上增加了额外的数字一样。为什么??? ???
#T::
Gui, Add, Text, x26 y177 w420 h30 , Vælg Handling Agent
Gui, Add, DropDownList, x26 y217 w420 h20 vCfs, WFS|Spirit
Gui, Show, x131 y91 h381 w481, New GUI Window
Submit:
Gui, Submit
varCfs = %cfs%
varConsol = %consol%
varMawb = %mawb%
if(varCfs = "WFS"){
varCfs = 6402111562
} else if (varCfs = "SPIRIT"){
varCfs = 6432324422
}
Gui, Hide
;After submit. If the console # is already opened in EDIe, make that window active
;if not, let's generate an error, saying that the user must lookup the console.
IfWinExist, Edit Consol %consol%
{
WinActivate ; use the window found above
;Arrival Info
Click 697,76
Click 651,109
Send {Ctrl Down}a{Ctrl Up}
Sleep 200
Send {Delete}
Sleep 350
Send %varCfs%
+F11::Send, %mawb% ;Shift+F11
} else {
WinActivate, ediEnterprise
MsgBox, 4, Find Consol #, Error!
Gui, Destroy
Gui, show
Return ;Then stop!
}
Return
GuiClose:
ExitApp
答案 0 :(得分:0)
我无法重现环境来测试您的代码。但我做了一些修正,可能对你有所帮助。试试这段代码:
#T::
Gui, Add, Text, x26 y177 w420 h30 , Vælg Handling Agent
Gui, Add, DropDownList, x26 y217 w420 h20 vCfs, WFS|Spirit
Gui, Show, x131 y91 h381 w481, New GUI Window
Submit:
Gui, Submit
varCfs := cfs
varConsol := consol
varMawb := mawb
if(varCfs = "WFS"){
varCfs := 6402111562
} else if (varCfs = "SPIRIT"){
varCfs := 6432324422
}
Gui, Hide
;After submit. If the console # is already opened in EDIe, make that window active
;if not, let's generate an error, saying that the user must lookup the console.
IfWinExist, Edit Consol %consol%
{
WinActivate ; use the window found above
;Arrival Info
Click 697,76
Click 651,109
Send {Ctrl Down}a{Ctrl Up}
Sleep 200
Send {Delete}
Sleep 350
Send %varCfs%
} else {
WinActivate, ediEnterprise
MsgBox, 4, Find Consol #, Error!
Gui, Destroy
Gui, show
Return ;Then stop!
}
Return
+F11::Send, %mawb% ;Shift+F11
GuiClose:
ExitApp