Your full service technology partner! 
-Collapse +Expand
Search Paradox Group:

-Collapse +Expand Paradox To/From
-Collapse +Expand Paradox Store

Prestwood eMagazine

May Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Langua...   Print This     
  From the July 2013 Issue of Prestwood eMag
Paradox OPAL: Language Details:
Using Execute in Paradox's ObjectPAL
Posted 13 years ago on 2/18/2006 and updated 2/18/2006
Take Away: Using execute() in ObjectPAL.


The following demonstrates how to launch an application using the execute() command. It also demonstrates a technique for checking if the application is already running before launching it. This is particularly handy when working with DDE and OLE.

Using execute()

To launch an application in Paradox is easy. For example, the following code from the pushButton event of a button launches Notepad.

method pushButton(var eventInfo Event)
  execute("NOTEPAD.EXE", No, ExeShowNormal)
Checking if the application is already open first

To check if an application is running, you can use the enumWinowNames method to list all the running applications within a table. Then use a scan loop with locatePattern to check if the application is running. To make sure the temporary table is not in conflict with other users in a multi-user situation, create the table in each users private folder.

For example:

Clean Up

To automate the cleanup of the temporary table in your private folder, name the table starting with two underscores. Paradox automatically deletes all files in your private folder that start with two underscores whenever Paradox exits.

For example:

Complete Example

The following code from the pushButton event of a button checks if Microsoft Word is already running and if it is NOT, then launches it. If Word is running, Word is not launched.

method pushButton(var eventInfo Event)
  sTable 		String
  tcApps		TCursor
  lWordOpen	Logical


  sTable = ":priv:__apps.db"

  lWordOpen = False
  scan tcApps 
   for tcApps.locatePattern("WindowName", 
    "..Microsoft Word.."):
    lWordOpen = True

  if not lWordOpen then
  execute("D:\\Program Files\\Microsoft Office" +
   + "\\Office\\WINWORD.EXE", 
      No, ExeShowNormal)

Finding WindowNames

You can use a technique similar to the above code to find the window name to search for during your scan loop. For example, the following code from the pushButton event of a button displays a table of all Windows. Just make sure the application you want to search for is running prior to executing this code.

method pushButton(var eventInfo Event)
 sTable String
 tvApps TableView ; Used to find app names.

  sTable = ":priv:__apps.db"
  enumWindowNames(sTable) ; Used to find app names.

Linked Message Board Threads

 launching audio files from opal in ObjectPAL MB Topic (13 replies)


Share a thought or comment...
Comment 1 of 1

Checking to see if the application is open first works great but not if Lync is open.  Running with Office 2013, Paradox will hang up waiting for a response from Lync when looking to see if Outlook is open.  Close Lync and the code proceeds normally.  I had to give up on checking to see if Outlook was open and just start using "/recycle" on the execute command line so it won't open additional sessions if one if already running.


Posted 5 years ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1272A1
Enter key:
KB Post Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100310 Counter
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2019 Prestwood IT Solutions.   [Security & Privacy]