• 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: Stack Overflow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack Overflow


  • Subject: Re: Stack Overflow
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 19 Dec 2015 13:16:34 -0600

On Dec 19, 2015, at 12:54, Robert Poland <email@hidden> wrote:
What would be causing a “Stack Overflow”? Happens before display dialog line.
______________________________________________________________________

Hey Bob,

The overflow happens here on the designated line, because it is NOT in the Finder-tell-block.

-------------------------------------------------------------------------------------------
tell application "Finder"
  set myName to "" # clear myName
  try # Deal with All Conditions Met, Execute Actions with no selection
    set myFile to the selection as alias
    set myName to the name of myFile
    display dialog "myFile = " & myFile & return & "myName = " & myName
  end try
end tell
if myName contains "ƒ" then set myName to "" # don't add "ƒ" if it's already there
if length of myName ≠ 0 then # length of name of file selected
  set the name of myFile to myName & "ƒ" --<< STACKOVERFLOW
end if
-------------------------------------------------------------------------------------------

I'd probably do something like this:

-------------------------------------------------------------------------------------------
tell application "Finder"
  set itemList to the selection as alias list
  if length of itemList = 1 then
    set theItem to item 1 of itemList
    set itemName to name of theItem
    if itemName does not contain "ƒ" then set the name of theItem to itemName & " ƒ"
  end if
end tell
-------------------------------------------------------------------------------------------

--
Best Regards,
Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Stack Overflow (From: Robert Poland <email@hidden>)

  • Prev by Date: Stack Overflow
  • Next by Date: Re: AS Library Question
  • Previous by thread: Stack Overflow
  • Next by thread: Re: Stack Overflow
  • Index(es):
    • Date
    • Thread