Checking for an application?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
peter.s
Posts: 99
Joined: Thu Jul 10, 2008 11:47 am

Checking for an application?

Post by peter.s » Sun Nov 28, 2010 7:23 am

Hi there,

I am trying to write a code for my project which, when the user (of the final standalone) activates a button, will initiate a check of the computer's system to see if a particular application is installed. If it can't find the application, it will return a message saying so.

I remember reading somewhere in the Rev resource material a way of doing this, but I've just spent about an hour looking for it and simply can't find it any longer.

Can someone please give me a suggestion of how to do this or where to find the information?

Cheers,

Peter

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Checking for an application?

Post by WaltBrown » Sun Nov 28, 2010 12:10 pm

For Windows, I found a VBScript that looks at the Registry for Uninstall keys, and returns a list: http://billsway.com/vbspage/

Also for Windows, psinfo -s works well. Look for it at www.sysinternals.com.

Walt
Walt Brown
Omnis traductor traditor

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Checking for an application?

Post by Mark » Sun Nov 28, 2010 5:08 pm

Hi Peter,

This should do what you want:

Code: Select all

function programs
     if the platform is "MacOS" then -- only OSX!
          put shell("ps -xcw") into myList
          put offset("COMMAND",myList) into myColPos
          repeat for each line myLine in myList
               put char myColPos to -1 of myLine & cr after myNewList
          end repeat
          filter myNewList without "(*"
          return line 2 to -1 of myNewList
     else if the platform is "Win32" then
          put line 4 to -1 of shell("tasklist") into myList
          repeat for each line myLine in myList
               put word 1 of myLine & cr after myNewList
          end repeat
          return line 1 to -2 of myNewList
     else
          return empty
     end if
end programs
It should be easy to adjust this for Linux, if needed.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

peter.s
Posts: 99
Joined: Thu Jul 10, 2008 11:47 am

Re: Checking for an application?

Post by peter.s » Mon Nov 29, 2010 1:11 pm

Since posting my original message I have discovered another way of doing what I want (see below). But I'm a little confused about something.

I want the end user to click a button which will check if QuickTime is installed on the computer. If it isn't installed then a dialogue box will appear with a message instructing the user to install QuickTime.

I'm thinking of using this:

Code: Select all

on mouseUp
   if the QTVersion = 0.0 then show field "DialogueBox"
   else go to card 2
end mouseUp
But then I read this in the Rev dictionary:
Tip: It can take Revolution a second or two to load the code needed to use QuickTime, depending on the machine speed. Since this code is only loaded into memory once per session, you can speed up the first occurrence of a QuickTime-related action by calling the QTVersionfunction during otherwise dead time--for example, during startup of your application--to preload the code.
What does "calling the QTVersionfunction" mean in real terms?

Thanks Mark for your response. I tried the code with some success, but thought the above code is simpler - provided it works cross platform.

Cheers,

Peter

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Checking for an application?

Post by Mark » Mon Nov 29, 2010 1:27 pm

Hi Peter,

Calling a function is synonymous to "using" or "executing" that function. Your script is calling and loads QT if it is available. It is often the best solution to do this while your splash screen is showing.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Checking for an application?

Post by WaltBrown » Mon Nov 29, 2010 4:22 pm

I was limiting myself to the original inquiry: "see if a particular application is installed", "Application" and "Installed" being the operative words, not exactly the same as "see if a particular process is running".
Best, Walt
Walt Brown
Omnis traductor traditor

peter.s
Posts: 99
Joined: Thu Jul 10, 2008 11:47 am

Re: Checking for an application?

Post by peter.s » Tue Nov 30, 2010 8:28 am

Walt - I can see how my original inquiry was misleading, thanks for the feedback it helps me understand why sometimes when I ask a question on this forum I get mixed responses.

Kind regards,

Peter

Post Reply