• 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
Old script now fails
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Old script now fails


  • Subject: Old script now fails
  • From: Robert Poland <email@hidden>
  • Date: Mon, 19 Mar 2018 08:55:38 -0600
  • Z-usanet-msgid: XID181wcso4O1360X32

Hi,

I have this script from 2005 that no longer runs…

Any what’s changed?

property searchStrings : {"t"}
property replaceStrings : {""}

on run
        set chosenItem to choose file with multiple selections allowed
        open {chosenItem}
        return
end run

on open (droppedItemList)
        # tell application "Finder"

        repeat with theItem in droppedItemList
                # repeat from 1 to (count of  theItem in droppedItemList)
                log theItem
                set fileName to the name of theItem

                set new_item_name to changeLiteralStrings(fileName,
searchStrings, replaceStrings) of me

                if (get name of theItem) ≠ new_item_name then
                        set name of theItem to new_item_name
                end if

        end repeat

        # end tell
end open

-------------------------------------------------------------------------------------
--» HANDLERS
--------------------------------------------------------------------------------------
on changeLiteralStrings(_text, searchStrings, replaceStrings)
        change searchStrings into replaceStrings in _text
end changeLiteralStrings

property searchStrings : {"t"}
property replaceStrings : {""}

on run
        set chosenItem to choose file with multiple selections allowed
        open {chosenItem}
        return
end run

on open (droppedItemList)
        # tell application "Finder"

        repeat with theItem in droppedItemList
                # repeat from 1 to (count of  theItem in droppedItemList)
                log theItem
                set fileName to the name of theItem

                set new_item_name to changeLiteralStrings(fileName,
searchStrings, replaceStrings) of me

                if (get name of theItem) ≠ new_item_name then
                        set name of theItem to new_item_name
                end if

        end repeat

        # end tell
end open

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on changeLiteralStrings(_text, searchStrings, replaceStrings)
        change searchStrings into replaceStrings in _text
end changeLiteralStrings

<ul>
        <li>error "Can’t get name of {alias \"Macintosh
HD:Users:rpoland:Desktop:my cash flow.xlsx\"}." number -1728 from name of
{alias "Macintosh HD:Users:rpoland:Desktop:my cash flow.xlsx"}</li>
</ul>

Robert Poland
iMac, Late 2013, 14,2
  3.2 GHz Intel Core I5, 27”
  16 GB Ram, 1TB Fusion HD
  OS X 10.13.3 (High Sierra)
 _______________________________________________
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

  • Follow-Ups:
    • Re: Old script now fails
      • From: Yvan KOENIG <email@hidden>
    • Re: Old script now fails
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Re: Detecting Safari Web page loading
  • Next by Date: Re: Old script now fails
  • Previous by thread: Re: Detecting Safari Web page loading
  • Next by thread: Re: Old script now fails
  • Index(es):
    • Date
    • Thread