Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Enthusiast Zone > Classic Macs and Mac OS > AppleScript - Keeping a variable

AppleScript - Keeping a variable
Thread Tools
Addicted to MacNN
Join Date: Sep 2000
Status: Offline
Reply With Quote
Oct 28, 2001, 05:25 PM
I have a script that goes something like this (though this is an example just to illustrate my question, and isn't really doing anything)

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
on run {}
end run

on do_function1()
set x to <font color = blue>1</font>
end do_function1

on do_function2()
set final_result to x + <font color = blue>1</font>
display dialog final_result
end do_function2

Now if you actually ran that script you would notice that x is undefined in do_function2(). Does anyone know how too keep the variable x so that it is available in any sub process?
I always use protection when fscking my Mac... Do you?
Grizzled Veteran
Join Date: Oct 1999
Location: Minneapolis
Status: Offline
Reply With Quote
Oct 29, 2001, 04:32 AM
Yes, define is as a property in the beginning of the script:

property x : ""

Moving to devolpers fora
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Privacy Policy
All times are GMT -4. The time now is 11:27 PM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2