Jump to content

Redirect Autoit to another .au3 file.


Recommended Posts

Hi guys, its me again.

I was trying to do the following. I have succesfully created an autoit for IExplorer testing the win7 x86 enviroment So what im trying to do now, is write some code to redirect the test to another autoit when i run this file in win xp. Do u understand what i mean ? If i run this file... ex: ie8finaltest.au3 in win7 x86 or x64 it takes the whole code from this file. but if I use this same ie8finaltest.au3 in a Win XP enviroment, it should start normally but instead of running the entire file, it must redirect the test to another autoit... ex : ie8XPtest.au3

Im asking to do this because i dont want to have a super large file with the whole code : ex : test running normally....

If winexists("compatibility error") then

all the windows XP code <----- this would be very ehausting to do

Enfif

Thnx guys for your patience

Link to comment
Share on other sites

You could put everything in a single executable. Use Case and functions to perform different commands based on the system you have. Example below checks which OS you have, then checks to see if you have 32 or 64 bit.

Switch @OSVersion
Case "WIN_7"
    _Win7()
    Switch @OSArch
        Case "X64"
            _OS_64()
        Case "X86"
            _OS_32()
    EndSwitch
Case "WIN_XP"
    _WinXP()
    Switch @OSArch
        Case "X64"
            _OS_64()
        Case "X86"
            _OS_32()
    EndSwitch
EndSwitch

Func _WinXP()
    MsgBox(0, "", "You are running Windows 7")
EndFunc

Func _Win7()
    MsgBox(0, "", "You are running Windows XP")
EndFunc

Func _OS_64()
    MsgBox(0, "", "You have a 64 bit OS")
EndFunc

Func _OS_32()
    MsgBox(0, "", "You have a 32 bit OS")
EndFunc
Link to comment
Share on other sites

Abberration

i mad this post because my boss asked me to do a main script with differents calls to another scrips . this way i would always run the same scrip no matter with OS im running and always work.

the way u suggested is prefect for doing it in on single file..

But i need to do it in differents .au3

can it be done ?

Link to comment
Share on other sites

If you must use multiple scripts. Compile the script files to A3x, use FileInstall, and then use the RunWait. By using A3X, you take care of all your dependencies.

Switch @OSVersion
Case "WIN_7"
FileInstall("Script1.a3x", @ScriptDir & "", 1)
RunWait(@AutoItExe & " Script1.a3x", '', @SW_HIDE)
Case "WIN_XP"
FileInstall("Script2.a3x", @ScriptDir & "", 1)
RunWait(@AutoItExe & " Script2.a3x", '', @SW_HIDE)
EndSwitch

Adam

Edited by AdamUL
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...