Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

AUTOIT request nologic & Mhz pls read

- - - - -

  • Please log in to reply
26 replies to this topic

#1
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
Can u guys create a autoit

if file XXX.XXX Exist run...

wait

If file bbb.bbb Exist run...

wait

if file ddd.ddd Exist run...

that is all i need

purpose: I want to combine Firefox (Simon's Silent Installer) and My Profile.exe (silent extension, themes, and etc Installer) into one Winrar file.

Instead of having to use a batch command to launch simon's installer and then my profile.exe. I want to use autoit instead.



thanks


How to remove advertisement from MSFN

#2
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
If FileExists  ( @ScriptDir & "\setup_1.exe" ) Then
        RunWait ( @ScriptDir & "\setup_1.exe" )
EndIf

If FileExists ( @ScriptDir & "\setup_2.exe" ) Then
       RunWait ( @ScriptDir & "\setup_2.exe" )
EndIf

.....

Really don't see where AutoIt would be better than a batch for this....well its a bit more flexable in where you place files but thats it.

Any ways enjoy :)

#3
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
Just to have ...

And thanks to Mhz for correcting my problem with vueprint! it work now

#4
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
Well don't take what I said wrong...I do prefer AutoIt over batch for nearly every thing...just if you had a batch file already done....it would make little since to create a AutoIt script is all. :)

Yeah I'll be posting the correct script here in a bit...next 5-10min :)

#5
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03

If FileExists  ( @ScriptDir & "\Firefox10_Silent_EN.exe" ) Then
    RunWait ( @ScriptDir & "\Firefox10_Silent_EN.exe" )
EndIf

If FileExists ( @ScriptDir & "\profile.exe" ) Then
      RunWait ( @ScriptDir & "\profile.exe" )
EndIf


firefox installs ok, but my sfx profile does not install.

#6
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,656 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
Conditions. Very easy with Autoit. Basically any condition can be used.
Worth learning Autoit as batch programming is limited.
Autoit is a very powerful language indeed.

Is this what you wanted to hear, Astalavista ;)

#7
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
ok ok... i will sit down and learn it.

after i finish learning installshield 10.5 ... heheheh :)

#8
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
hmm try this then...

