AutoHotkey Community

It is currently May 27th, 2012, 11:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: September 10th, 2010, 3:12 pm 
Offline

Joined: September 23rd, 2009, 6:33 pm
Posts: 19
Ahk2exe does not notice syntax errors; when it is run from command line and the script contains #ErrorStdOut. Instead of reporting a syntax error, the compiler produces a corrupted EXE file and sends "Successfully compiled: <script_name> to stdout.
Version of the compiler is v1.0.48.05


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2010, 3:58 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Ahk2Exe is a compiler only in the sense of "compiling a list", not "compiling a program". It just pre-processes #include and FileInstall and packs the script into a copy of AutoHotkeySC.bin. It isn't designed to do any syntax checking, regardless of #ErrorStdOut.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2010, 4:01 pm 
Offline

Joined: September 23rd, 2009, 6:33 pm
Posts: 19
I see. Thank you for your reply.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2010, 4:23 pm 
Offline

Joined: September 23rd, 2009, 6:33 pm
Posts: 19
I worked the problem around by running the script with Autohotkey.exe before compiling it. If there are any syntax errors, they would be reported by Autohotkey.exe. Below is a fragment of my batch file I use to compile.
Code:
rem ----------------------------------------------------------------
rem Run the script to check the syntax since the compiler is not
rem good at noticing and reporting syntax errors, see
rem http://www.autohotkey.com/forum/viewtopic.php?t=62393
set command="%ahkExe%" /ErrorStdOut %source%
set tmpLog=%binPath%\temp.log
%command% >%tmpLog%
if ErrorLevel 1 (
   type %tmpLog%
   del  %tmpLog%
   goto error
) else (
   del  %tmpLog%
)
rem compiling the ahk code... --------------------------------------
echo Compiling %source% on %date% at %time% into %target% ...
set command="%ahkPath%\Compiler\Ahk2exe.exe" /in %source% /out %target%
%command%
if ErrorLevel 1       goto error
if not exist %target% goto error
rem Run the target without parameters to ensure the compilation was ok;
rem since the compiler returns ErrorLevel 0 even if it failed.
rem It should set ErrorLevel to 0 if it is executed successfully.
set command=%target%
%command% >NUL
if ErrorLevel 1       goto error


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 26 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group