Computer Science Canada


Author:  BryX [ Fri Sep 19, 2003 4:08 pm ]
Post subject:  Sys.Exec

can anyone explain to me how to use Sys.Exec cause i can't get it to work Confused i'm trying to load a mid file while running other code so i thought using this command would be good but it doens't want to work maybe i have to sepcify what program to play the file? i'm not sure
Sys.Exec ("stuff.mid")

p.s ne idea why my sig doesn't work?


Author:  Tony [ Fri Sep 19, 2003 4:39 pm ]
Post subject: 

first of all - .mid is a sound file, right? So you're better off playing the sound file using

Music.PlayFile ( fileName : string )

as for Sys.Exec - its a non-void function (not a procedure) so it returns an int value. The proper way of using it is:

if Sys.Exec("file.exe") then
   put "program is now running
   put "error occured"
end if

Author:  BryX [ Fri Sep 19, 2003 4:45 pm ]
Post subject: 

i got it to work tho:D plays in WMP but i want it to play in the background, is there anyway that i can tell WMP to move to the background or maybe bring my program tot he foreground? or is there a way to continue executing code while playing the midi using music.playfile??
var m1:boolean
m1:=Sys.Exec ("ff7seph.mid")

Author:  Tony [ Fri Sep 19, 2003 4:52 pm ]
Post subject: 

a number of ways around the problem...

Most prefer to use Proceses (read tutorial on that) that allow you to play the music in the background.

If you want to bring your program to front, try opening a new window after executing the file.

Author:  BryX [ Fri Sep 19, 2003 6:49 pm ]
Post subject: 

whoa thx alot man, I never knew about procedures and process before, been wondering if there was a way to run multiple code at the same time and now I can Very Happy

Author:  Andy [ Sat Sep 20, 2003 10:15 pm ]
Post subject: 

but forks arent that good, they slow down ur program alot, i'd make something a porcedure and run it in the loop than forking something.

Author:  Tony [ Sat Sep 20, 2003 10:39 pm ]
Post subject: 

dodge said something useful?! No way Surprised

he probly just copied that out of one of my posts anyways Laughing

But yeah, the way processes are structured, you would increase performance if you avoid them.