Re: Load script file
Re: Load script file
- Subject: Re: Load script file
- From: "Michael Schmidt (BRT)" <email@hidden>
- Date: Thu, 13 Mar 2008 21:36:03 +0100
Hi, Jens,
when working in Script Editor you need to specify the full path to
the script you want to load.
When saving these files on the desktop it will work:
MainScript.scpt:
on run
local obj
set obj to (load script file ((path to desktop folder as string) &
"Person.scpt"))
tell obj
setName("Foo")
setAlter(63)
end tell
display dialog obj's getName() & " is " & obj's getAlter() & " years
old!"
end run
Person.scpt:
property name : ""
property alter : 0
on setName(pName)
set my name to pName
end setName
on setAlter(pAlter)
set my alter to pAlter
end setAlter
on getName()
get my name
end getName
on getAlter()
get my alter
end getAlter
As you see it would be nice to name the getter-Handlers without the
"get"
Then you can write
display dialog obj's vorname() & " is " & obj's alter() & " years old!"
I think that's more human readable, I don't know, if name is a
reserved word, so I changed it to the german front name (vorname)
Greetings from Hamburg,
Michael Schmidt
Am 13.03.2008 um 17:18 schrieb Jens Heimer:
Hi everyone,
Is there anyone, who wants to tell me
Why this example wont work:
This one is in file main:
on run
local obj
set obj to (load script file "Person")
end run
And this one goes in file Person
property name : ""
property alter : 0
on setName(pName)
set my name to pName
end setName
on setAlter(pAlter)
set my alter to pAlter
end setAlter
on getName()
get my name
end getName
on getAlter()
get my alter
end getAlter
I know it is a silly question, when you did applescript for some
time, but anyway, i just started
_______________________________________________
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