• 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
Simple script. Simple error. Can't find it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple script. Simple error. Can't find it


  • Subject: Simple script. Simple error. Can't find it
  • From: Lists <email@hidden>
  • Date: Sat, 30 Aug 2014 19:08:21 -0700

I've looked at this so long I'm cross eyed, but I still can't find my error. Anyone?

tell application "Safari"
activate
set theURL to URL of front document
set selectedText to (do _javascript_ "(''+getSelection())" in document 1)
set theTitle to do _javascript_ "document.title" in document 1
set winTitle to findReplace(theTitle, ":", "-")
set theDate to do shell script "date +'%Y-%m-%d'"
set the clipboard to winTitle & return & return & theURL & return & return & selectedText & return & return & theDate as string
end tell

on findReplace(theTxt, searchFor, replaceWith)
set oldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to searchFor
set txtLst to every text item of theTxt as list
set AppleScript's text item delimiters to replaceWith
set theTxt to txtLst as string
set AppleScript's text item delimiters to oldDelims
return theTxt
end findReplace

-->error "Safari got an error: Can’t continue findReplace." number -1708

Thanks
J
 _______________________________________________
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: Simple script. Simple error. Can't find it
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: The Future of AppleScript
  • Next by Date: Re: Encoding
  • Previous by thread: Re: Encoding
  • Next by thread: Re: Simple script. Simple error. Can't find it
  • Index(es):
    • Date
    • Thread