• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Challenge: 'tell' different versions of an app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Challenge: 'tell' different versions of an app


  • Subject: Challenge: 'tell' different versions of an app
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 12 Jul 2011 19:11:31 -0700

This post regards one of the frequent battles I've had with AppleScript, Launch Services et al in trying to control which version or installation of an "application" gets invoked by a script.

This works as expected:

tell application "/path/to/SomeApp"
   -- statements which use SomeApp terminology
   --
   --
end tell

But if you try to make SomeApp's path a variable:

set foo to "/path/to/SomeApp"
tell application foo
   -- statements which use SomeApp terminology
   --
   --
end tell

it won't compile because the 'tell' block doesn't have SomeApp's terminology.

I want AppleScript to do automated regression testing on an app.  That is, I have:

   /path/to/old/version/SomeApp.app
   /path/to/new/version/SomeApp.app

The brute-force method is to repeat all the code twice, in two 'tell' blocks.  That should work, but it's terrible to develop and maintain.

Putting the code in a handler doesn't work:

tell application "/path/to/old/version/SomeApp"
   doTest(parm1, parm2)
end tell
tell application "/path/to/new/version/SomeApp"
   doTest(parm1, parm2)
end tell

on doTest(parm1, parm2)
   -- statements which use SomeApp terminology
   -- This won't compile
   --
end doTest

This doesn't work either:

tell application "SomeApp"
	quit
	launch application oldAppPath
	-- test old version
	quit application oldAppPath
	delay 5
	launch application newAppPath
	-- test new version
	quit application newAppPath
end tell

It only runs a different "Release" version of the app.  A slight variation on that resulted in all 3 versions running.

The only solution I've been able to devise, and although it's *real* brute force, it's not bad, is

• Run the test on the path to the old version.
• Quit the app.
• Swap out the 'Contents' directory inside the app package with the new version.
• Run the test again; this time it will be on the new version.

Seems to work.

Does anyone know a better way to do this?

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Challenge: 'tell' different versions of an app
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Google Chrome: Set variable to result of JavaScript
  • Next by Date: Re: Challenge: 'tell' different versions of an app
  • Previous by thread: Re: iPhoto trash
  • Next by thread: Re: Challenge: 'tell' different versions of an app
  • Index(es):
    • Date
    • Thread