Autohotkey 使用文本框和按钮的自动热键

Autohotkey 使用文本框和按钮的自动热键,autohotkey,Autohotkey,需要一些关于文本框和按钮的帮助 我一直在尝试使用“文本框”和“按钮”。但无法做到这一点。。。我需要从“文本框”字段中获取“值”,并将其附加到按钮操作中。i、 例如,无论用户给出什么输入。。。需要将其附加到“URL”中 例如: 如果用户在文本字段中键入“login”作为输入,则需要获取此输入并将其附加到“” 行动前: 后遗症: 好心帮忙 这是我的密码: Gui, Add, Edit, x162 y80 w140 h30 vUserInput, Type here Gui, Add, Butto

需要一些关于文本框和按钮的帮助

我一直在尝试使用“文本框”和“按钮”。但无法做到这一点。。。我需要从“文本框”字段中获取“值”,并将其附加到按钮操作中。i、 例如,无论用户给出什么输入。。。需要将其附加到“URL”中

例如:

如果用户在文本字段中键入“login”作为输入,则需要获取此输入并将其附加到“”

行动前:

后遗症:

好心帮忙

这是我的密码:

Gui, Add, Edit, x162 y80 w140 h30 vUserInput, Type here
Gui, Add, Button, x182 y130 w100 h30 gAction, %"Action1" Action1:=http://www.google.om/
; Generated using SmartGUI Creator 4.0
Gui, Show, x127 y87 h379 w479, New GUI Window
Return

Action1:
Gui, Submit, NoHide
guiControlGet, txtVar,, UserInput
guiControl,, UserInput, %( txt++Action1 )

GuiClose:
ExitApp
return

谢谢,干杯。

好的,你有一些误解和很多错误。 使用
:=
-vs-
%
是您的误解之一

此外,您还忽略了将
gAction1
作为按钮的转到标签。您有
gaaction
,但没有名为
Action
的子项

另一个问题是您没有将
return
放在
Action1
标签的末尾。 这意味着操作完成后,脚本将继续以结束脚本

您应该真正地阅读自动热键文档!这将节省你很多时间和头痛。另外,您应该看一些简单的示例

但是,请尝试下面的脚本。按下按钮后,在框中键入的任何内容都将附加到url


;Now, it may be easier to define your re-usable variable here like this:
;myurl = http://www.google.com/
myurl := "http://www.google.com/"       ;this is exactly same as the previous line

Gui, Add, Edit, x162 y80 w300 h30 r1 vUserInput, Type here
Gui, Add, Button, x182 y130 w100 h30 gAction1, Action1      ;The last parameter is JUST the text on the button
;If you wanted to use a variable for the name instead of straight text, you would do this:
;Gui, Add, Button, x182 y130 w100 h30 gAction, %myurl%
;But what you were trying to do is to *assign* a variable instead of *using* a variable - that is, you CAN'T use action1:=value as the variable name

Gui, Show, x127 y87 h379 w479, New GUI Window
Return

Action1:  ;the name of this label is the same as the g-action of your button except without the "g" part.
    Gui, Submit, NoHide
    guiControlGet, UserInput        ;you can simply use the edit control's v-name as the output variable
    thisurl = %myurl%%UserInput%
    guiControl,,UserInput, %thisurl%    ;now set the url back to the control
return  ;if you don't put return here, the script will continue on and run the GuiClose label...

GuiClose:
    ExitApp
return  ;you can have this, but you don't need it here since the script will have ended before it gets run anyway.