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

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

October 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 18 years ago on 2/18/2006 and updated 2/18/2006
Take Away: Using execute() in ObjectPAL.

KB100310

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)
endMethod
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:

enumWindowNames(":priv:mytemptable.db")
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:

enumWindowNames(":priv:__mytemptable.db")
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)
var  
  sTable 		String
  tcApps		TCursor
  lWordOpen	Logical
endVar

  errorTrapOnWarnings(True)

  sTable = ":priv:__apps.db"
  enumWindowNames(sTable)
  tcApps.open(sTable)

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

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

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)
var 
 sTable String
 tvApps TableView ; Used to find app names.
endVar

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

Linked Message Board Threads

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

Comments

1 Comments.
Share a thought or comment...
First Comment
Comment 1 of 9

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.

Gene

Posted 10 years ago

Comment 2 of 9

I all around agree and influencing forward for more data and this subject has colossally satisfied me. Jaipur Escorts Service  Appreciative to you for making an article that has overwhelming substance and is completely circumnavigated and even I am restored by your kept style other than.

Posted 5 years ago

Comment 3 of 9

I am very admirer of your made work and the inspiration driving square concerning your offer flabbergasting to any character in your piece, at any rate, Call Girls in Jaipur  I discovered some minor syntactic fight in your affected work with the target that you to can resolve from coursework writing in clearly versatile time.

Posted 5 years ago

Comment 4 of 9

I am unendingly looking web for articles that can interface with me and this is one of them. This is spreading in that most remote raise controlled blog. The entire article is astoundingly confounding and intentionally made.

Jaipur Escorts Service

 Jaipur Call Girls

Posted 58 months ago

Comment 5 of 9

I am genuinely getting a charge out of looking brilliantly made articles. Presumably, you spend a ton of exertion and time on your blog. I have bookmarked it and I am anticipating inquiring about new articles. Keep doing stunning. 

 Jaipur Call Girls
 Call Girls in Jaipur
Jaipur Escorts 

Posted 58 months ago

Comment 6 of 9

I beginning late ran before long your blog and have been investigating along. I figured I would leave my first remark. I don‘t have the foggiest idea what to state with the exception of that I have gotten a kick out of the experience of looking. Magnificent to explore the blog. I will continue visiting this blog reliably. 

 Call Girls in Jaipur 
 Jaipur Escorts 
 Escorts in Jaipur 

Posted 58 months ago

Comment 7 of 9

A duty of thankfulness is all together for spinning around these subtleties. I in a general sense wish to uncover to you that I on a fundamental level examine your site and moreover I find it truly hypnotizing and essential.

Jaipur Escorts 
 Escorts in Jaipur 
Jaipur Escorts Service 

Posted 58 months ago

Comment 8 of 9

Your substance is really mind-blowing and drawing in information here, so thank you for sharing this amazing data for everybody. 

Escorts in Jaipur
Jaipur Escorts Service
 Jaipur Call Girls

Posted 58 months ago

Latest Comment
Comment 9 of 9

Thank you so much for sharing this amazing information, please keep sharing…

the impossible quiz

Posted 58 months 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 = P1116A1
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 play-drums.com 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
12214
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


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