Sign in to follow this  
Followers 0
ebin

new to autoit

29 posts in this topic

#1 ·  Posted (edited)

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
WinWaitActive("hkSFV","")
Send("{ALT}F{ALTUP}C")

this is my simple little script. it appears that the last window i need activated has the same name as the setup file window.... and the last part of my code (which closes the C:\Documents and Settings\Administrator\Start Menu\Programs\hkSFV window) is being run while setup is in progress.

I have also tried:

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
WinWaitActive("%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\hkSFV","FolderView")
Send("{ALT}F{ALTUP}C")

and

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
WinWaitActive("%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\hkSFV","FolderView")
Send("{SPACE}{ALTDOWN}{ALTUP}{SPACE}c")

Can anyone with more experience than 1 week with autoit help me?

Is there a way to obtain the name of the window I want activated so I can activate the windows by their exact names?

EDIT: I am also having trouble compiling scripts to .exe. When i run the compiled .exe, it opend about 50 times and never finishes. So far, I have been rigging them in a 7z or wrar sfx archive and running the script after extracting to a temp folder. I would like to just run the .exe.... it would save me some work.

Edited by ebin

Share this post


Link to post
Share on other sites



Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
WinWaitActive("hkSFV","")
Send("{ALT}F{ALTUP}C")

this is my simple little script. it appears that the last window i need activated has the same name as the setup file window.... and the last part of my code (which closes the C:\Documents and Settings\Administrator\Start Menu\Programs\hkSFV window) is being run while setup is in progress.

I have also tried:

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
WinWaitActive("%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\hkSFV","FolderView")
Send("{ALT}F{ALTUP}C")

and

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
WinWaitActive("%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\hkSFV","FolderView")
Send("{SPACE}{ALTDOWN}{ALTUP}{SPACE}c")

Can anyone with more experience than 1 week with autoit help me?

Is there a way to obtain the name of the window I want activated so I can activate the windows by their exact names?

EDIT: I am also having trouble compiling scripts to .exe. When i run the compiled .exe, it opend about 50 times and never finishes. So far, I have been rigging them in a 7z or wrar sfx archive and running the script after extracting to a temp folder. I would like to just run the .exe.... it would save me some work.

I'd say to try to include some of the window text as the second optional parameter in your WinActivate(), that will differentiate between the different windows with same name.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

If your looking for exact names, use "AutoIts window info"

Also, maybe look at the "processexists" command. Can you want until that process is closed before proceding??

Share this post


Link to post
Share on other sites

FIRST WINDOW

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: hkSFV Setup: License Agreement

Class: #32770

Size: X: 671 Y: 388 W: 426 H: 295

LAST WINDOW

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: hkSFV

Class: CabinetWClass

Size: X: 458 Y: 186 W: 800 H: 600

["processexists" command] can you give an example?

Share this post


Link to post
Share on other sites

FIRST WINDOW

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: hkSFV Setup: License Agreement

Class: #32770

Size: X: 671 Y: 388 W: 426 H: 295

LAST WINDOW

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: hkSFV

Class: CabinetWClass

Size: X: 458 Y: 186 W: 800 H: 600

["processexists" command] can you give an example?

a few options:

1) match the title exactly:

Opt("WinTitleMatchMode",3);this makes it so that the entire title must match what you're calling the win functions with
WinActivate("hkSFV");no possibility of the first window (that contains more info in the title) will be accidentally activated

2) one thing that i've done with scripts that i have that periodically take over my pc to refresh automatically, is to have them remember the window that was active when they took over, then re-activate it once they're done...

Opt("WinTitleMatchMode",4)
$old = WinGetTitle("active")
;... do stuff here...
WinActivate($old)

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@cameronsdad

You da MAN!!!

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
Opt("WinTitleMatchMode",3)
WinWaitActive("hkSFV","")
Send("{ALT}F{ALTUP}C")

works beautifully!

now for my last question. How do I make a working .exe with the au3 file? Every time I compile my au3 files to the .exe, it starts like 50 instances of the .exe and i have to end process tree.

Edited by ebin

Share this post


Link to post
Share on other sites

@cameronsdad

You da MAN!!!

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
Opt("WinTitleMatchMode",3)
WinWaitActive("hkSFV","")
Send("{ALT}F{ALTUP}C")

works beautifully!

now for my last question. How do I make a working .exe with the au3 file? Every time I compile my au3 files to the .exe, it starts like 50 instances of the .exe and i have to end process tree.

glad i could help with the first part, it sounds like you have a bad run command in one of your loops causing the second issue. I'd say make sure you have single quotes outside of all of your double quotes for run()'s, if that doesn't work, post your full code here and someone should be able to spot the problem.

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
Opt("WinTitleMatchMode",3)
WinWaitActive("hkSFV","")
Send("{ALT}F{ALTUP}C")

