RE: include
RE: include
- Subject: RE: include
- From: "Wallace, William" <email@hidden>
- Date: Wed, 19 May 2004 13:17:41 -0500
- Thread-topic: include
As I understand it (perhaps one of the Applescript illuminati can correct me if I'm wrong, or elaborate on this issue) the contents of a property are physically stored in the compiled Applescript application. So once your app loads that external script, it's code is part of your app and thus the app can be moved anywhere and it still retains the loaded script code. I'm not sure when that load script command gets executed it may be the first time the app is run or it may be when the app is compiled, but in either case it should make your life easier with respect to re-using the same code in different projects.
B!ll
>
----------
>
From: Isaac Ordonez
>
Sent: Wednesday, May 19, 2004 12:46 PM
>
To: Wallace, William
>
Cc: Applescript
>
Subject: Re: include
>
>
Bill,
>
>
This looks like what I want. How can this be implemented to
>
dynamically point to an applescript within my Xcode project? This way
>
the finished .app can be moved into any folder, etc.
>
>
Isaac Ordonez
>
Technology Support Specialist II
>
San Rafael City Schools
>
415.302.8114
>
>
On May 19, 2004, at 8:24 AM, Wallace, William wrote:
>
>
> Is this what you're looking for? Save your keychain handlers as a
>
> compiled script and then when you write a new script that requires
>
> these handlers, include this code:
>
>
>
> property myScriptLib : load script alias "path:to:yourKeychainLib.as"
>
>
>
> then you can:
>
>
>
> tell myScriptLib to keychainpass(someValue)
>
>
>
> B!ll
>
>
>
>> ----------
>
>> From: email@hidden on behalf of Isaac
>
>> Ordonez
>
>> Sent: Tuesday, May 18, 2004 4:41 PM
>
>> To: Applescript
>
>> Subject: include
>
>>
>
>> Hello,
>
>>
>
>> I have a Applescript project in Xcode that has multiple scripts for
>
>> different functions and buttons. One thing they all have in common is
>
>> they access the keychain for a username and password. To do this I
>
>> have to set properties calling small routines to get each value from
>
>> keychain (server, name, password). For this I have to add the
>
>> following into the top of each script:
>
>>
>
>> on keychainpass(myvalue)
>
>> try
>
>> tell application "Keychain Scripting"
>
>> tell keychain 1
>
>> unlock
>
>> set theKey to first key whose name is "Add User Info"
>
>> set endvalue to (password of theKey) as string
>
>> return endvalue
>
>> end tell
>
>> end tell
>
>> end try
>
>> end keychainpass
>
>>
>
>> on keychainname(myvalue)
>
>> try
>
>> tell application "Keychain Scripting"
>
>> tell keychain 1
>
>> unlock
>
>> set theKey to first key whose name is "Add User Info"
>
>> set endvalue to (account of theKey) as string
>
>> return endvalue
>
>> end tell
>
>> end tell
>
>> end try
>
>> end keychainname
>
>>
>
>> on keychainserver(myvalue)
>
>> try
>
>> tell application "Keychain Scripting"
>
>> tell keychain 1
>
>> unlock
>
>> set theKey to first key whose name is "Add User Info"
>
>> set endvalue to (server of theKey) as string
>
>> return endvalue
>
>> end tell
>
>> end tell
>
>> end try
>
>> end keychainserver
>
>>
>
>> property importpass : my keychainpass("password") as string
>
>> property importname : my keychainname("account") as string
>
>> property myServer : my keychainserver("server") as string
>
>>
>
>>
>
>> Is there any possible way to have this chunk of data as another script
>
>> and make applescript include it in to every script? This way I could
>
>> have it once and then force prepend it to all scripts.
>
>>
>
>> Isaac Ordonez
>
>> Technology Support Specialist II
>
>> San Rafael City Schools
>
>> 415.302.8114
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.