Automate Wizard Installation

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TadGhostal
Posts: 15
Joined: 25 Dec 2014, 08:24

Re: Automate Wizard Installation

26 Jan 2015, 16:12

Makes sense, AutoHotkey is waiting for the msi file to launch, but that can only happen after the user clicks past the system's security dialog, so only then does the execution reach Loc #2 (assuming you didn't click Cancel on the security dialog, in which case you should get an error).
Elee
Posts: 12
Joined: 23 Jan 2015, 14:17

Re: Automate Wizard Installation

26 Jan 2015, 16:17

That's what I was thinking. I just don't know how to get past the security window.
TadGhostal
Posts: 15
Joined: 25 Dec 2014, 08:24

Re: Automate Wizard Installation

26 Jan 2015, 16:25

You could do this:

Code: Select all

Run cmd /c "C:\Users\<User Name>\Desktop\AutoHotKey\mysql-essential-5.1.73-winx64.msi"
The problem with that is how to hide the console window (unless it doesn't bother you). :?
User avatar
Gio
Posts: 1247
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Automate Wizard Installation

26 Jan 2015, 17:49

TadGhostal wrote:You could do this:

Code: Select all

Run cmd /c "C:\Users\<User Name>\Desktop\AutoHotKey\mysql-essential-5.1.73-winx64.msi"
The problem with that is how to hide the console window (unless it doesn't bother you). :?

The third parameter of the Run command allows hiding of the console window (Hide). Just add the extra commas to reach it :thumbup:
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: Automate Wizard Installation

26 Jan 2015, 20:32

if none works.
That's what I was thinking. I just don't know how to get past the security window.
use a timer before hand
try this:

Code: Select all

MsgBox, 4, Install MySQL Essentials, Would you like to install MySQL Essentials?
IfMsgBox Yes
{
    MsgBox, Loc #1
	SetTimer, WaitngForSecurity, 200
    Run, C:\Users\<User Name>\Desktop\AutoHotKey\mysql-essential-5.1.73-winx64.msi
    MsgBox, Loc #3
}
return
WaitngForSecurity:
IfWinExist Open File - Security Warning
{
Sleep 100
ControlClick, Button1, Open File - Security Warning
MsgBox, Loc #2
SetTimer,, Off
}
return
hope this helps, now
Elee
Posts: 12
Joined: 23 Jan 2015, 14:17

Re: Automate Wizard Installation

27 Jan 2015, 14:54

Using a combination of everyone's suggestions I was able to get it to work with the code below.

Code: Select all

MsgBox, 4, Install MySQL Essentials, Would you like to install MySQL Essentials?
IfMsgBox Yes
{
	SetTimer, WaitingForSecurity, 200
	Run C:\Users\<User Name>\Desktop\AutoHotKey\mysql-essential-5.1.73-winx64.msi
	
	-> IfWinExist MySQL Server 5.1 - Setup Wizard
	{
		Sleep 100
		SendInput {Enter}
	} <-
}
return

WaitingForSecurity:
IfWinExist Open File - Security Warning
{
	ControlFocus Open File - Security Warning
	Sleep 100
	SendInput {Tab}
	Sleep 100
	SendInput {Tab}
	Sleep 100
	SendInput {Tab}
	Sleep 100
	SendInput {Tab}
	SendInput {Enter}
	SetTimer, WaitingForSecurity, Off
}
return
I was unable to get the ControlClick functionality to work so I had to go this route.

I hopefully have one last question for this project. After I make it through the security window, how can I regain control of the MySQL server prompt so that I can work with it.

The code I tried is in between the arrows (minus the arrows of course). I'm slightly confused on the structure of the code now that I am using WaitingForSecurity.

Thanks everyone for your help! :)
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: Automate Wizard Installation

27 Jan 2015, 15:27

I know that you hate WinWait :D but just for this time:
replace

Code: Select all

IfWinExist MySQL Server 5.1 - Setup Wizard
    {
        Sleep 100
        SendInput {Enter}
    }
with:

Code: Select all

WinWait, MySQL Server 5.1 - Setup Wizard
;this would wait for the window to exist
or

Code: Select all

WinWaitActive, MySQL Server 5.1 - Setup Wizard
;this would wait for the window to be active
I think as you said, it's a question of construction now.
good luck
Elee
Posts: 12
Joined: 23 Jan 2015, 14:17

Re: Automate Wizard Installation

09 Feb 2015, 16:11

Hi all!

I got my script working just like I needed it to. There are a few issues that I am having and I was wondering if there was a way to make it more reliable. A couple of the issues I am having are as follows:

--> Using the code below sometimes the program does not execute. I can see the "tabs" working and moving to the correct position but it hangs up on "Next" and doesn't hit enter. If I manually hit enter it will continue normally. I believe this is a timing issue. I tried changing the times and still had the problem.

Code: Select all

WaitingForSecurity:
IfWinExist Open File - Security Warning
{
	ControlFocus Open File - Security Warning
	Sleep 100
	SendInput {Tab}
	Sleep 100
	SendInput {Tab}
	Sleep 100
	SendInput {Tab}
	Sleep 100
	SendInput {Tab}
	SendInput {Enter}
	SetTimer, WaitingForSecurity, Off
}
return
--> Is there any way to allow the user to continue to use the computer? I understand that I am using hotkeys, but is there a way to ignore the user from interacting with the script so the script can run and the user can use the computer without interfering?

--> Occasionally as the program is running, even after it is supposed to have finished. It will start back up again. This may be a coding issue but I do not see where. If it would help, I can copy and paste the code and see what you think.

--> Reliability is still an issue. Since I am using keyboard movements. Are there any ideas on ways to increase reliability?

Thanks again for all your help! :)
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: Automate Wizard Installation

09 Feb 2015, 17:59

Is there any way to allow the user to continue to use the computer? I understand that I am using hotkeys, but is there a way to ignore the user from interacting with the script so the script can run and the user can use the computer without interfering?
you need to change your approach, since you're not using hotkeys, you're sending keys to the active window, that has the keyboard input focus, so the program's window has to stay active, you may need to try some the ideas that were given before, using ControlSend, ControlClick... things like that which is not working as you stated before for some reason, not sure if this was suggested before, but could you try using Click instead of tabs and enter, you'll have to find the button's position.
Occasionally as the program is running, even after it is supposed to have finished. It will start back up again. This may be a coding issue but I do not see where. If it would help, I can copy and paste the code and see what you think.
if it's not the program itself that does that, it might be an enter key that's sent when the program's window closes, and the selected item in the explorer is the program, so it gets executed again, to see the script might be helpful to some degree
zack4994kcaz

Re: Automate Wizard Installation

15 Aug 2017, 12:32

Since this is FAR after the thread seems to have died off i am going to assume none of the original people are going to see this but for anyone who is running into this issue i did solve it.
For some reason or another i was never able to get the original script to find the button or the window BUT if i put a wait in and then had the 1st script launch a 2nd script (whose sole purpose was to deal with the security window) that seemed to work, provided that the security window had already popped up.
Hope that helps!
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: Automate Wizard Installation

23 Aug 2017, 07:18

I know this isn't really an AHK solution but quite a few installers accept the 'silent' command line option. Which auto accepts all default options.

Try this:

Code: Select all

C:\Users\<User Name>\Desktop\AutoHotKey\mysql-essential-5.1.73-winx64.msi /s
Or This:

Code: Select all

C:\Users\<User Name>\Desktop\AutoHotKey\mysql-essential-5.1.73-winx64.msi /silent

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot], Joey5, ShatterCoder, Xaucy and 193 guests