Jump to content

multi software installtion for different os arch


syntax
 Share

Go to solution Solved by Trong,

Recommended Posts

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 :sweating:

Link to comment
Share on other sites

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 by Trong

Regards,
 

Link to comment
Share on other sites

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 :shifty:

Link to comment
Share on other sites

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

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

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 by Trong

Regards,
 

Link to comment
Share on other sites

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

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

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

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 by syntax
Link to comment
Share on other sites

 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 by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

  • Solution

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

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 . :bye:

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...