Navigation:  Reference > Commands >

Execute Program

Print this Topic Previous pageReturn to chapter overviewNext page

 

You would use this command to execute a Windows .EXE program from within your TAS Professional program. This command is like a shell command and can use windows program associations.

 

EXEC f/c/eRequired - This is the name of the program to be run.  This must include any path if applicable.

 

WITH f/c/eThe program will pass this value as the 'tail' of the command line.  For example:

 

       

WAITThis option will stop running and wait however it will not shutoff visual events on your screen if you want to use this you will need to use the check_wait() function.        

EXAMPLES

 

//EXAMPLE 1 This is the command using the with option

 

BUTTON.CLICK:

EXEC 'WORDPAD' WITH 'TEST.SRC'

ret // would be the equivalent of executing the program WORDPAD.EXE and passing a single parameter of TEST.SRC.

// End EXAMPLE1

 

// EXAMPLE2 \ for wait and wait_check()

// If the user was to click the exit button before you were done and you do not protect your programming

// like this you will get an error because the program would be gone.

 

BUTTON1.CLICK:

EXEC 'WORDPAD' with 'TEST.SRC' WAIT

ret

 

BUTTONEXIT.CLICK:

  if wait_check() > 0

     msg 'you have not finished your editing yet you can not exit from this program.'

   ret .f.

endif

  quit

ret .t.

// END EXAMPLE2

 

//EXAMPLE3 use the mail to program assocuation in windows.

// lets say you want to put a button on your program to email someone.

BUTTON.CLICK

exec 'mailto:support@cassoftware.com' 

ret

//END EXAMPLE3

 

//EXAMPLE4 maybe you want to have a button call up your website.  

BUTTON.CLICK

exec 'http://cassoftware.com' 

ret

//END EXAMPLE4

 

//EXAMPLE5 maybe you want to have button execute a program with file windows file association. This example

// would open the zip file in windows.  

BUTTON.CLICK

exec 'myzipfile.zip' 

ret

//END EXAMPLE5

 

//Here is how you can get it to wait

testexec.Click:
exec '.\sample\testbatch.bat' wait
if wait_check() <> 0
     goto testexec.click // Program will loop until batch file is done.
endif
msg 'done'
Ret

       

 

COMMENT

Control returns to the TAS Professional program immediately.  It does not wait for the other Windows program to finish executing unless you use the wait option in the command. 

 

NOTE:  You can pass a P type pointer (or any other numeric value) to the program you're running.  It is automatically converted to an alpha string before it is passed.

 

NOTE:  You can only execute another Windows program with this command.  It will not execute a DOS program or command. However you can execute DOS programs from a PIF file.

 

NOTE: one other feature of the EXEC command is that it will use windows file association.

 

 

SEE ALSO

EXEC()  wait_check()

 


Page url: http://www.cassoftware.com/tas/manual/executeprogram.htm