
-----------------------------------
boredstudent3
Mon Sep 27, 2004 1:12 am

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?

-----------------------------------
Mazer
Mon Sep 27, 2004 7:26 am


-----------------------------------
Yes, you'll want to look up Sys.Exec.

-----------------------------------
Delos
Mon Sep 27, 2004 10:00 am


-----------------------------------
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.

 :roll:

-----------------------------------
Mazer
Mon Sep 27, 2004 10:26 am


-----------------------------------
No worries, I didn't even notice that. If I did I would've moved it earlier.

-----------------------------------
Jonny Tight Lips
Mon Sep 27, 2004 4:48 pm


-----------------------------------
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
Mon Sep 27, 2004 5:09 pm


-----------------------------------
Coutsos = Mazer.  Mazer = mod.
Coutsos / Mazer is included in -4 BITS: Jonnny Tight Lips

-----------------------------------
Jonny Tight Lips
Mon Sep 27, 2004 5:15 pm


-----------------------------------
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
Mon Sep 27, 2004 5:24 pm


-----------------------------------
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 ;)

-----------------------------------
boredstudent3
Mon Sep 27, 2004 11:10 pm


-----------------------------------
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
Mon Sep 27, 2004 11:23 pm


-----------------------------------
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
Tue Sep 28, 2004 7:50 am


-----------------------------------
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:

if Sys.Exec() then
    % don't put anything here
end if


-----------------------------------
wtd
Tue Sep 28, 2004 2:45 pm


-----------------------------------
Functions have return values for a reason.  Don't ignore them.  :)

-----------------------------------
Mazer
Tue Sep 28, 2004 2:59 pm


-----------------------------------
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
Tue Sep 28, 2004 11:22 pm


-----------------------------------
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
Wed Sep 29, 2004 12:39 am


-----------------------------------
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:

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: 

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.

-----------------------------------
Tony
Wed Sep 29, 2004 12:57 am


-----------------------------------
well in larger projects it might be a good idea to have a debug going. Or say have two users levels - each having a specified level of feedback.


if not Sys.Exec ("firefox.exe") then
    debug.add("Error: " + Error.LastMsg)

     if debug.isOn or userLevel = "advanced" then
          puts debug.last
     end if

end if


ofcourse the debug class is made up. Which btw is an interesting project for anyone bored.

-----------------------------------
boredstudent3
Wed Sep 29, 2004 9:52 am


-----------------------------------
so do i have to put the .exe file into the turing folder or will the command Sys.Exec find the file on the pc by itself?...i ask b/c i have my hdd partitioned into 2 seperate drives ,, but seeing that the example u people have provided for me which is great u just simply put Sys.Exec("firefox.exe") in b/w the if statements and is doesn't specify a location for the file so i'm just curious on this query.

Thanks for your time

boredstudent-

-----------------------------------
Tony
Wed Sep 29, 2004 11:09 am


-----------------------------------
if path is not specified, it will look in the execution folder. Otherwise its something like

if not Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe")
...


notice the use of \\

-----------------------------------
wtd
Wed Sep 29, 2004 11:09 am


-----------------------------------
Though I don't actually know Turing, so it may do some kung fu I'm not aware of, the general rule is that an executable must either be in the same directory, or in a directory contained within the PATH environment variable.

-----------------------------------
Mazer
Wed Sep 29, 2004 12:53 pm


