• 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: Need to run script periodically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need to run script periodically


  • Subject: Re: Need to run script periodically
  • From: Steve Mills <email@hidden>
  • Date: Sun, 12 Feb 2017 22:23:55 -0600

On Feb 12, 2017, at 20:28:53, Brian Christmas <email@hidden> wrote:
>
> 6. To Steve Mills, I tried  Or use osascript to run the .scpt file.  but it gave me an error. Can anyone give me an example of how to correctly use this command. I copied off the net, (an example bt Shane), but no dice.
>
> tell application "Finder"
> 		set pathToFolderActionscripts to (path to Folder Action scripts folder from user domain) as text
> 	end tell
> 	set scriptPath to quoted form of POSIX path of (pathToFolderActionscripts & "ftp Downloader.scpt" as text)
> 	# do shell script "sleep 10&&/usr/bin/osascript -e   \"tell \\\"ftp Downloader.scpt\\\" to quit\" && \"run \"\\scriptPath\\"
> 	# do shell script "sleep 10&&/usr/bin/osascript -e  'tell script (( POSIX path of (path to Folder Action scripts folder from user domain))&\"ftp Downloader.scpt\") to run’"
> 	# do shell script "sleep 10&&/usr/bin/osascript -e  'tell script (( POSIX path of (path to Folder Action scripts folder from user domain))&\"ftp Downloader.scpt\") to launch’"
> 	# do shell script "sleep 10&&/usr/bin/osascript -e  'tell script (( POSIX path of (path to Folder Action scripts folder from user domain))&\"ftp Downloader\") to run'"
> do shell script "sleep 10&&/usr/bin/osascript -e  'tell (( POSIX path of (path to Folder Action scripts folder from user domain))&\"ftp Downloader.scpt\") to launch'

You're making it harder than it needs to be.

set p to quoted form of "/path/to/your folder action script.scpt"
do shell script "osascript " & p

I forget; why, since we're already in AppleScript at this point, you can't simply load the run the folder action script via AppleScript instead of this indirection through the shell and then back to AppleScript? If you need to call the folder action handler in a script, then:

set p to "/path/to/your folder action script.scpt"
set s to load script p
tell s to adding folder items to "bob" after receiving {"oink"}

--
Steve Mills
Drummer, Mac geek


 _______________________________________________
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: Need to run script periodically
      • From: Brian Christmas <email@hidden>
References: 
 >Re: Need to run script periodically (From: David Crowe <email@hidden>)
 >Re: Need to run script periodically (From: Steve Mills <email@hidden>)

  • Prev by Date: Re: Need to run script periodically
  • Next by Date: Re: Need to run script periodically
  • Previous by thread: Re: Need to run script periodically
  • Next by thread: Re: Need to run script periodically
  • Index(es):
    • Date
    • Thread