• 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: Script Libraries in iCloud
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Libraries in iCloud


  • Subject: Re: Script Libraries in iCloud
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 12 Feb 2014 14:35:20 -0600

On Feb 12, 2014, at 1:57 PM, Bryan Harris wrote:

I think the answer must be no, at least I don’t see how to do it.  Let’s say I want to tell my script library to do something:

tell script "Bryan's AppleScript Editor Library" to doSomethingFun()

And in my script library, I have a handler for doSomethingFun().  Can I use my script library via iCloud location or do I have to save the script library to each computer?

Here's one way to do it.

Here's a short script that you can run from the script editor.

property pathToScript : alias "OS_X:Users:lutherfuller:Desktop:test folder:FunScript.scpt"

on run
set scriptCode to load script pathToScript
tell scriptCode to doSomethingFun("AppleScript coding")
--
beep
delay 1
end run

The library script is shown in pathToScript for this test.
It doesn't matter where or how you get the alias to the library file. But, you do need to know its location.

The script for the library file is ...

-- saved as an uneditable script file named "FunScript.scpt"
on doSomethingFun(someText)
"Are you having fun doing ..." & return & return & someText
display dialog the result buttons {"Yes!"}
end doSomethingFun

This file can contain as many handlers as you need. You load it into your main script once, on launch, then whenever you need one of the handlers in the script you just 'tell scriptVariable to ...'.
You will have to pass the variable 'scriptVariable' to any of the main script's handler's that need it.



 _______________________________________________
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: 
 >Script Libraries in iCloud (From: Bryan Harris <email@hidden>)

  • Prev by Date: Script Libraries in iCloud
  • Next by Date: Re: Script Libraries in iCloud
  • Previous by thread: Script Libraries in iCloud
  • Next by thread: Re: Script Libraries in iCloud
  • Index(es):
    • Date
    • Thread