• 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
Re: newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie question


  • Subject: Re: newbie question
  • From: Jonathan Brassow <email@hidden>
  • Date: Fri, 28 Feb 2003 15:52:27 -0600

Thanks, this seems to solve the problem.


set bah to "Finder"
-- specifying app name through a var
using terms form application "Finder"
tell application bah
set pos to the position of the first window
end tell
end using terms from
display dialog (("(" & first item of pos as string) & ", " & last item
of pos as string) & ")"


This is pretty pointless with the Finder, since everyone has the Finder, and
that's what it's always called, and it's always running. For similar scripts
with other application 'using terms from' will compile on your machine and
run on any machine running OS 9 or later. It's actually better to get the
entire file path to the app in case it's got a different name in the user's
version. For that, you ought to know the 4-character creator type, which you
can discover by getting 'creator type' of its file on your machine in a
Finder tell block, or 'file creator' of 'info for' the same application
file. The creator type never changes from version to version.

So

set creaType to "abCD" -- or whatever it is

tell app "Finder"
set appFilePath to application file id creaType as string
-- or as Unicode text in OS X, better
end tell

using terms from application "Whatever It Is on Your machine"
tell app appFilePath
-- your script
end tell
end using terms from



If the script might be run on OS 8.6 or earlier, you need a slightly more
cumbersome method that uses <<raw codes>> rather than 'using terms from'.
Get Smile editor, and search for 'portability' in its Help. It explains how
to do it. (Or if you have Script Debugger, witch the popup in the app's
dictionary to "AppleEvents" to get the same raw codes.) Raw codes will
compile OK even in a tell variable block.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: newbie question (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: newbie question
  • Next by Date: Re: Script for Eudora
  • Previous by thread: Re: newbie question
  • Next by thread: Re: newbie question
  • Index(es):
    • Date
    • Thread