-----------------------------------
You can give it a full path to the file, but you do not need double-back slashes. I could kill myself, and have it printed on my tombstone and nobody would remember this, but here it is: you  CAN use single forward slashes! (If you want backslashes, they'll have to be double)

-----------------------------------
Genesis
Wed Sep 29, 2004 2:01 pm


-----------------------------------
Actually if I run that code without specifying a directory, it still runs firefox. (Even though 'firefox.exe' is not in the main directory.) Though it makes more sense to have the path in there.

And,

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.

I apologize. lol. I never noticed the spelling.

-----------------------------------
Mazer
Wed Sep 29, 2004 2:37 pm


-----------------------------------
Don't worry about it, no harm done (unless I knew where you lived...)  :wink:

-----------------------------------
boredstudent3
Wed Sep 29, 2004 9:35 pm


-----------------------------------
hmmm...turing if making prgm'ing hard b/c when i follow the format that u peeps give me it always gives me an error and directs me to the "if' line and says that the 'if' must be boolean type,,what does that mean?...am i missing sth in the if line:

if not Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe")

i've tried the same format of this line but replaced whatever was in the quotes w/ lab4.exe and after i hit F1 is says that if must be boolean...damnit,,

boredstudent-

-----------------------------------
Andy
Thu Sep 30, 2004 1:05 pm


-----------------------------------
Sys.Exec returns a value, so all u need to do is basicly set a variable to that ie var run:=Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe")

-----------------------------------
wtd
Thu Sep 30, 2004 1:42 pm


-----------------------------------
hmmm...turing if making prgm'ing hard b/c when i follow the format that u peeps give me it always gives me an error and directs me to the "if' line and says that the 'if' must be boolean type,,what does that mean?...am i missing sth in the if line:

if not Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe")

i've tried the same format of this line but replaced whatever was in the quotes w/ lab4.exe and after i hit F1 is says that if must be boolean...damnit,,

boredstudent-

Unless I'm mistaken (and that's entirely possible) such functions almost always return an integer value.  

This is because a boolean value can only indicate failure or success, but there are many ways a program can fail.  Zero is typically reserved for success, and anything else is a code indicating which way the program failed.

Try something like:

if not Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe") = 0 then ... end if

-----------------------------------
wtd
Thu Sep 30, 2004 1:43 pm


-----------------------------------
Sys.Exec returns a value, so all u need to do is basicly set a variable to that ie var run:=Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe")

Descriptive variable names are a good thing.

var firefoxResult := Sys.Exec("C:\\Program Files\\Mozilla Firefox\\firefox.exe")

-----------------------------------
timmytheturtle
Sun Oct 03, 2004 7:53 pm


-----------------------------------
try this one,  your going to need a ie shortcut where u save this file before running.


loop
exit when Sys.Exec("iexplore.exe")=false
end loop


-----------------------------------
Paul
Sun Oct 03, 2004 8:48 pm


-----------------------------------
wouldn't that just open alot of windows...?

-----------------------------------
boredstudent3
Sun Oct 03, 2004 9:55 pm


-----------------------------------
lol...what a prgm made by turtle,,

if i made that into a turing stand alone prgm (.exe) and sent it to someone,,and once they open it up will it open like many IE windows on their pc until it crashed?...hah,,=)

and since turtle said that i needed an IE shortcut wherever i saved the turing file will the IE shortcut on the other person's pc need to be in a certain place or just on their desktop?...

boredstudent-

-----------------------------------
timmytheturtle
Sun Oct 03, 2004 10:13 pm


-----------------------------------
wouldn't that just open alot of windows...?
yes it does.

lol...what a prgm made by turtle,,

if i made that into a turing stand alone prgm (.exe) and sent it to someone,,and once they open it up will it open like many IE windows on their pc until it crashed?...hah,,=)

and since turtle said that i needed an IE shortcut wherever i saved the turing file will the IE shortcut on the other person's pc need to be in a certain place or just on their desktop?...

boredstudent-
Im not sure if the icon has to be were the files saved, try to use a link right to the file (C:\program files\......). but if I make a .exe file and prevent the user from terminating it, they would either have to restart and close the process throug the Task Manager.

I have another program that writes VERY LARGE blank arrays to junk binary files that take up alot of room. 3 people in my comp sci class ran it for 5 minutes and took up 4gb of the schools network harddrive space. What funny that was.

-----------------------------------
DaVe g
Mon Oct 04, 2004 6:09 am


-----------------------------------
It's all here

http://www.compsci.ca/v2/viewtopic.php?t=4077

-----------------------------------
boredstudent3
Thu Oct 07, 2004 12:48 pm


-----------------------------------
well that post leads me to a code which allows me to shuitdwon and restart the pc, etc...but all i wanted to know how to do was eesentially have the user click on a button in turing and then it would open up an .exe file/prgm which i made in C,,this is b/c in my prgm'ing course i will be completing 2 assignments and thus i just want the GUi which i have created in turing to "host" these two C prgms,,

