GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?

Get help with using AutoHotkey and its commands and hotkeys
shipaddicted
Posts: 19
Joined: 15 Jul 2016, 19:57

GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?

30 Oct 2018, 23:19

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.
colt
Posts: 100
Joined: 04 Aug 2014, 23:12
Location: Portland Oregon

Re: GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?

01 Nov 2018, 10:40

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.

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
script1.ahk

Code: Select all

tooltip inside script 1
sleep 1000
script2.ahk

Code: Select all

tooltip inside script 2
sleep 1000
shipaddicted
Posts: 19
Joined: 15 Jul 2016, 19:57

Re: GUI for scripts - If Multiple Selections Allowed, Will They Run Concurrently?

01 Nov 2018, 22:53

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.)

Return to “Ask For Help”

Who is online

Users browsing this forum: chusski, flyingDman, FredOoo, Google [Bot], Odlanir, Sabestian Caine, sinkfaze and 136 guests