syntax Posted February 26, 2015 Share Posted February 26, 2015 Hello Everery one , I'm very happy to regstiry on Auto it Fourm . Usually I'm using auto it for small installtion issue maybe one software that I'm familar with it But I hade really situation make me gone crazy , I need way for installing multi os software for xp and 7 and 8 and the big issue this software package it has multi version target 'x86' & 'x64' this what im try to do this : I write func for check os type then assing the result to var called $isystype , then another func check the osarch and assing to var called $isys86 or $isys64 whithen if func , then another func read all the assingment of variable that are set to send msg to the user and finally call func called install86() and install64() both they had own software package all this func on one func call _main() So pleas tell me did I try doing something will not happen Link to comment Share on other sites More sharing options...
Trong Posted February 26, 2015 Share Posted February 26, 2015 (edited) If StringInStr(@OSVersion,"XP") Then; MsgBox(0, "", "Now Installing Xp Version..."); ElseIf StringInStr(@OSArch,"64") Then; MsgBox(0, "", "Installing Vista/7/8/10 64 bit whatever"); Else; MsgBox(0,"","Installing Vista/7/8/10 32 bit whatever"); EndIf; Edited February 26, 2015 by Trong Regards, Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 If StringInStr(@OSVersion,"XP") Then; MsgBox(0, "", "Now Installing Xp Version..."); ElseIf StringInStr(@OSArch,"64") Then; MsgBox(0, "", "Installing Vista/7/8/10 64 bit whatever"); Else; MsgBox(0,"","Installing Vista/7/8/10 32 bit whatever"); EndIf; Thanks but the msgbox is the last thing I need it , I need way to call func form func and inhartance some variable form it to other func Link to comment Share on other sites More sharing options...
Trong Posted February 27, 2015 Share Posted February 27, 2015 If _IsXP() Then; MsgBox(0, "", "Now Installing Xp Version..."); ElseIf _IsWin64() Then; MsgBox(0, "", "Installing Vista/7/8/10 64 bit whatever"); Else; MsgBox(0,"","Installing Vista/7/8/10 32 bit whatever"); EndIf; Func _IsXP(); Return StringInStr(@OSVersion,"XP"); EndFunc; Func _IsWin64(); Return StringInStr(@OSArch,"64"); EndFunc; AutoIt.chm: F1 Regards, Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 If _IsXP() Then; MsgBox(0, "", "Now Installing Xp Version..."); ElseIf _IsWin64() Then; MsgBox(0, "", "Installing Vista/7/8/10 64 bit whatever"); Else; MsgBox(0,"","Installing Vista/7/8/10 32 bit whatever"); EndIf; Func _IsXP(); Return StringInStr(@OSVersion,"XP"); EndFunc; Func _IsWin64(); Return StringInStr(@OSArch,"64"); EndFunc; AutoIt.chm: F1 Nice job , and BTW for the first time I know something call stringinstr I will check it on help index . Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 (edited) I need to know is this right : if @osarch = 'x86' then $icheck = $isys86 elseif @osarch = 'x64' then $icheck = $isys64 endif well when try to assing one of the if result to $icheck variable it would not be assing why ? Edited February 27, 2015 by syntax Link to comment Share on other sites More sharing options...
Error Posted February 27, 2015 Share Posted February 27, 2015 $iCheck/$isYs86/$isYs64: possibly used before declaration. Global $iCheck Local $isYs86=True,$isYs64=True If @OsArch = 'x86' Then $iCheck = $isYs86 Else $iCheck = $isYs64 endif Link to comment Share on other sites More sharing options...
Trong Posted February 27, 2015 Share Posted February 27, 2015 (edited) Nice job , and BTW for the first time I know something call stringinstr I will check it on help index . StringInStr( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] ) Return Value Success: the position of the substring. Failure: 0 if substring not found. @error: 1 = Invalid "start" or "occurrence" parameter given. You need to learn how to debug! ConsoleWrite("Is: " & StringInStr(@OSVersion,"XP") & @CRLF) ; Is 0=False 0<>True Edited February 27, 2015 by Trong Regards, Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 $iCheck/$isYs86/$isYs64: possibly used before declaration. Global $iCheck Local $isYs86=True,$isYs64=True If @OsArch = 'x86' Then $iCheck = $isYs86 Else $iCheck = $isYs64 endif Sound good , I will check it . Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 StringInStr( "string", "substring" [, casesense = 0 [, occurrence = 1 [, start = 1 [, count]]]] ) Return Value Success: the position of the substring. Failure: 0 if substring not found. @error: 1 = Invalid "start" or "occurrence" parameter given. You need to learn how to debug! ConsoleWrite("Is: " & StringInStr(@OSVersion,"XP") & @CRLF) ; Is 0=False 0<>True how to debug ? , usually I'm use sysntaxcheck to know what error ecourd otherwise I dont know how to debug with other tool Link to comment Share on other sites More sharing options...
Trong Posted February 27, 2015 Share Posted February 27, 2015 Just run the code and get results with: ConsoleWrite(); MsgBox(); ; etc.. Regards, Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 (edited) Just run the code and get results with: ConsoleWrite(); MsgBox(); ; etc.. Do you mean using the simecolon with every line to debugor what ? Edited February 27, 2015 by syntax Link to comment Share on other sites More sharing options...
Trong Posted February 27, 2015 Share Posted February 27, 2015 Maybe, if you do not know the results. Global $iCheck Local $isYs86=True,$isYs64=True ConsoleWrite((@OsArch = 'x86') & @CRLF) If @OsArch = 'x86' Then $iCheck = $isYs86 Else $iCheck = $isYs64 endif ConsoleWrite($iCheck & @CRLF) Regards, Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 Now I had Issue with the msi file installtion , I use more than way and test it But it did't work I use this Option from help file to run it RunWait(@ComSpec & " /c Start myfile.msi") the problem is there is more than one msi file I need to run the first intell they finish and run the second one the second issue how can I assing var to msi dir beside the script dir , something like this $msipath . any suggetion . Link to comment Share on other sites More sharing options...
iamtheky Posted February 27, 2015 Share Posted February 27, 2015 so just use run instead of runwait and things will continue to execute. And it doesnt matter what you call your var that you set to a path. and posting code is far better than posting explanations. We will understand a lot better what the issues are currently and where you are headed. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
syntax Posted February 27, 2015 Author Share Posted February 27, 2015 (edited) so just use run instead of runwait and things will continue to execute. And it doesnt matter what you call your var that you set to a path. and posting code is far better than posting explanations. We will understand a lot better what the issues are currently and where you are headed. Ok here is expample : Func _install86() run(@ComSpec & " /c Start myfile1.msi") run(@ComSpec & " /c Start myfile2.msi") run(@ComSpec & " /c Start myfile3.msi") run(@ComSpec & " /c Start myfile4.msi") run(@ComSpec & " /c Start myfile5.msi") EndFunc I dont need the file to be excute at one time beacuse many msi can't be insatlled at one time , this will break the opertion . Edited February 27, 2015 by syntax Link to comment Share on other sites More sharing options...
iamtheky Posted February 27, 2015 Share Posted February 27, 2015 (edited) there is more than one msi file I need to run the first intell they finish and run the second one apologies, i was mistaken on my interpretation of the above statement. you need them all to run in order one right after the other = use runwait. And while you are testing I would use cmd /k to make sure everything in the msi is executing normally, that also forces the cmd window to wait for you to close before it moves on to the next run command so you can have a visual of where you are breaking and play along, in case of failure. Edited February 27, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Solution Trong Posted February 27, 2015 Solution Share Posted February 27, 2015 If @OsArch='x86' Then Install_x86() Else Install_x64() endif Func Install_x86() RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile1.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile2.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile3.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile4.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile5.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile6.msi" /qb /norestart') EndFunc Func Install_x64() RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile1.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile2.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile3.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile4.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile5.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile6.msi" /qb /norestart') EndFunc Regards, Link to comment Share on other sites More sharing options...
syntax Posted March 1, 2015 Author Share Posted March 1, 2015 apologies, i was mistaken on my interpretation of the above statement. you need them all to run in order one right after the other = use runwait. And while you are testing I would use cmd /k to make sure everything in the msi is executing normally, that also forces the cmd window to wait for you to close before it moves on to the next run command so you can have a visual of where you are breaking and play along, in case of failure. no problem sir maybe thanks for sharing the /k suggestion . Link to comment Share on other sites More sharing options...
syntax Posted March 1, 2015 Author Share Posted March 1, 2015 If @OsArch='x86' Then Install_x86() Else Install_x64() endif Func Install_x86() RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile1.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile2.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile3.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile4.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile5.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x86_YourFile6.msi" /qb /norestart') EndFunc Func Install_x64() RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile1.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile2.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile3.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile4.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile5.msi" /qb /norestart') RunWait('MsiExec.exe /i "' & @ScriptDir & '\x64_YourFile6.msi" /qb /norestart') EndFunc @ trong thanks sir I willy respect your great helpful for me and sharing some useful idea , I will mark your post as sloved , I will make the last test an tell you the the final result Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now