Jump to content

Compiled file no longer works


Go to solution Solved by rudi,

Recommended Posts

Posted

I have this script:

Quote

 

#pragma compile(AutoItExecuteAllowed, True)

$file_loc1 = "c:\Nor_COMBO.au3"
$file_au32 = FileGetShortName($file_loc1)
RunWait(@AutoItExe & " " & $file_au32, "", @SW_HIDE)


sleep(1000)


$file_loc2 = "c:\All_RT_Scans.au3"
$file_au32_2 = FileGetShortName($file_loc2)
RunWait(@AutoItExe & " " & $file_au32_2, "", @SW_HIDE)


sleep(1000)

$file_loc3 = "c:\Ialeg.au3"
$file_au32_3 = FileGetShortName($file_loc3)
RunWait(@AutoItExe & " " & $file_au32_3, "", @SW_HIDE)

 

the .au3 file works.
However when I compile it  stops working.
Run the file in loop and the only way I have to get out of this situation is to restart the PC.

I had read that it was necessary to insert the following line:

#pragma compile(AutoItExecuteAllowed, True)

however, it doesn't seem to change much.

Do you have any suggestions?

 

Posted (edited)

Just thought - enclose in doublequotes:

instead of

RunWait(@AutoItExe & " " & $file_au32, "", @SW_HIDE)

try

RunWait(@AutoItExe & ' "' & $file_loc1 & '"', "", @SW_HIDE)

 

EDIT:

It seems that you missed special commandline parameter: /AutoIt3ExecuteScript

 

from helpfile:

 

Quote

 

AutoIt specific command Line Switches

Form1: AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file [params ...]
                Execute an AutoIt3 Script File


/ErrorStdOut    Allows to redirect fatal error to StdOut which can be captured by an application as Scite editor. This switch can be used with a compiled script.
 

To execute a standard AutoIt Script File 'myscript.au3', use the command:
'AutoIt3.exe myscript.au3'

 

Form2: Compiled.exe [/ErrorStdOut] [params ...]
                Execute an compiled AutoIt3 Script File produced with Aut2Exe.

Form3: Compiled.exe [/ErrorStdOut] [/AutoIt3ExecuteScript file] [params ...]
                Execute another script file from a compiled AutoIt3 Script File. Then you don't need to fileinstall another copy of AutoIT3.exe in your compiled file.


Form4: AutoIt3.exe [/ErrorStdOut] /AutoIt3ExecuteLine "command line"
                Execute one line of code.

To execute a single line of code, use the command:
Run(@AutoItExe & ' /AutoIt3ExecuteLine  "MsgBox(0, ''Hello World!'', ''Hi!'')"')

The tray icon will not be displayed when using /AutoIt3ExecuteLine

NOTE: Correct usage of single- and double- quotation marks is important, even double single

 

 

Edited by Zedna
Posted
which box should I check?
Actually I wanted to convert the script to exe because I wanted to run it through windows task scheduler.
But I found that you can run it even without converting it to exe. 
So at the moment I solved my problem like this.

 
  • Developers
Posted

There is no box to check so have no idea what @Golbezmeans. My initial thing to check is both your av interfearing or a workdir issue depending on what those scripts do.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

  • Solution
Posted (edited)

if the default action for AU3 files is run, then it should be sufficent to add the full-path-name to your AU3 file when defining your windows task.

 

If not, then the program to call is 

"C:\Program Files (x86)\AutoIt3\AutoIt3.exe"

 

and the parameter will be

/AutoIt3ExecuteScript "C:\path with spaces\path\path\your autoit 3 script.au3"

 

From SciTE editor you can press CTRL+1  ("1", not "F1") to get this dialog, there you can adjust the default behaviour:

 

image.png.b7f7090180ac39e69d4f10fee65f9582.png

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
  • Recently Browsing   0 members

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