Jump to content

Using AutoIt for silent install


ricktendo

Recommended Posts

  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

At the end of DivX setup, a browser window will open whether you're connected to the internet or not. It might be Firefox, it also may be internet explorer. Is there a way to only close the one that opens?

Firefox:

WinWait("Problem loading page - Mozilla Firefox","")
If Not WinActive("Problem loading page - Mozilla Firefox","") Then WinActivate("Problem loading page - Mozilla Firefox","")
WinWaitActive("Problem loading page - Mozilla Firefox","")
Send("{ALTDOWN}{F4}{ALTUP}")

Internet Explorer:

WinWait("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")
If Not WinActive("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba") Then WinActivate("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")
WinWaitActive("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")
Send("{ALTDOWN}{F4}{ALTUP}")

Link to comment
Share on other sites

There can only be 1 browser which will be launched. Usually it is IE

However, if you think there are 2 possible browsers to be launch, then just pause the script for browser to self-launch, then close both iexplorer.exe & firefox.exe

Sleep (3000); you can adjust the time. Must be longer so that sufficient time is given for the installer to self-launch the browser
ProcessClose ("IEXPLORE.EXE")
ProcessClose ("FIREFOX.exe")

Alternatively, going by your given code:

WinWait("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")

ProcessClose ("IEXPLORE.EXE") ; <---New line to close Internet Explorer process. Just like you close process in task manager

Edited by Geej
Link to comment
Share on other sites

There can only be 1 browser which will be launched. Usually it is IE

However, if you think there are 2 possible browsers to be launch, then just pause the script for browser to self-launch, then close both iexplorer.exe & firefox.exe

Sleep (3000); you can adjust the time. Must be longer so that sufficient time is given for the installer to self-launch the browser
ProcessClose ("IEXPLORE.EXE")
ProcessClose ("FIREFOX.exe")

Alternatively, going by your given code:

WinWait("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")

ProcessClose ("IEXPLORE.EXE") ; <---New line to close Internet Explorer process. Just like you close process in task manager

