1

I would like to create a Sikuli script to determine if an application or software is installed in Mac, Linux, and Windows. How can I do this? If Sikuli is not convenient, please suggest the best possible way to do this.

Nathaniel Waisbrot
  • 23,261
  • 7
  • 71
  • 99
user1617707
  • 61
  • 1
  • 12

4 Answers4

0

No through Sikuli, but there are ways of searching for executables using jython. The link below will get you started.

Test if executable exists in Python?

Community
  • 1
  • 1
spearson
  • 1,016
  • 8
  • 18
0

Sikuli is not convenient, but if you have to use it, you can do it this way:

Windows

  • Open the Control Panel and go to Add/Remove applications
  • Scroll al the list and try to find() the icon of the application you're looking for

OSX

  • Open the Finder and go to the Applications folder
  • Scroll all the window and try to find() the icon of the application you're looking for

If finding the icon fails, try again finding by text find("My Application Name") as the vision engine is not 100% accurate, so it may fail even if the icon is displayed.

Alessandro Da Rugna
  • 4,571
  • 20
  • 40
  • 64
  • Note that another alternative if finding the icon fails is to set the match percentage to somewhere in the 90-95% range. By default Sikuli uses a 70% match. The tolerance can be changed by using the following `find(Pattern("image.png").similar(.95))`. Even at high match percentage, the vision engine can be unreliable, but its worth a try. – john.stewart Sep 14 '12 at 08:40
0

Spearson's answer is good if you're looking for command-line programs. If you mean installed programs that aren't necessarily available from the command-line, I've used Sikuli to do this before.

Windows: Click the Start Menu, type the application name, look for it to appear in the results

Mac OS: Type command-space or click the Spotlight menu, search for the application name there

Linux: Hardest, because there's no one desktop. Most of them have something that works like the Windows Start Menu, though.

I like the solution because it's mostly the same between operating systems, but it's also fairly brittle. Some failure cases are

  • Windows is themed differently or the taskbar is in an unexpected location
  • The program didn't install a Start Menu shortcut
  • Spotlight hasn't indexed the application yet (because it was just installed)
  • There's another version or program installed with the same name
Nathaniel Waisbrot
  • 23,261
  • 7
  • 71
  • 99
0

What I do to check if Notepad is installed is:

zen = App.open('Notepad')
if (zen != 'None'):
    print('Program is installed!')
    wait(2)
    # Close Notepad again. 
    App.close('Notepad')
else:
    print('Program is not installed!')

Or if you know the path where the file is installed:

import os
pathA = os.path.exists(r'C:\Program Files (x86)\Mozilla Firefox\firefox.exe')
print(pathA)
Tenzin
  • 2,415
  • 2
  • 23
  • 36