• 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: funny pair of scripts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: funny pair of scripts


  • Subject: Re: funny pair of scripts
  • From: Nigel Garvey <email@hidden>
  • Date: Tue, 9 Mar 2004 10:55:11 +0000

Nelson Byrne wrote on Mon, 8 Mar 2004 20:26:23 -0800:

>This fails if I choose my desktop, so that "choose folder as text"
>returns the string "OSX:Users:rnb:Desktop:"
>
>property TheFileName : "debug.log"
>(choose folder) as text returning TheFolder
>log class of TheFolder
>log TheFolder
>tell application "Finder"
> if (exists file (TheFolder & TheFileName)) then (delete file
>(TheFolder & TheFileName))
> make new file at TheFolder with properties {name:TheFileName, owner
>privileges:read write, group privileges:read write, everyones
>privileges:read write} returning TrueFile
>end tell

New files should be created at folders, not at strings.

make new file at folder TheFolder ...

>This on the other hand works just fine:
>
>property TheFileName : "debug.log"
>property TheFolder : "OSX:Users:rnb:Desktop:"
>log class of TheFolder
>log TheFolder
>tell application "Finder"
> if (exists file (TheFolder & TheFileName)) then delete file (TheFolder
>& TheFileName)
> make new document file at TheFolder with properties {name:TheFileName,
>owner privileges:read write, group privileges:read write, everyones
>privileges:read write} returning TrueFile
>end tell

That *is* odd. I notice that '(choose folder) as text' returns Unicode
text, whereas what's compiled into your second script is plain text.
Maybe the OS X Finder automatically coerces plain text - but not Unicode
text - to folder specification where required. Very sloppy.

NG
_______________________________________________
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.


  • Prev by Date: Re: Millisecond clock
  • Next by Date: Re: TechNote 2106
  • Previous by thread: funny pair of scripts
  • Next by thread: FW: Graphic Converter scripting complaints
  • Index(es):
    • Date
    • Thread