Some of my builds have Firefox set as default browser and some use IE. This is why I would like it to work for either. I was wondering if possibly there was a different command to use that didn't rely on me setting a timeout (every computer will take a different time to process). something like an if else statement but I'm not familiar with the AutoIt language :(. If I know, before silent install, which browser is default I can just use a different installer to work with the corresponding browser. This takes up space and is a hassle to maintain.

I appreciate your response. I wasn't aware of that command. It will work for now, It's definitely better than two separate programs.

Link to comment
Share on other sites

So basically you need a mini-script that can detect default browser (either FF or IE).

Here is my code, which I think can integrated into your Divx setup script

#cs
This script test whether default browser is IE or Firefox base on current user setting.
This is also my first time using StringRegExp & StringRight. So if I code it poorly, forgive me.

The registry that store the default browser is HKEY_CURRENT_USER\Software\Classes\http\shell\open\command

Test 1:
To actually test the code, say, you set firefox as default browser. Launch firefox. Also launch IE.
So you have 2 browsers launched. Since you actually set firefox as default browser,
you would expect Firefox browser to procesclose when winwait matches, without procesclose IE.
Run this script to see the effect.

Test 2:
Now set IE as default browser. Launch Firefox as well.
Double check HKEY_CURRENT_USER\Software\Classes\http\shell\open\command has IEXPLORE.EXE as part of string
Run the script. Expected result would be Internet Explorer closed, keeping firefox on the desktop.

You may like to fine tune the script according to your circumstance
#ce


$varF = RegRead("HKEY_CURRENT_USER\Software\Classes\http\shell\open\command", ""); Read what is the string found in this key

$varFF = StringRight ( $varF ,45 ); count the last 45 char from the right. 45 is needed for Firefox string.

$varFFF = StringRegExp ($varFF, "firefox.exe", 1 );compare the 45 char against a search string Firefox.exe

MsgBox(64, "My default Browser is", $varFF); output visually for user to see the string. This line can be disabled for actual run. After testing complete successfully

MsgBox(64, "Show output of string regular expression", $varFFF); output is 0, indicating what is the control code. This line can be disabled for actual run.

;======= Place your DivX installer code here ====

if $varFFF=0 then
WinWait("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")
ProcessClose ("IEXPLORE.EXE")
else
WinWait("Problem loading page - Mozilla Firefox","")
ProcessClose ("firefox.exe")
endif

Link to comment
Share on other sites

  • 2 weeks later...

Thank You Geej!

All I really needed was the syntax to make something work for me!

The registry settings are in Local Machine not Current User. (At least on my running system)

and you have a 45 count in StringRight, On my system it's 44.

But it works!

I simplified it and changed it to:

$varF = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command", ""); Read what is the string found in this key
$varFF = StringRight ( $varF ,44 ); count the last 44 char from the right. 44 is needed for Firefox string.
$varFF = StringLeft ( $varFF ,11 ); count the first 11 characters from the left. Firefox.exe = 11 characters.

if $varFF = "FIREFOX.EXE" Then
WinWait("Problem loading page - Mozilla Firefox","")
ProcessClose ("Firefox.exe")
Else
WinWait("Internet Explorer cannot display the webpage - Windows Internet Explorer","Favorites Command Ba")
ProcessClose ("IExplore.exe")
EndIf

Maybe I did something wrong and I just don't see it?

Link to comment
Share on other sites

Glad that modifying the code works for you.

Maybe I did something wrong and I just don't see it?

If firefox is installed, then you will see "HKEY_CURRENT_USER\Software\Classes\HTTP\shell\open\command" key as it is created by firefox during installation. Otherwise it is just as you mention: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command

Try changing the default browser to Firefox and see if "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command" value changes. (I believe it still stay as IE)

Link to comment
Share on other sites

If firefox is installed, then you will see "HKEY_CURRENT_USER\Software\Classes\HTTP\shell\open\command" key as it is created by firefox during installation. Otherwise it is just as you mention: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command

Try changing the default browser to Firefox and see if "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command" value changes. (I believe it still stay as IE)

It does change to Firefox.

I don't have a "Current_User\Software\Classes\HTTP" entry in my registry.

Firefox is installed. Does it delete it after installation?

Link to comment
Share on other sites

Forgot to mention that 'HKEY_CURRENT_USER\Software\Classes\HTTP\shell\open\command' was created after I launch Firefox for the first time. (along with many other new registry keys in HKEY_CURRENT_USER\Software\Classes).

HKEY_CURRENT_USER\Software\Classes\HTTP\shell\open\command will not be created if FF is installed by others and I (the current user) have not started FF for the first time. I also need to agree to set as default browser when prompt by Firefox. At least that's what my machine shows.

Nevertheless, since you got it tested and default browser changes occurs in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\http\shell\open\command, I suppose it is okay. Just be aware that some machines may have default browser setting store in HKCU.

If getting too unpredictable, suggest 3rd party tool to preset default bowser as IE. When installation is over, have it reset the browser back to old setting. (have not tried it through) http://www.snapfiles.com/get/defaultbrowser.html

An article here possible says both of us could be right. :D

BTW, where can I download the DivX installer?

Edited by Geej
Link to comment
Share on other sites

  • 3 weeks later...

A question. When the file is made and you have the script. You put it in the svcpack folder. Does the program itself need to be in "cab" form or do you want the orginal "setup file".??

The example I was pointed to was lost. Can someone post a "winamp" example? Thats the one I am having the issues with.

Link to comment
Share on other sites

A question. When the file is made and you have the script. You put it in the svcpack folder. Does the program itself need to be in "cab" form or do you want the orginal "setup file".??

The example I was pointed to was lost. Can someone post a "winamp" example? Thats the one I am having the issues with.

You put your winamp setup file and your autoit compiled script in svcpack folder. Then in your entries.ini,

There is a section [AddProgram]

Put your script name only such as winampscript.exe

See Tray Pilot Lite 1.10 for the example. (download and uncab it to see its structure)

Hope to see you put up this addon soon :D

Link to comment
Share on other sites

Been doing my best geej. I am doing something wrong, I get the script, compile it, it starts the install then half way through it just stops. Then I have to click next and so on. I will get it. Just gotta figure it out. Have another idea or two. Im determined to get winamp to install without interacton on my part.

Well looks like its just not possible to do this with winamp. I have tried everything I could, no luck. If anyone ever makes one PLEASE let me know, Would love to download it.

Edited by tym
Link to comment
Share on other sites

http://www.winamp.com/player

I keep trying alt+next button, use tab as well, It just continues to stall. I sure apreciate your help geej. Sure hope you can explain what I am doing wrong.

At the very end of the set up there are 4 boxes, Emusic, Toolbar, And a couple of others. I would like to have all 4 boxes unchecked. No clue why winamp puts thoes there. But I like others hate them.

If you do get a chance to make it, Would you please save a copy of the .au3 before its compiled. Would love to find out what in the world I am doing wrong. I know its gotta be simple, Just not sure what it is.

Edited by tym
Link to comment
Share on other sites

  • 3 months later...

I made a script to launch XP default calculator (or Calculator Plus 1.0) in "Always on Top" mode, for convenience, really.

Will place the calculator near the bottom right side of the screen. (assuming u are right-handed)

Add : Start menu "Always On top" Calculator

Can also run from Runbox: calct.exe (where t means 'top')

Made to install silently for unattended purpose. (Actual compiled script goes to %windir%)

Screenshot

AlwaysOnTopCalculator.png

Download

Size: 281kb

MD5: 21FD89C96E6A22E9CBCE28936C5EB813

Autoit code use:

Opt("WinTextMatchMode", 2) 
Run ("calc.exe")
Winwait ("Calculator")
WinMove ("Calculator","",725,360,260,260,2);base on 1024x768 screen
WinSetOnTop ("Calculator","",1 )

I thought it might be useful to share...

Calculator Plus are included in Kel's UberPacK v13.x

or direct fromMS

Edited by Geej
Link to comment
Share on other sites

  • 1 month later...

That gets me confused again and again, guys!

At different forums I see that people recommend AutoIt to make the unattended install of addons silent. But now I can see that you recommend to use the silent switches. So, why do I need AutoIt then?!? E.g., I want to make some changes in pre-install windows of Winamp (like disable Winamp Library and visualizations) - before they all are installed on my computer. When I make it through SVCPACK method with a simple silent switch, it installs with all these features installed - this is what I don't want to happen. Now, when I heard about the capabilities of AutoIt I was quite happy to use it. I even wrote a script which makes the whole process of install quite seamless. But when it comes to switches, I really get confused - 'coz some say AutoIt allows for switchless install and some say - one still needs to use switches for different installers.

Which one 's true, for God's sake!

Link to comment
Share on other sites

That gets me confused again and again, guys!

At different forums I see that people recommend AutoIt to make the unattended install of addons silent. But now I can see that you recommend to use the silent switches. So, why do I need AutoIt then?!? E.g., I want to make some changes in pre-install windows of Winamp (like disable Winamp Library and visualizations) - before they all are installed on my computer. When I make it through SVCPACK method with a simple silent switch, it installs with all these features installed - this is what I don't want to happen. Now, when I heard about the capabilities of AutoIt I was quite happy to use it. I even wrote a script which makes the whole process of install quite seamless. But when it comes to switches, I really get confused - 'coz some say AutoIt allows for switchless install and some say - one still needs to use switches for different installers.

Which one 's true, for God's sake!

Silent switches look a lot better during setup, but are limited in functionality.

A silent switch does not exist for every installer.

AutoIt only works with a GUI. You can't use a silent switch and AutoIt.

It just comes down to preference.

Link to comment
Share on other sites

  • 9 months later...

Very nice guide.. and everything went good the first time... when i tried to install ifranviewr. but...

when i moved on the next stage to make a script for CorelDrawX4 i went into a trouble..

so this is what i am doing

first starting the scriptwriter

then rechecking the boxes as shown in the guide in the scriptwriter.

locating the setup.exe trough "browse"

and now i start the scriptwriter by pressing the A

the installation process begins.. and i am using alt+n alt+t etc. etc. after everything is done. i am stoping the scriptwriter by pressing the A again.. so the script should be complete now as i know..

(if i put this code

$SF_1 = "app.exe"

If WinExists ( $SF_1 ) Then Exit
AutoItWinSetTitle ( $SF_1)

below the script should work right?

and allso dose the "app.exe" should be named as i name the script when i am saving it or like the setup which i am installint the program.. in my case setup.exe

ok lets move on... as i know this code is not a big problem.. but a pice of code to keep you out of problems :)

ok so i right click the scrip and than click compile.. the script is now compiled...

time to rock en roll but the string of the guitar here broked :)\

