Jump to content

Script runs as .au3, but not when compiled


sjp
 Share

Recommended Posts

I have a script for installing software patches, all it does is call up the installation executable from a network drive, then provide mouse clicks for some answers. This works fine as .au3, when I compile it it gets as far as calling the patch installer, then seems to launch itself again. I get multiple debug icons in the system tray - a new one each time I click OK to continue with install - if I click the tray icon it just says the script is paused. I am hoping not to have to install autoit onto all my client systems , which is why I would like the .exe to work.

Here is the relevant part of the script ...

; Include the debug tool

AutoItSetOption ( "TrayIconDebug", 1 )

AutoItSetOption ( "RunErrorsFatal", 1 )

; Move to directory where the Hyperworks install is run from

FileChangeDir ("\\1dp0605\software\CAE Apps\Altair\v7.0\patches")

; Create a message box to explain to the user what is happening

MsgBox(0, "Altair Hyperworks v7 service pack upgrade (LogicaCMG)", "The service pack upgrade for Altair Hyperworks v7 is about to run. Please press O.K. to continue")

;service pack 1

Run ("HWupdate-70-SP1_pc.exe", "\\1dp0605\software\CAE Apps\Altair\v7.0\patches\")

.

.

.

I have also tried with the run line set as ...

Run ("\\1dp0605\software\CAE Apps\Altair\v7.0\patches\HWupdate-70-SP1_pc.exe")

and as ....

Run ("s:\CAE Apps\Altair\v7.0\patches\HWupdate-70-SP1_pc.exe")

(\\1dp0605\software is mounted as s:)

Any help would be really useful - this is driving me nuts. :P

Link to comment
Share on other sites

Do some checks to see what is returned.

; Include the debug tool
AutoItSetOption ( "TrayIconDebug", 1 )
AutoItSetOption ( "RunErrorsFatal", 1 )

; Move to directory where the Hyperworks install is run from
If FileChangeDir ("\\1dp0605\software\CAE Apps\Altair\v7.0\patches") Then

; Create a message box to explain to the user what is happening
    MsgBox(0, "Altair Hyperworks v7 service pack upgrade (LogicaCMG)", "The service pack upgrade for Altair Hyperworks v7 is about to run. Please press O.K. to continue")

;service pack 1
    $file = @WorkingDir & '\HWupdate-70-SP1_pc.exe'
    If FileExists($file) Then
        Run ($file)
    Else
        MsgBox(16, "Altair Hyperworks v7 service pack upgrade (LogicaCMG)", $file & " not found")
    EndIf
Else
; FileChangeDir failed
    MsgBox(16, "Altair Hyperworks v7 service pack upgrade (LogicaCMG)", 'Working directory is currently here: ' & @WorkingDir)
EndIf

Ensure the name of the compiled executable is not HWupdate-70-SP1_pc.exe for safe operation.

Edited by MHz
Link to comment
Share on other sites

THANK YOU - I knew I was doing something really stupid. The autoit script had the same name as my installation script: change the name & it works a treat (even though they are in different directories, which I don't understand).

:P

Link to comment
Share on other sites

THANK YOU - I knew I was doing something really stupid. The autoit script had the same name as my installation script: change the name & it works a treat (even though they are in different directories, which I don't understand).

:lmao:

The compiled script can see itself and everything in the new working directory.

All of my installation scripts start with an underscore with the same name as the installer and spaces are replaced with underscores to make for easy operation, so executing the script itself does not happen. :P

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