Jump to content

Having Issues Compiling Script to .exe


Recommended Posts

I've been using AutoIt for a few weeks now, and I really love it.

However, over the last day or so I've been having issues when I try to compile my scripts into .exe files. Half the time it compiles successfully, and the rest of the time it errors at some point in the process. I want to understand why this is happening, and haven't seen many topics about it on the forum already. I don't think my code is to blame, but just in case, here it is.

AutoItSetOption( "TrayIconDebug", 1 )
$answer = MsgBox(3, "Preliminary Check", "Is this the first user?")
If $answer = 6 Then
    FileCopy(@ScriptDir & "\MyStartup.exe", @StartupDir) ;copy from flashdrive to startup folder
    if @error = 1 then
        msgbox(0, "Error", "Failed to copy to Startup Folder") ;Tell me if it doesn't
if $answer = 2 Then
ProgressOn("Running the paces.", "Opening things.", "0 percent")
ProgressSet( 12.5, 12.5 & " percent")
Run("RunDll32.exe shell32.dll,Control_RunDLL inetcpl.cpl") ;internet options
ProgressSet( 25, 25 & " percent")
Run("RunDll32.exe shell32.dll,Control_RunDLL sysdm.cpl") ;System properties
ProgressSet( 37.5, 37.5 & " percent")
Run("RunDll32.exe shell32.dll,Control_RunDLL powercfg.cpl") ;Power settings
ProgressSet( 50, 50 & " percent")
if RegRead( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt") = 1 Then ; If it can't see file extensions
    RegWrite( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "HideFileExt", "REG_DWORD", "0") ;show file extensions
ProgressSet( 62.5, 62.5 & " percent")
if RegRead( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden") = 2 Then ;If it can't see hidden folders
    RegWrite( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "Hidden", "REG_DWORD", "1") ;show hidden folders
ProgressSet( 75, 75 & " percent")
$temp = dirgetsize(@TempDir, 1)
WinWaitActive("[CLASS:Notepad]") ;Script stops if I use a msgbox, but not if I use notepad.
ProgressSet( 87.5, 87.5 & " percent")
send("Number of temp files:" & $temp[1]) ;display number of files in temp dir
run('explorer ' & @TempDir)
WinWaitActive("Temp") ;select Temp folder
send("^a") ;select all files in Temp folder
ProgressSet( 100, 100 & " percent")

This is running on an XP Pro SP3 machine with ample resources.


Link to comment
Share on other sites

I am having the same problem on Windows 7 x64. When you compile from within Scite you get the error message from Aut2exe (and quite often, but not always). I have not been able to explain it, but it seems to have some relation to x86 versus 64 bit compiler. In my case its the 64bit version that failes to compile sometimes, but x86 always compiles. Before compiling make sure the exe is not running in Task manager, which i am sure you have already checked.

Link to comment
Share on other sites

I've read another thread about this issue and the resolution was to reboot the machine. This doesn't work for me, and neither does reinstalling AutoIt (through the normal uninstall method, which seems to leave the registry information intact).

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

  • Recently Browsing   0 members

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