G-Subroutine executes only once

Get help with using AutoHotkey and its commands and hotkeys
Posts: 180
Joined: 22 Feb 2016, 10:49

G-Subroutine executes only once

Post by braunbaer » 24 Jan 2021, 17:03


I have a GUI with a listbox and several buttons, each button associated with a label.

Code: Select all

gui S3Gui:new, +DelimiterTab +HwndGui3Hwnd,Find files
gui font,s12

gui Add, Edit, x15 w500 -multi vS3Searchtext, %SearchText%
gui Add, Button, gS3search x+m yp-3 vS3search Default, Search file
gui Add, Button, gS3getfile vS3get x+m yp, Get file
gui Add, Button, gS3Viewfile vS3View x+m yp, View file
gui Add, Button, gS3gotofile vS3goto x+m yp, Goto file


S3GetFile() {
    Debugtitle("S3GetFile"), debug("S3LB={}",S3LB)
    gui submit, noHide
    h:=regexmatch(S3LB,"^(.+) \(([0-9.]+)(K|M|G)B[^)]+\)$",X)
    WriteToQueue(1, {url:"", name:X1, size:Megabytes(X2,X3), host:"", time1:A_NowUTC, time2:""})
    s:="Queued download for file`n" . X1, debug(s)
When I click on a button - for example Get file, this works perfectly fine, S3getfile is executed normally.
But when after that I select another line of the listbox and click the button again, nothing happens. The function S3Getfile is not executed any more.
User avatar
Posts: 5142
Joined: 09 Sep 2014, 18:38

Re: G-Subroutine executes only once

Post by mikeyww » 24 Jan 2021, 17:13


I suspect that important parts of the problem are missing from the post.

At the least, there is no way for the user to test your script.
just me
Posts: 7725
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: G-Subroutine executes only once

Post by just me » 25 Jan 2021, 11:45

Did you close the MsgBox from S3GetFile()?
Post Reply

Return to “Ask For Help”