NasaGuru wrote:And of course now there is a new issue: compiling works fine, but when I try to run, it opens the command prompt and says:
' .exe' is not a recognized internal or external command, operable program or batch file
Press any key to continue...
Then when I try to run it again right after that it works. Why is this happening?
I'm guessing your compilation goes something along the following lines: You have a code file $FileName and you are sending this to the compiler so that it creates an executable called $BaseName.exe (where $BaseName is $FileName stripped of the extenstion) which you then intend to run from the code file as the active document using your 'run' tool, however that is set up. That this works when you "run it again" shows that you have it set up correctly, but what's happening the first time?
Well, to get access to the $BaseName parameter so that your executable will run, the code file needs to be the 'active document' in TextPad. However, having just performed a compile immediately prior to wanting to launch, this file 'loses focus' which goes
to the tool output window so, when you press run the $BaseName is lost, and as the tool output window has no name, your run tool is trying to launch "".exe, which of course it can't. After you click on the error dialog box and dismiss it, your code file becomes the active window again and so, the next time you press run ... it works.
What you need to do to avoid this little frustration is, immediately after compiling your .exe, click anywhere in your code file (or on the document tab at the top) and
then select run.
It's important to understand fully how TextPad passes parameters to tools based on the name/directory/etc of the active document. As your projects get more sophisticated, this method can appear somewhat limiting - especially if you find yourself generating executables whose base name does not match the base name of any available open file; in which case, you have to think about setting up your tools to use some form of intermediary, such as a .bat file to launch your .exe.
Another issue requiring a more sophisticated solution is when your executable is built in a directory other than the current one, in which case a .bat file is practically necessary for launch. (Having said that, another trick is to create a dummy file in the target directory called MyExeName.anything and then use this as the active file to launch your .exe from using the $BaseName parameter. All interesting stuff!)
Hope this helps you to get a sense of what's going on.