Sign in to follow this  
Followers 0
GEOSoft

Command line compile

10 posts in this topic

I have a small app that has been working fine since it's first early days when it was built with msg and input boxes and then worked fine when I migrated it to Larry's origional GUI and seemed to work fine with the new GUI until I tried something yesterday. Normally I run this app from my Win 98 partition and it has never failed. Yesterday I tried using it in Win XP and all I got was the error 'Unable to open destination file' (or similiar). I thought maybe it was because I just imported the AutoIt registry settings from the 98 partition so I installed AutoIt on XP as well. Still no joy. I tested the script several times and it appears that using the command line compile does not work properly in XP. I was going to upload the app and script so that other AutoIt users could use it as well but there is not much sense in doing that when it doesn't work in XP. Has anyone else run into anything like this? I could post the script but it is large. Posting the relevent function probably won't help because it uses several variables that are set earlier in the script. If Jon has a page where I can upload this to then all of you are welcome to play with it and make any changes or add enhancements. It's an app to create, manage and compile projects. The code for compiling Autoit is complete (except for this problem), the code for HTML help is complete as is the code for Inno Setup compiling. The portion for Nullsoft is not yet complete (I don't think) and I have not started on the VB, C++ or Delphi Compiler stages yet.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites



Compiling seems OK here under XP, and right click compiling is actually command line compiling too...

What is more likely is that 9x is using short filenames for things and when you run under XP long filenames are used and if these contain spaces then boom.

I would first print a MsgBox that outputs the actual command line you are running and see if that helps.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I'll look at that again Jon but here is the code for that particular function and as you can see it should be returning LFN's in any case.

Func CompAI()
    $ProjN = 'AutoIt3'
    GUISetControlEx (13,-1,-1,'',-1,'16777215')
    ControlSetText ($ttl,'','Static1','Compiling your '&$Cbx[1]&' Files')
    $Comp = RegRead ('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\Aut2Exe.exe','')
    $Script = FileExists ($Path&'AutoIt\*.au3')
    $Icon = FileExists ($Path&'Images\*.ico')

    If $Script = 1 AND $Icon = 1 Then
  $Proj = $Proj&@LF&Chr(9) & $ProjN
  $Script = '"'&FileGetLongName ($Path&'AutoIt\*.au3')&'"'
  $Icon = '"'&FileGetLongName ($Path&'Images\*.ico')&'"'
  $Out = StringReplace ($Script,'au3','exe')
  RunWait ($Comp &' /in '& $Script &' /out '& $Out &' /icon '& $Icon)
;   RunWait ($Comp &' /in '& $Script &' /icon '& $Icon)
    ElseIf $Script = 1 AND $Icon = 0 Then
  $Proj = $Proj&@LF&Chr(9) & $ProjN
  $Script = '"'&FileGetLongName ($Path&'AutoIt\*.au3')&'"'
  $Icon = '"'&@ScriptDir&'\Au3.ico'&'"'
  $Out = StringReplace ($Script,'au3','exe')
  RunWait ($Comp &' /in '& $Script &' /out '& $Out &' /icon '& $Icon)
    Else
  NoFile($ProjN)
    EndIf
Sleep (1000)
GUISetControlEx (7,4)
EndFunc; CompAI()
On top of that I also have the double quotes in place. I tried the message box idea last night and it looked fine. You can also see where I changed the runwait string to include $Out but it was not needed in 98 and does not help in XP. My understanding is that the output file does not have to be specified. Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I just tried a short path and it still fails in XP Jon. The path was

"c:\projects\stripit\strit.au3" for the /in and "c:\projects\stripit\strit.exe" for /out and the message box returned it properly so it does not appear to be an LFN problem unless XP doesn't like the double quotes.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I just tried a short path and it still fails in XP Jon. The path was

"c:\projects\stripit\strit.au3" for the /in and "c:\projects\stripit\strit.exe" for /out and the message box returned it properly so it does not appear to be an LFN problem unless XP doesn't like the double quotes.

MsgBox this entire line:

MsgBox (0, "", $Comp &' /in '& $Script &' /out '& $Out &' /icon '& $Icon)

Type it into the Start / Run command. Does it run? Is it Autoit failing "calling" the script or is it aut2exe failing when it tries to compile? I can't reproduce any problems here at the moment so I can only guess and suggest that it still is some weird quote/lfn/sfn problem.

Can you right-click compile the file? Can you compile the file from the GUI using the same file names, etc.

Edited by Jon

Share this post


Link to post
Share on other sites

Right click compile works fine. It may be something else in my script though. And the message box returns properly in both 98 and XP. Is there an address where I could send the whole script Jon? It's just weird that it returns everything properly when I use mesage boxes to test butfails when I do the actual compile in XP. I could either send you the script or the setup file for the app (or both).


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I'm still having a problem with this Jon. It's working great in 98 (which suits me fine) but not in XtraProblems which will not make other developers keen on using the app. I hate XP anyway but you might like tobe using it. I just meed an Email address and I will send you both the script (complex GUI) and the setup file which will give you all of the other files that go with it.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I'm not going to have time to look at complex code, surely if if's a problem calling the compiler you can just knock up two hardcoded lines that fail and send that?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

RunWait ($Comp &' /in '& $Script &' /out '& $Out &' /icon '& $Icon)

That line is wrong if $Comp is the default location of Aut2exe (Program Files contains spaces)

You are going to want quotes around anything in that command line that could possibly have spaces:

RunWait('"' & $Comp & '" /in "' & $Script & '" /out "' & $Out & '" /icon "' & $Icon & '"')

Or some such thing.

Edit: Or to remove the need for all the quotes run $Comp, $Script, $out and $icon through FileGetShortName() first.

Edited by Jon

Share this post


Link to post
Share on other sites

Thanks Jon, I'll give it a try.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
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
Sign in to follow this  
Followers 0