Re: global variables
Re: global variables
- Subject: Re: global variables
- From: "Wallace, William" <email@hidden>
- Date: Wed, 26 May 2004 15:37:05 -0500
- Thread-topic: Re: global variables
Works OMM (MacOS 9.2.2, AS 1.8.3), however. I'm wondering if the snippet you've posted is out of context and thus I'm not encountering the problem you are. First, I don't see why you've passed a value to your keychainpass handler when you don't make use of it in the actual handler. Second, it works without the global declaration:
set importpass to my keychainpass("password") as string
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
importpass
--> returns the expected value
Third, the "on clicked theObject, tell window of theObject..." lines of code look like a FaceSpan handler. Is it possible that problem has more to do with your FaceSpan project than the Applescript code? At what point do you get the variable not defined error message?
B!ll
>
Subject: global variables
>
To: Applescript <email@hidden>
>
From: Isaac Ordonez <email@hidden>
>
Date: Wed, 26 May 2004 11:13:40 -0700Ok,
>
>
I've read books on this, researched the heck outta it, and ever example I come up >with says this should work but it doesn't. All I want to to declare the values I get from >the keychain as global variables so they will work within my subroutines and inside >"on clicked theObject" etc. but when I do the following:
>
>
global importpass
>
>
set importpass to my keychainpass("password") as string
>
>
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 clicked theObject
>
tell window of theObject
>
......
>
>
I get a variable "importpass" not defined. Is there something stupid I'm missing?
>
>
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.