GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?
-
- Posts: 96
- Joined: 15 Jul 2016, 19:57
GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?
I have a GUI that I created for work that runs all our "Friday Download" files and saves them to our hard drive. Right now, the user has to click on each button for its report individually, which is still a VAST improvement over the chicanery that we had to get into previously, but you're still kind of tied to the computer while these are running. I was thinking of converting it to a checkbox GUI so we could "check it and forget it," but I'm curious how it would work with scripts. Would it run each script one after another, or would it try to run them all concurrently as soon as we hit GO? I'm pretty sure that would be disastrous! I would definitely prefer they run one after another.
Re: GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?
From your post it sounds like you are trying to launch external scripts using a master script. Is this correct? If so, autohotkey is capable of doing both. Use run to do concurrently and use runwait to do linearly. Here is a quick example.
script1.ahk
script2.ahk
Code: Select all
#singleInstance Force
gui add,checkbox,vcheck1,Check 1
gui add,checkbox,vcheck2,Check 2
gui add,button,gRunScript,Run
gui show
return
RunScript:
gui submit, nohide
if(check1)
{
tooltip download code here 1
sleep 500
runWait script1.ahk
;need code here to check to make sure script is complete
}
if(check2)
{
tooltip download code here 2
sleep 500
runWait script2.ahk
;need code here to check to make sure download is complete
}
tooltip
return
Code: Select all
tooltip inside script 1
sleep 1000
Code: Select all
tooltip inside script 2
sleep 1000
-
- Posts: 96
- Joined: 15 Jul 2016, 19:57
Re: GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?
Awesome!! I cobbled my script together from the Button script I had just to see what would happen -- and it turns out they do run linearly **for the most part**. They did tend to step over each other a little, especially when the document SaveAs dialog was open. I kept having to add more Sleeps, which I'd really like to avoid. (I'm not going to be at this job for much longer, and I want to leave them with something as seems to be as possible so they don't have to try and tweak it.) I will incorporate your stuffs in it tomorrow and see if that helps. (BTW, they are several very similar scripts of go-to-this-site-and-download-a-file-save-and-copy-to-backup. Can't use COM very much cos of firewalls and lots of javascript {which I don't know very much of}, so it's a little clunky in spots. They are all located together in the same ahk file.)
Who is online
Users browsing this forum: Google [Bot], OrangeCat and 153 guests