• 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: Finding and deleting specific extensions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding and deleting specific extensions


  • Subject: Re: Finding and deleting specific extensions
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 18 Sep 2003 22:08:47 -0700

On Sep 18, 2003, at 1:21 PM, Henry L Miller Jr wrote:

What has stumped me to date, is how to have some statements that access some properties of the file class that ARE defined in OS X 10.2.6 Finder, but ARE NOT defined in Finder 9.1 remain accessible when compiled on an OS X machine, and be ignored at compilation time by an OS 9 machine.

In the tell block below, the properties "name extension", "extension hidden", and "displayed name" work well in OS X, but these properties are not defined in OS 9. So, even though I don't try to execute the commands accessing these properties unless I'm in OS X 10.2.x, I can't run the script on an OS 9 machine.

tell application "Finder"
-- get the path to source file
set srcPath to ((container of file srcFile) as string)

set versNum to (get the version) as number
-- get the displayed name, name
extension, and extension display condition in OS X
(*
need to find a way to "block"
these from compile process - OS 9 Finder complains
*)
if (versNum  10.2) then
set nameExt to name extension of file srcFile
set hiddenExt to extension hidden of file srcFile
set dispName to displayed name of file srcFile
end if -- {versNum}
end tell -- {Finder}


The purpose of this exercise is to have one script that will operate on either platform (OS X
or OS 9) without having to edit the code and comment in/out a block of text.

Any ideas?

If you save the script as a compiled script (as opposed to plain text), then you should be able to either avoid the troublesome statements using an "if", or put them in a "try" block and handle the failure in Mac OS 9. If your "if" isn't working, then there is apparently something wrong with your test.

If you save the script as plain text (and therefore compile it each time you run it), then you'll need to do something trickier, like using raw property codes. However, there are very few advantages to doing this, so one wonders why you don't use a compiled script instead.


--Chris Nebel
AppleScript Engineering
_______________________________________________
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.

  • Follow-Ups:
    • Re: Finding and deleting specific extensions
      • From: Henry L Miller Jr <email@hidden>
    • Re: Finding and deleting specific extensions
      • From: Emmanuel <email@hidden>
References: 
 >Re: Finding and deleting specific extensions (From: Henry L Miller Jr <email@hidden>)

  • Prev by Date: Re: A script just for fun
  • Next by Date: Re: choose application list - revisited
  • Previous by thread: Re: Finding and deleting specific extensions
  • Next by thread: Re: Finding and deleting specific extensions
  • Index(es):
    • Date
    • Thread