Jump to content
Sign in to follow this  
wesley

followed the tutorial, made first script and it didnt work lol

Recommended Posts

wesley

hi guys ;)

hopefully you could help me out

before i made the first script, i followed the tutorial (notepad) and it worked beautiful.

so i want to install 7zip with autoit (to practice making script for big and complex installation for anti-virus and office 2007 upgrade from office 2003 etc)

but for some reason it wont work.

Run("7z457.exe")

WinActivate("7-Zip 4.57 Setup" ,"&Install")
Send("!i")

it wont send (install) button

see the screenshot pls.

thanks :D

post-39770-1220357461_thumb.jpg

Share this post


Link to post
Share on other sites
PsaltyDS

hi guys ;)

hopefully you could help me out

before i made the first script, i followed the tutorial (notepad) and it worked beautiful.

so i want to install 7zip with autoit (to practice making script for big and complex installation for anti-virus and office 2007 upgrade from office 2003 etc)

but for some reason it wont work.

Run("7z457.exe")

WinActivate("7-Zip 4.57 Setup" ,"&Install")
Send("!i")

it wont send (install) button

see the screenshot pls.

thanks :D

Your WinActivate() is being attempted immediately after kicking off the .exe. The window probably doesn't exist yet. Try:
Run("7z457.exe")
WinWait("7-Zip 4.57 Setup" ,"&Install")
WinActivate("7-Zip 4.57 Setup" ,"&Install")
Send("!i")

And welcome to AutoIt.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
herewasplato

Like PsaltyDS said: Welcome to AutoIt.

Also, like PsaltyDS said...

Run("7z457.exe")
WinWait("7-Zip 4.57 Setup", "&Install")
WinActivate("7-Zip 4.57 Setup", "&Install")
WinWaitActive("7-Zip 4.57 Setup", "&Install")
Send("!i")
...but with one extra line just in case...

...or, you could use the /S switch on 7-Zip for a silent install - unless you have a reason/need to interact with the install process.

...and then there is ControlSend like Volly mentioned.

So many options :-)


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

Share this post


Link to post
Share on other sites
wesley

hello guys ;)

thank you for warm welcome lol ;)

managed got it working at the end.

controlsend.....is it same as send?

i had a look at the documentation but i still cant get the concept of the different between them two.

how would i make same script for this 7zip but use controlsend codes?

cheers :D

Share this post


Link to post
Share on other sites
PsaltyDS

hello guys ;)

thank you for warm welcome lol :lmao:

managed got it working at the end.

controlsend.....is it same as send?

i had a look at the documentation but i still cant get the concept of the different between them two.

how would i make same script for this 7zip but use controlsend codes?

cheers :D

With Send() you are simply simulating key strokes, with no control over where they are sent to. The text goes to whatever control has edit focus in whatever window currently has focus.

With ControlSend() you specify the exact window and control you want the sent data to go to. This can be done even to a window that is minimized or has lost focus and is buried under other windows on the desktop. That is what makes ControlSend() preferable to Send().

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
herewasplato

... how would i make same script for this 7zip but use controlsend codes? ...

Run("7z457.exe")
WinWait("7-Zip 4.57 Setup", "&Install")
ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}")
WinWait("7-Zip 4.57 Setup", "&Finish")
ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}")oÝ÷ ÙK¶­¢gjgªê-ëh"Õ¢Ú0"wèªê-¶âÛazv¦zíæî¶Ú'rí®h~)íz·¬µ'¶­i¹ÚçjºB¢{k¢Z®¢Ü"¶§¶­¶%J¶)±¬"Ú0Â)0ºî¶Ø^nëm¢x§¶­Â)Ý£¬jº+^­æÊÚz¬çX¢é¢pj{m¢f¤zØ^±Êâ¦Ü×è®ØZµ»­¶í¡·«y§rjëh×6Run("7z457.exe")

WinWait("7-Zip 4.57 Setup", "&Install")
Do
    Sleep(9)
Until ControlCommand("7-Zip 4.57 Setup", "&Install", "Button2", "IsEnabled", "")
ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}")

WinWait("7-Zip 4.57 Setup", "&Finish")
Do
    Sleep(9)
Until ControlCommand("7-Zip 4.57 Setup", "&Finish", "Button2", "IsEnabled", "")
ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}")

Or you can put the full path to the exe and that same /S into a txt file. Then change the ".txt" extension to ".bat" and run that without compiling it. :-)


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

Share this post


Link to post
Share on other sites
herewasplato

... how would i make same script for this 7zip but use controlsend codes? ...

Run("7z457.exe")
WinWait("7-Zip 4.57 Setup", "&Install")
ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}")
WinWait("7-Zip 4.57 Setup", "&Finish")
ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}")oÝ÷ ÙK¶­¢gjgªê-ëh"Õ¢Ú0"wèªê-¶âÛazv¦zíæî¶Ú'rí®h~)íz·¬µ'¶­i¹ÚçjºB¢{k¢Z®¢Ü"¶§¶­¶%J¶)³§v,²0ºî¶Ø^nëm¢x¬jº+^­æÊÚz¬çX¢é¢pj{m¢f¤zØ^±Êâ¦Ü×è®ØZµ»­¶í¡·«y§rjëh×6Run("7z457.exe")

WinWait("7-Zip 4.57 Setup", "&Install")
Do
    Sleep(9)
Until ControlCommand("7-Zip 4.57 Setup", "&Install", "Button2", "IsEnabled", "")
ControlSend("7-Zip 4.57 Setup", "&Install", "Button2", "{ENTER}")

WinWait("7-Zip 4.57 Setup", "&Finish")
Do
    Sleep(9)
Until ControlCommand("7-Zip 4.57 Setup", "&Finish", "Button2", "IsEnabled", "")
ControlSend("7-Zip 4.57 Setup", "&Finish", "Button2", "{ENTER}")

Or you can put the full path to the exe and that same /S into a txt file. Then change the ".txt" extension to ".bat" and run that without AutoIt. :-)


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

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  

×