Computer Science Canada Sys.Exec problems |
Author: | ProgrammingFun [ Sun Apr 18, 2010 8:12 am ] | ||
Post subject: | Sys.Exec problems | ||
What is it you are trying to achieve? I am trying to create an autorun type program. What is the problem you are having? Sys.Exec commands runs the error: "Expression is not a procedure and hence cannot be called." I also want to know if I am using the getch function properly. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
|
Author: | corriep [ Sun Apr 18, 2010 8:22 am ] | ||
Post subject: | Re: Sys.Exec problems | ||
Sys.Exec is a function and it returns a boolean, you cant call it on its own. For example:
|
Author: | ProgrammingFun [ Sun Apr 18, 2010 8:45 am ] |
Post subject: | RE:Sys.Exec problems |
Thanks, I tried the above but now I always get an error message for file not found although the file is in the same folder. I also tried it on a RAR file with no success. |
Author: | chrisbrown [ Sun Apr 18, 2010 10:05 am ] |
Post subject: | RE:Sys.Exec problems |
From <a href="http://compsci.ca/v3/viewtopic.php?t=6288">this post:</a> Try: if Sys.Exec ("\"Main Page.html\"") then .... |
Author: | ProgrammingFun [ Sun Apr 18, 2010 2:01 pm ] | ||
Post subject: | RE:Sys.Exec problems | ||
Thanks for the help!!! Edit: Here's my final code (for anyone interested):
I plan to use this as the autorun program in a CD which I have to give for my geo project. The reason I didn't just use notepad was that I wanted a readme type of file that also executed the program... I guess a batch file could also have worked...will post that if I make it. But I guess Turing's run window looks better... |
Author: | ProgrammingFun [ Sun Apr 18, 2010 3:12 pm ] |
Post subject: | CMD Program |
I created a batch file for the program above but decided that it looked ugly, was more disorganised, and was hard to run. However, here is the file (paste in notepad and save as a bat file): [syntax] echo Welcome to the GEO website developer! echo To run the website manually, run Main Page.html echo If the website is not compatible with your computer, use one of the preinstalled browsers in the Alternative Browsers window. echo To start the website now, press enter. PAUSE start Main Page.html TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL exit [/syntax] |
Author: | ProgrammingFun [ Mon Apr 19, 2010 8:40 pm ] |
Post subject: | RE:Sys.Exec problems |
I now have a new problem...at the beginning, my Main Page.html file was in the same directory as the Turing program but I now moved it into a subfolder with the name of "Geography Project". How would I create a Sys.Exec path to that file instead of the one given before? Thanks for the help! |
Author: | BigBear [ Mon Apr 19, 2010 8:43 pm ] |
Post subject: | RE:Sys.Exec problems |
Sys.Exec ("\Main Page.html") |
Author: | ProgrammingFun [ Mon Apr 19, 2010 8:53 pm ] | ||
Post subject: | Re: RE:Sys.Exec problems | ||
BigBear @ Mon Apr 19, 2010 8:43 pm wrote: Sys.Exec ("\Main Page.html")
The file is now under \Geography Project\Main Page.html And the following does not work:
Please help... Thanks |
Author: | TheGuardian001 [ Mon Apr 19, 2010 9:05 pm ] | ||
Post subject: | Re: Sys.Exec problems | ||
Backslashes are escape characters. If you want to use them in a directory path, you need two of them. IE:
|
Author: | andrew. [ Mon Apr 19, 2010 9:07 pm ] | ||
Post subject: | Re: RE:Sys.Exec problems | ||
Try this:
|
Author: | ProgrammingFun [ Mon Apr 19, 2010 9:12 pm ] | ||
Post subject: | Re: RE:Sys.Exec problems | ||
andrew. @ Mon Apr 19, 2010 9:07 pm wrote: Try this:
Thank you so much! +bits Two more questions...how do you change the run window title when the program has been compiled as an EXE? And...how can you change the icon of the standalone program? Thanks for the help. |
Author: | apomb [ Mon Apr 19, 2010 9:57 pm ] |
Post subject: | RE:Sys.Exec problems |
To change the icon, you'd need resource hacker |
Author: | TheGuardian001 [ Mon Apr 19, 2010 10:08 pm ] | ||
Post subject: | Re: Sys.Exec problems | ||
I believe
Will change a window's title. |
Author: | ProgrammingFun [ Tue Apr 20, 2010 5:05 pm ] |
Post subject: | Re: Sys.Exec problems |
TheGuardian001 @ Mon Apr 19, 2010 10:08 pm wrote:
For some reason, this does not have any affect on the title of the program. It still says Autorun - Run Window or something similar... |
Author: | TheGuardian001 [ Tue Apr 20, 2010 5:33 pm ] |
Post subject: | Re: Sys.Exec problems |
Odd... It works fine for me... Dunno what to tell you. |
Author: | ProgrammingFun [ Tue Apr 20, 2010 5:37 pm ] | ||
Post subject: | Re: Sys.Exec problems | ||
TheGuardian001 @ Tue Apr 20, 2010 5:33 pm wrote: Odd... It works fine for me... Dunno what to tell you.
Here is my code for reference:
Perhaps it is a problem with my code... |
Author: | TheGuardian001 [ Tue Apr 20, 2010 9:28 pm ] |
Post subject: | Re: Sys.Exec problems |
Ah, I see your problem. You have your View.Set at the very start of your program, but later on you have a Window.Open call. The first call made to Window.Open resets the default window and then gives it the parameters given to Window.Open, so all the stuff from your View.Set is overridden by your Window.Open. Either move your View.Set to after the Window.Open, or incorporate the View.Set parameters into the Window.Open call. |
Author: | ProgrammingFun [ Tue Apr 20, 2010 9:31 pm ] |
Post subject: | Re: Sys.Exec problems |
TheGuardian001 @ Tue Apr 20, 2010 9:28 pm wrote: Ah, I see your problem. You have your View.Set at the very start of your program, but later on you have a Window.Open call.
The first call made to Window.Open resets the default window and then gives it the parameters given to Window.Open, so all the stuff from your View.Set is overridden by your Window.Open. Either move your View.Set to after the Window.Open, or incorporate the View.Set parameters into the Window.Open call. Thanks for the help! Works perfectly now! |