nuff said...=)

boredstudent-

-----------------------------------
boredstudent3
Thu Oct 07, 2004 12:53 pm


-----------------------------------
hey turtle how do i make turing .exe's so that the user can't terminate it?...

is it sth i 'check off' in the menu to create a stand alone program?

-bored

-----------------------------------
Genesis
Thu Oct 07, 2004 5:04 pm


-----------------------------------
hey turtle how do i make turing .exe's so that the user can't terminate it?...

is it sth i 'check off' in the menu to create a stand alone program?

-bored

When you compile it, there's a box that says "Allow user to terminate program." uncheck it. (Or maybe it's a box that you have to check...but that'll make it so they can't close it.)

-----------------------------------
timmytheturtle
Thu Oct 07, 2004 10:47 pm


-----------------------------------
When compling it click the "Prevet User from Terminating Program" box and that will make it so the user must restart or use the task manager to end the process

-----------------------------------
boredstudent3
Sun Oct 10, 2004 1:33 am


-----------------------------------
ok peeps,,i've gotten the time to try sth in turing but it doesn't werk,,and what i mean by 'it doesn't werk' is that the .exe file won't start up when i run this code and click inside the button:

setscreen ("graphics:640;480,nocursor")
var x, y, bnum, bud : int

drawbox (250,250,450, 450, black)

buttonwait ("up", x, y, bnum, bud)

if x >= 250 and x = 250 and y = 250 and x = 250 and y  is this the command i should be trying?

so i type in this but it doesn't werk:

var picID: int 
   
picID := Pic.NewFile ("girlfriend.BMP") 
Pic.Draw (picID, x, y, pm,Copy)

but yet i get some error when i run the program,,referring to the pm and copy part of the command Pic.Draw

thanks for your time!

boredstudent-

-----------------------------------
Cervantes
Sun Oct 24, 2004 7:08 am


-----------------------------------
There are a few problems here.  First, it's Pic.FileNew not Pic.NewFile.  Second, your Pio.Draw line has too many parameters.  Take out pm.  Finally, it's not "Copy", it's "picCopy"

hope that helps,

-----------------------------------
boredstudent3
Sun Oct 24, 2004 4:18 pm


-----------------------------------
cervantes: damn your good at turing commands and debugging!...

hehe,,now it does werk for me,,thanks pal!!!...=)

-----------------------------------
boredstudent3
Mon Oct 25, 2004 12:24 am


-----------------------------------
since turing won't play mp3 files,,any one know of a nice mp3 to wav converter?

The fileNameparameter must give the format of the file: 
            WAV files    "WAV:filename" or "filename.WAV" 
            SND files    "SND:filename" or "filename.SND" 
            MOD files    "MOD:filename" or "filename.MOD"

-----------------------------------
Mazer
Mon Oct 25, 2004 7:24 am


-----------------------------------
Turing won't play mp3s?! What version do you have?
As for your question, there are many such convertors available. I'd suggest looking through sourceforge for something nice (and free), and if you can't find anything you like there, try and find one that doesn't suck from download.com. Worst case scenario you could go with a trial version of musicmatch jukebox.

-----------------------------------
the_short1
Mon Oct 25, 2004 10:06 am


-----------------------------------
coutsos.. then why did u change yur name to such a anoying .. ahrd to spell name... go with emazer..  .. jeeze..!!! < refereing to post on first page where u exploded cuz of coustsos or something like that..


turing palys mp3s!!@!!!1




Music.PlayFile ("song.mp3") < pauses the prorgram to play the sound
or
if u have newest turing..
Music.PlayFileReturn ("song.mp3") < doesn;t stop the rest of the program to play the sound

make shure ur path are correct.. if not u wont get an error.. but u wont hear anything,..

and to chagne between mp3 and wav...  get AUDACITY from source forge...  just point it to the lame_enc.dll from winamp plugin folder'!!!!!


go winamp!!!!!! (except winamp 5.5  cuz its fucked rite now fo me.... i use 5.0..) 