• 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: Running script from shortcuts v editor?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running script from shortcuts v editor?


  • Subject: Re: Running script from shortcuts v editor?
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 28 Jan 2013 09:11:43 +1100

On 28/01/2013, at 4:35 AM, Peter R Hawkes <email@hidden> wrote:

> set theText to characters 1 thru -(x + 1) of theText as text


What you're doing here is making a list of characters, and then coercing the list to a string. That's not only inefficient, but the result also depends on the value of AppleScript's text item delimiters at the time -- it looks like they were set to "=" when you ran the script in Fastscripts.

You can either keep digging and set the the delimiters to {""}, or do it more efficiently:

  set theText to text 1 thru -(x + 1) of theText

Even then, your code will fail (try rstripString("abcd] ", "]")), because it should be either:

  set theText to text 1 thru (x - 1) of theText

Or more simply, without the need to get the length of the string:

  set theText to text 1 thru -2 of theText


--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


 _______________________________________________
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: 
 >Running script from shortcuts v editor? (From: Peter R Hawkes <email@hidden>)

  • Prev by Date: Re: appIsRunning(appName) not showing with filemaker
  • Next by Date: Clickable links!
  • Previous by thread: Re: Running script from shortcuts v editor?
  • Next by thread: Call PowerPoint 2011 VBA Subroutine From AppleScript [SOLUTION]
  • Index(es):
    • Date
    • Thread