Func _Install( $i )
	If FileExists  ( @ScriptDir & "\" & $i ) Then
  $PID = Run	( @ScriptDir & "\" & $i )
  ProcessWaitClose( $PID )
	EndIf
EndFunc

_Install( "Firefox10_Silent_EN.exe" )
_Install( "profile.exe" )
_Install( ... )


#9
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
it is working now...

Question: Can i continue adding SFX files to this script?

Func _Install( $i )
If FileExists ( @ScriptDir & "\" & $i ) Then
$PID = Run ( @ScriptDir & "\" & $i )
ProcessWaitClose( $PID )
EndIf
EndFunc

_Install( "SFX001.exe" )
_Install( "SFX002.exe" )
_Install( "SFX003.exe" )
_Install( "SFX004.exe" )
_Install( "SFX005.exe" )
_Install( "SFX006.exe" )
_Install( "SFX007.exe" )
_Install( "SFX008.exe" )

the beauty of Autoit is that it does not show a dialog box which i really hate.

#10
MHz

MHz

    Just simple

  • Member
  • PipPipPipPipPipPipPip
  • 1,656 posts
  • Joined 02-August 04
  • OS:Windows 7 x64
  • Country: Country Flag
Yes? Depending on the setting of the archives for success. WinRAR uses extraction, then you have execution. 2 separate processes. Do a small test first.

#11
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
Sorry for bugging you guys (Mhz and Nologic)

what about for Nero Reloaded For Example

I have a RegTweak.reg ->> Followed by NeroReloadedSetup.exe ->> Followed by NeroReloadedHelpFileSetup.exe.

What is the autoit for registering REG file silently, then run two sfx files.

#12
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
Well if your just looking for batch extraction then I'd use this -

$search	= FileFindFirstFile ( @ScriptDir & "\*.exe" )
If $search <> -1 Then
	While 1
  $i = FileFindNextFile ( $search )
  If @error Then ExitLoop

  $PID = Run	( @ScriptDir & "\" & $i )
  ProcessWaitClose( $PID )
	Wend
FileClose	( $search )
EndIf

That will run through the current folder and execute all *.exe files one after the other automatically...no need for extra code.

Now as MHz suggested if a secondary process is spawned then some thing like below would be better suited to your needs -

Func _Install( $i1 , $i2 )
	If FileExists  ( @ScriptDir & "\" & $i1 ) Then
  $PID = Run	( @ScriptDir & "\" & $i1 )
  ProcessWaitClose( $PID )
  Sleep  ( 500 )
  If $i2 <> "" Then ProcessWaitClose( $i2 )
	EndIf
EndFunc

_Install( "SFX001.exe" , "" )
_Install( "SFX002.exe" , "Firefox.exe" )
_Install( "SFX003.exe" , "" )
_Install( "SFX004.exe" , "" )
_Install( "SFX005.exe" , "EmEditor.exe" )
_Install( "SFX006.exe" , "" )
_Install( "SFX007.exe" , "WinAmp.exe" )
_Install( "SFX008.exe" , "" )

Tho maybe MHz has a suggestion for better code...

#13
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
hmmm

Run ( "REGEDIT /S myreg.reg", "" )

;)

Or if regedit has issues with spaces in folder names maybe -

Run ( "REGEDIT /S " & FileGetShortName ( @ScriptDir & "\file.reg" ) , "" )


replacing "\file.reg" with your actual file name

So I guess some thing like so -

Run	( "REGEDIT /S " & FileGetShortName ( @ScriptDir & "\file.reg" ) , "" )

$search	= FileFindFirstFile ( @ScriptDir & "\*.exe" )
If $search <> -1 Then
	While 1
  $i = FileFindNextFile ( $search )
  If @error Then ExitLoop

  $PID = Run	( @ScriptDir & "\" & $i )
  ProcessWaitClose( $PID )
	Wend
FileClose	( $search )
EndIf

Is what you would be needing for the above unless a secondary process is spawned then you would have to use the other code to deal with that.

#14
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
Thanks guys now i can use this as a template for my future projects.

I am sorry if i didn't make my question clearer.

For Nero Reloaded the Order must be

First... NeroSerials.Reg
Second... NeroReloadedSetup.exe (SFX file)
Third.... NeroLanguagePack.exe (SFX file)

#15
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
Example with secondary process spawned

; Merge Reg File
Run ( "REGEDIT /S " & FileGetShortName ( @ScriptDir & "\file.reg" ) , "" )

; Basic Fuction
Func _Install( $i1 , $i2 )
	If FileExists  ( @ScriptDir & "\" & $i1 ) Then
  $PID = Run ( @ScriptDir & "\" & $i1 )
  ProcessWaitClose( $PID )
  Sleep  ( 500 )
  If $i2 <> "" Then ProcessWaitClose( $i2 )
	EndIf
EndFunc

; Install Nero - Using Fuction
_Install( "NeroReloadedSetup.exe" , "NeroSetup.exe" )

; Install Nero Lang Pack - Using Fuction
_Install( "NeroLanguagePack.exe" , "NeroLangSetup.exe" )

Although you may want to swap out "Run" for "RunWait" for the reg merge....

#16
edmoncu

edmoncu

    Advanced Member

  • Member
  • PipPipPip
  • 331 posts
  • Joined 28-April 04
great scripts... up to now, im stuck at issuing CMD to launch a fileexist command, as well as installing entire apps on a subdirectory. great tips! :D will have to redo my scripts to use pure autoit commands. :) :thumbup
Please join the growing Filipino Community of PC Experts and Enthusiasts
Posted Image

#17
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
Well here is a simple script that can install a number of different types of installers. It could be expanded to cover more tho with out much editing.

So if you don't care where the files end up (default install path) and what your start menu looks like...well you can install a mess of app's and hot fixes with this puppy. ;)

Now I may have things named wrongly...but the exercise works...hehe or should at least. ;)

Create folders as named in the script that use the listed switchs...place the compiled script out side of these folders and then execute it...it should install the contents of each folder with out a hitch.

Func _BInstall( $i1 , $i2 )
	$search = FileFindFirstFile ( @ScriptDir & $i1 & "*.exe" )
	If $search <> -1 Then
  While 1
 	 $i = FileFindNextFile ( $search )
 	 If @error Then ExitLoop

 	 $PID = Run ( @ScriptDir & $i1 & $i & $i2 )
 	 ProcessWaitClose( $PID )
  Wend
	FileClose ( $search )
	EndIf
EndFunc

_BInstall( "\Type 1\" , " /Q /O /N /Z" )
_BInstall( "\Type 2\" , " /Q:A /R:N" )
_BInstall( "\Type 3\" , " /passive /norestart /quiet" )
_BInstall( "\Type 4\" , " /q /n /z" )
_BInstall( "\Inno\" , " /VERYSILENT /SP- /NOCANCEL /NORESTART" )
_BInstall( "\Wise\" , " /s" )
_BInstall( "\Nullsoft\" , " /S" )

Exit


#18
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
nologic so now i can do this

Func _Install( $i1 , $i2 )
If FileExists ( @ScriptDir & "\" & $i1 ) Then
$PID = Run ( @ScriptDir & "\" & $i1 )
ProcessWaitClose( $PID )
Sleep ( 500 )
If $i2 <> "" Then ProcessWaitClose( $i2 )
EndIf
EndFunc

_Install( "winampini.exe" , "" )
_Install( "winampini2.exe", "" )

; Merge Reg File
Run ( "REGEDIT /S " & FileGetShortName ( @ScriptDir & "\winamp.reg" ) , "" )

EndIf
EndFunc

#19
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
The last two lines -

EndIf
EndFunc

are not needed.

#20
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
nologic

would it be possible to modify the script that u gave me to ...

1. Install SFX (silent installer)
wait till it finishes

then

2. Instal SFX (silent installer 2)
wait till it finishes

3. Install Reg key

i notice sometimes it is too fast that my second sfx is already running with the first sfx finishing.

#21
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
hmm your above posted code should do that as is...maybe increase the sleep time for the secondary proccess to spawn...if there is one.

Func _Install( $i1 , $i2 )
If FileExists ( @ScriptDir & "\" & $i1 ) Then
$PID = Run ( @ScriptDir & "\" & $i1 )
ProcessWaitClose( $PID )
Sleep ( 1000 )
If $i2 <> "" Then ProcessWaitClose( $i2 )
EndIf
EndFunc

_Install( "ATI_Driver.exe" , "Setup1.exe" )
_Install( "ATI_Panel.exe", "Setup2.exe" )

; Merge Reg File
Run ( "REGEDIT /S " & FileGetShortName ( @ScriptDir & "\ATI.reg" ) , "" )

Now what I'm wondering is if your taking into account if there is a secondary process being spawned or not.

In the above example I incressed the sleep time to 1 second...then the first file is lets say a SFX file...it extracts a file called Setup1.exe and and executes it via the comments section of the SFX file....since this is a secondary process being spawned its added to the same line of code to make sure that every thing dealing with the sfx file goes off with out a hitch prior to starting another sfx file...which its self spawns yet another process.

Just putting -

_Install( "ATI_Driver.exe" , "" )

Will not account for Setup1.exe being ran after ATI_Driver.exe is done extracting it....so in this case one would end up with both Setup1.exe running while ATI_Pannel.exe is also starting up...so make sure your accounting for the secondary process if there is one.

The AutoIt script knows nothing more than what you tell it. :)

Now if thats not the case then I'm kind of stumped...because it should wait till a named process is actually complete before moving on to the next.

#22
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
that did it.... thanks

yahooo!!!! off to continue my wpi

i made a sfx _ autoit installer for the trial version of ulead gif animator

thanks to U

#23
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
Your welcome :)

#24
Astalavista

Astalavista

    MSFN loyalist

  • Member
  • PipPipPipPipPipPipPipPipPip
  • 3,338 posts
  • Joined 02-December 03
nologic / mhz

the script does not work on this command

msiexec /i "isscript.msi" /qn
msiexec /i "CuteFTP 6 Professional.msi" issetupdriven=1 allusers=1 installlevel=1 reboot=reallysuppress /qn

#25
Nologic

Nologic

    Advanced Member

  • Member
  • PipPipPip
  • 461 posts
  • Joined 07-October 03
Try this -

Func _Install2( $i1 , $i2 )
	If FileExists ( $i1 ) Then
  Run	( "msiexec /i " & $i1 )
  ProcessWaitClose( $i1 )
  Sleep	( 1000 )
  If $i2 <> "" Then ProcessWaitClose( $i2 )
	EndIf
EndFunc

_Install2( "isscript.msi /qn", "" )
_Install2( "CuteFTP 6 Professional.msi issetupdriven=1 allusers=1 installlevel=1 reboot=reallysuppress /qn", "" )

Try the revision




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users