when i start the compiled .exe file the installation begins the loadings are good and when it comes when it should accept alt+a (the first command )for the accepting the licence agreement actualy it stops.. here dose not do anything.

but here is what i noticed.. if i run the script again while the other is in progres (actualy where it stops before should make alt+a command) the script works. :S why is that..

please help..

and i have another question which is not realeted to the question above..

why when i save my script from the scripwriter it doesn't have the proper name as i name it.. instead of ex. scrip1.au3 it saves like some strange codes..

please for fast answer.. i need this

btw here is the script

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('C:\Users\XP Computing\Desktop\TESTS\setup.exe')
WinWait("CorelDRAW Graphics Suite X4","")
If Not WinActive("CorelDRAW Graphics Suite X4","") Then WinActivate("CorelDRAW Graphics Suite X4","")
WinWaitActive("CorelDRAW Graphics Suite X4","")
Send("{ALTDOWN}a{ALTUP}{ALTDOWN}n{ALTUP}{ALTDOWN}n{ALTUP}{ALTDOWN}nn{ALTUP}{TAB}{ALTDOWN}n{ALTUP}{ALTDOWN}i{ALTUP}")
WinWait("Dialog","Cancel")
If Not WinActive("Dialog","Cancel") Then WinActivate("Dialog","Cancel")
WinWaitActive("Dialog","Cancel")
Send("{ALTDOWN}c{ALTUP}{TAB}{TAB}{TAB}")
WinWait("CorelDRAW Graphics Suite X4","")
If Not WinActive("CorelDRAW Graphics Suite X4","") Then WinActivate("CorelDRAW Graphics Suite X4","")
WinWaitActive("CorelDRAW Graphics Suite X4","")
Send("{ALTDOWN}c{ALTUP}")

Edited by masky
Link to comment
Share on other sites

  • 6 months later...

can anyone tell me how can i change the icon of my newly made installer after using autoit.It is showing "A" icon on my setup exe.

Instead of right clicking the .au3 and compiling the .exe, use the shortcut for compile to EXE in the start menu to get this GUI window

aut2exe.png

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...