that is the full code. when i compile that to the .exe, it opens 500 times and the app itslef never runs.

Edited by ebin

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Run('hkSFVsetup.exe')
WinWaitActive("hkSFV Setup: License Agreement","")
Send("{ENTER}")
Send("{ENTER}")
Opt("WinTitleMatchMode",3)
WinWaitActive("hkSFV","")
Send("{ALT}F{ALTUP}C")

that is the full code. when i compile that to the .exe, it opens 500 times and the app itslef never runs.

Let me guess - you named the compiled AutoIt script "hkSFVsetup.exe"

Name it something else. :-)

Edit: You might want to specify the full path to that app in that "run" line.

Something like c:\temp\hkSFVsetup.exe

-or-

Search the forum for examples of FileInstall()

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Let me guess - you named the compiled AutoIt script "hkSFVsetup.exe"

Name it something else.

@ herewasplato : you beat me to it.

@ ebin : yeah that's why your script is executing itself, even if you change the working directory, the script will still execute from it's own directory first if i remember correctly, so the easiest way to go is just to rename your script so that there's no chance of it accidentally running itself, someone in another thread suggested naming the installer script the same name, except beginning with an underscore, so that they could keep track of it while avoiding the same problem you're having.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

@ herewasplato : you beat me to it.

The sad/funny thing is that I've did this very thing not so long ago. I just was not thinking about the name... so I can laugh about it :-)

...there are those days...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

it works fine when i compile to .exe... but I am left with two files

1: autoit.exe

2: hkSFVsetup.exe

I want to integrate the autoit script with the original hkSFVsetup.exe so I am left with one file. I did this with adobe ps elements, but forget how.

Share this post


Link to post
Share on other sites

it works fine when i compile to .exe... but I am left with two files

1: autoit.exe

2: hkSFVsetup.exe

I want to integrate the autoit script with the original hkSFVsetup.exe so I am left with one file. I did this with adobe ps elements, but forget how.

use FileInstall("hkSFVsetup.exe",@ScriptDir & "\hkSFVsetup.exe") to include the setup executable and put it into the same folder as the script is being run from. then your script .exe will be the only one (until it's run)

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

it works fine when i compile to .exe... but I am left with two files

1: autoit.exe

2: hkSFVsetup.exe

I want to integrate the autoit script with the original hkSFVsetup.exe so I am left with one file. I did this with adobe ps elements, but forget how.

Did you name your script autoit.exe? Name it something else.

Did you name your script hkSFVsetup.exe? Name it something else.

If hkSFVsetup.exe is the name of the file to be installed and you want one file, search the forum for examples of FileInstall()

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Did you name your script autoit.exe? Name it something else.

Did you name your script hkSFVsetup.exe? Name it something else.

If hkSFVsetup.exe is the name of the file to be installed and you want one file, search the forum for examples of FileInstall()

tooo slow... this battle is MINE! muhahahaha

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Posted Image

I compiled the au3 to a file called working.exe. I then added working.exe and hkSFVsetup.exe to a 7z archive. I used config.txt to call working.exe after extraction. thats the only way i can get it to work

Share this post


Link to post
Share on other sites

tooo slow... this battle is MINE! muhahahaha

FileInstall? old news, see timestamp on my edit of post #9...

Yep - slow - I'm stuck with dialup at the moment.

@ebin - Sorry, just having a bit of off topic fun. I'll let cameronsdad help you with fileinstall...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

I compiled the au3 to a file called working.exe. I then added working.exe and hkSFVsetup.exe to a 7z archive. I used config.txt to call working.exe after extraction. thats the only way i can get it to work

Example without using 7Zip:

; Extract installer to temp dir.
DirCreate(@TempDir & '\hkSFV')
If FileInstall('hkSFVsetup.exe', @TempDir & '\hkSFV\', 1) Then
    Run(@TempDir & '\hkSFV\hkSFVsetup.exe')
Else
    MsgBox(16, 'hkSFV', 'Installer not found', 5)
    Exit(1)
EndIf

WinWaitActive("hkSFV Setup: License Agreement")
Send("{ENTER 2}")
Opt("WinTitleMatchMode",3)
WinWaitActive("hkSFV")
Send("{ALT}F{ALTUP}C")

Func OnAutoItExit()
    DirRemove(@TempDir& '\hkSFV', 1)
EndFunc

:P

Share this post


Link to post
Share on other sites

thanks mhz, cameronsdad and everyone else. I would not have been as patient with someone asking questions about something I was familiar with. MHz, your code worked great.

Share this post


Link to post
Share on other sites

Cool, the battle has been won. :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0