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

Running script from shortcuts v editor?


  • Subject: Running script from shortcuts v editor?
  • From: Peter R Hawkes <email@hidden>
  • Date: Sun, 27 Jan 2013 17:35:30 +0000
  • Thread-topic: Running script from shortcuts v editor?

The code;

tell application "Evernote"

	set theNote to selection

	set theNoteTitle to (title of item 1 of theNote) as string

	display dialog theNoteTitle --1

	set theX to offset of "[" in theNoteTitle

	if theX is not 0 then

		set theText to text ((offset of "[" in theNoteTitle) + 1) thru -1 of theNoteTitle

		display dialog theText  --2

		set theText to rstripString(theText, "]") of me

		display dialog theText  --3

	else

		set theText to "1d"

	end if

……. and on to do things to the Note!!

on rstripString(theText, trimString)
	local theText, trimString, x
	try
		set x to count trimString
		try
			repeat while theText ends with trimString
				set theText to characters 1 thru -(x + 1) of theText as text
			end repeat
			return theText
		on error number -1700
			return ""
		end try
	on error eMsg number eNum
		error "Can't trimBoth: " & eMsg number eNum
	end try
end rstripString

theNoteTitle is displayed in the dialog (all dialog just for debugging) at --1 as Test [6d]

at --2 it correctly becomes 6d]

the problem comes at --3 when if the script is run from keyboard shortcut (Fastscripts) theText is shown as 6=d but, if the script is run from the AppleScript Editor theText is correctly shown as 6d

Sorry for length of explanation but I fail to see why there is a difference based on how the script is run?

Peter H


 _______________________________________________
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: Running script from shortcuts v editor?
      • From: Shane Stanley <email@hidden>
    • Re: Running script from shortcuts v editor?
      • From: "koenig.yvan" <email@hidden>
  • Prev by Date: Re: appIsRunning(appName) not showing with filemaker
  • Next by Date: Re: Running script from shortcuts v editor?
  • Previous by thread: Re: appIsRunning(appName) not showing with filemaker
  • Next by thread: Re: Running script from shortcuts v editor?
  • Index(es):
    • Date
    • Thread