Posted: Mon Sep 27, 2004 1:12 am Post subject: re:turing command
hey guys is there a command in turing which can execute other .exe files
i've made a splashscreen in turing and now when the user clicks on a button, i want turing to start up this other .exe prgm which i have made in C...is this possible at all?
Sponsor Sponsor
Mazer
Posted: Mon Sep 27, 2004 7:26 am Post subject: (No subject)
Yes, you'll want to look up Sys.Exec.
Delos
Posted: Mon Sep 27, 2004 10:00 am Post subject: (No subject)
boredstudent3...this is the Tutorials section. I.e., this is the place where you post Tutorials...
PM a mod and politely ask them to move this thread to the Turing Help Section.
Mazer
Posted: Mon Sep 27, 2004 10:26 am Post subject: (No subject)
No worries, I didn't even notice that. If I did I would've moved it earlier.
Jonny Tight Lips
Posted: Mon Sep 27, 2004 4:48 pm Post subject: (No subject)
Coutsos wrote:
No worries, I didn't even notice that. If I did I would've moved it earlier.
Coutsos your not a mod... are you?... so how can you move things?
Cervantes
Posted: Mon Sep 27, 2004 5:09 pm Post subject: (No subject)
Coutsos = Mazer. Mazer = mod.
Coutsos / Mazer is included in The Staff Site.
evil name changing
EDIT: let's try to keep the spam down. -4 BITS: Jonnny Tight Lips
Jonny Tight Lips
Posted: Mon Sep 27, 2004 5:15 pm Post subject: (No subject)
The why ins't Coutsos set as a mod aswell since he is one anyways? I would think that would be logical? UNless he uses both account which would be unlogical.
Paul
Posted: Mon Sep 27, 2004 5:24 pm Post subject: (No subject)
sigh... cutsos is mazer, mazer has mod powers (if you'll be more observant when he logs in, you'll see it on the bottom of the index page), but he doesn't have an official rank. ... and its illogical
Sponsor Sponsor
boredstudent3
Posted: Mon Sep 27, 2004 11:10 pm Post subject: (No subject)
i typed in sys.exec into turing but if gave me no syntax outline when i pushed F8 or F9 or clicked on those buttons in the help menu,,
could u please aid me in my search a little more please.
thanks for your time,,appreciate it
-bored
Genesis
Posted: Mon Sep 27, 2004 11:23 pm Post subject: (No subject)
What version are you using? I have 4.0.4c and it works fine.
More importantly, (because I believe this command works with all versions of Turing) make sure your typing the proper syntax, with capitals and all, so it should be "Sys.Exec", not "sys.exec".
This is what you should find in the help file:
Sys.Exec Part of Sys module
Syntax: Sys.Exec ( command : string ) : boolean
Description: The Sys.Exec function is used to execute an application or more often, open a data file with its associated application. Sys.Exec can be used to launch such programs as the Internet Browser by specifying a URL. Sys.Exec launches the application associated with file's suffix. (In essence, it performs the same operation as if a user double clicked on the file.)
Example: This program launches an internet browser and points it to Holt Software's home page. It then launches a movie using the default video player.
if not Sys.Exec ("http://www.holtsoft.com/turing/support") then
put "The Sys.Exec call failed"
put "Error: ", Error.LastMsg
end if
if not Sys.Exec ("skate.avi") then
put "The Sys.Exec call failed"
put "Error: ", Error.LastMsg
end if
Details: When the Sys.Exec procedure is used, the executing program continues execution immediately while the launched application is running.
Status: Exported qualified.
This means that you can only call the function by calling Sys.Exec, not by calling Exec.
Mazer
Posted: Tue Sep 28, 2004 7:50 am Post subject: (No subject)
Yes, it was the capitalization of letters that got you. Also, if you aren't going to take the time to read through what Genesis has posted, remember that Sys.Exec is a function and that in turing you will have to do something with it's result. Most commonly, use it in an empty if statement like:
code:
if Sys.Exec() then
% don't put anything here
end if
wtd
Posted: Tue Sep 28, 2004 2:45 pm Post subject: (No subject)
Functions have return values for a reason. Don't ignore them.
Mazer
Posted: Tue Sep 28, 2004 2:59 pm Post subject: (No subject)
That's true, it's just that whenever I was using Sys.Exec back in the day, it was in a situation where it wouldn't help me any to have the user know why a certain part of my program didn't work. Especially when I didn't the user knowing about a certain part of said program. If you catch my meaning.
boredstudent3
Posted: Tue Sep 28, 2004 11:22 pm Post subject: (No subject)
alright thanks alot folks!...yeah it was indeed the capital letters that messed me up...but just for some clarification,, say if the .exe file that C generated was named Lab4.exe , would i just simply type this into turing?
Sys.Exec (lab4.exe)
i'm asking b/c in the example that genesis gave (thanks for taking the time to help me out,,appreciate it) he just put the website inside the brackets,,is that how i should enter prgm line in turing as well?...
thanks
bored-
Genesis
Posted: Wed Sep 29, 2004 12:39 am Post subject: (No subject)
Sys.Exec is a function, so you can't just stick it in the program on it's own. Like Coustos said, you have to do something with it's result. And like wtd said, functions have results for a reason. And like Coustos said again, it may not be necessary to use.
But why not use it.
To clarify that:
code:
if not Sys.Exec ("firefox.exe") then
put "There was a problem running this program."
put "Error: ", Error.LastMsg
end if
Will launch the Firefox browser. And if it doesn't work, say I didn't have Firefox installed, then it would return the error message: "There was a problem running this program, Error: File 'firefox.exe' not found."
Coustos was saying that having that code was pointless, 'cause it wouldn't matter to the user to know that it didn't work.
In which case:
code:
if Sys.Exec ("firefox.exe") then
end if
Would work just the same, with no error message in the event that the .exe could not be run.
Mod notice by Coutsos:
RAAAAAARRRRRGGHHHH! IT IS SPELLED COUTSOS! YOU PRONOUNCE IT KOO-TSOES!! GYYYARRRRRRR!!!!
Sorry to explode at you, it's just that it gets a bit annoying after a while. Now you know what to do if ever we meet in real life.