• 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: String works, variable that's a string does not.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String works, variable that's a string does not.


  • Subject: Re: String works, variable that's a string does not.
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 28 Apr 2004 14:43:21 -0700

On Apr 28, 2004, at 1:38 PM, Lorin Rivers wrote:

Howcum?

Because text returned of a dialog is a unicode string, and the file type and creators require plain old ASCII strings.

"Set text_returned to text_returned as string" will not do it, even though it appears to make the change. here is a work around that works:

display dialog "What would you like to set the selected files creator to?" default answer "DmWr" buttons {"OK", "Cancel"} default button 1
copy the result as list to {text_returned, button_pressed}
set text_returned to text_returned
set temp to ""
repeat with loop from 1 to length of text_returned
set temp to temp & (ASCII character of (ASCII number of character loop of text_returned))
end repeat
set text_returned to temp

tell application "Finder"
if button_pressed is "OK" then
set these_items to the selection

repeat with i from 1 to the count of these_items
set this_item to (item i of these_items) as alias
set this_info to info for this_item
--set myPath to (this_item as string)
--set targetFile to myPath
set (creator type of file this_item) to (text_returned)
end repeat
end if
end tell

-- Michelle

--
Those who extol the "nobility of labor" mean the labor of others.
_______________________________________________
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: String works, variable that's a string does not.
      • From: Malcolm Fitzgerald <email@hidden>
    • Re: String works, variable that's a string does not.
      • From: Lorin Rivers <email@hidden>
References: 
 >String works, variable that's a string does not. (From: Lorin Rivers <email@hidden>)

  • Prev by Date: Applescript from Excel button
  • Next by Date: Re: script needed to force shutdown w/o any prompts/interference
  • Previous by thread: String works, variable that's a string does not.
  • Next by thread: Re: String works, variable that's a string does not.
  • Index(es):
    • Date
    • Thread