• 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
Changing creator/type in OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing creator/type in OS X


  • Subject: Changing creator/type in OS X
  • From: "Marc K. Myers" <email@hidden>
  • Date: Sun, 9 Mar 2003 17:35:01 -0500

I wrote a script to change the creator and type of files in OS X. This was the easiest thing in the world in OS 9 but I can't get it to work in 10.2.4:

on run
--display dialog "This script functions only as a droplet" buttons {"Cancel"} default button 1
open ((choose file) as list)
end run

on open (inItems)
repeat with anItem in inItems
if last character of (anItem as text) is not ":" then
modFile(anItem as alias)
end if
end repeat
end open

on modFile(theFile)
set theInfo to info for theFile
tell theInfo
set theName to name
set fType to file type
set fCreate to file creator
end tell
activate
set theRslt to (text returned of (display dialog theName & return & return & ,
"File type: " default answer fType) & "????")
tell application "System Events"
set file type of file (theFile as text) to (text 1 thru 4 of theRslt) as Unicode text
end tell
tell application "Finder" to update theFile
set theRslt to (text returned of (display dialog theName & return & return & ,
"File creator: " default answer fCreate) & "????")
tell application "System Events"
set creator type of file (theFile as text) to (text 1 thru 4 of theRslt) as Unicode text
end tell
tell application "Finder" to update theFile
end modFile

The script seems to work as I run it in Script Editor and follow it in the event log. The only problem is that when it's done nothing has been changed. Is there a trick to doing this in OS X?

Marc [03/09/03 5:34:23 PM]
_______________________________________________
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: Changing creator/type in OS X
      • From: Michael Grant <email@hidden>
  • Prev by Date: Re: Open dictionary script
  • Next by Date: Re: Searching for the equivalent of coercing to type "record"
  • Previous by thread: Re: Open dictionary script
  • Next by thread: Re: Changing creator/type in OS X
  • Index(es):
    • Date
    • Thread