Tuesday, November 21, 2017

#1 2011-12-10 07:18:06 am

chingizz
Member
Registered: 2011-12-09
Posts: 15

Passing the variable from one script to another.

How can i pass the value from one script to another when both of my scripts are parts of one A.S.S. project.
I thought of "Load script" command but don't know which path to enter(
Please help!

Chingiz


Filed under: Variable pass copy

Offline

 

#2 2011-12-10 02:53:37 pm

DJ Bazzie Wazzie
Member
From:: the Netherlands
Registered: 2004-10-20
Posts: 2724
Website

Re: Passing the variable from one script to another.

tell application "studioApplicationName" to set theVariable to "test"

Offline

 

#3 2011-12-11 01:02:17 am

chingizz
Member
Registered: 2011-12-09
Posts: 15

Re: Passing the variable from one script to another.

Unfortunatly i didn't really understood what you ment.
Could you please write more on what should i tipe in each of the scripts. And please if its not hard can you explain everything:)

Thanks!

Offline

 

#4 2011-12-11 01:56:03 pm

DJ Bazzie Wazzie
Member
From:: the Netherlands
Registered: 2004-10-20
Posts: 2724
Website

Re: Passing the variable from one script to another.

The code I mean you can alter and access root script objects very easy by tell application "assproject1" Then your in the root script object. You can access handlers and root variables there. So you don't need to pass variables you can simply get and set them.

Offline

 

#5 2011-12-12 05:51:31 am

chingizz
Member
Registered: 2011-12-09
Posts: 15

Re: Passing the variable from one script to another.

Now i have two scripts first, where i set the variable and second where i display it

First script

Applescript:

tell application "tester"
   set test to "hel"
end tell

Second

Applescript:

on clicked theObject
   tell application "tester"
       set displayer to test
   end tell
   
   display dialog displayer
end clicked

But when i ran it i A.S.S says that variable "test" is not defined.
So what is may mistake?

Thanks for spendin so much time on this topic:)

Last edited by chingizz (2011-12-12 05:52:17 am)

Offline

 

#6 2011-12-12 07:01:07 am

DJ Bazzie Wazzie
Member
From:: the Netherlands
Registered: 2004-10-20
Posts: 2724
Website

Re: Passing the variable from one script to another.

Strange...

first script (named helperScript and save as stay open script)

Applescript:

property textToDisplay : missing value

setTextToDisplay("Hello World")

--getter
on getTextToDisplay()
   return textToDisplay
end getTextToDisplay

--setter
on setTextToDisplay(__string)
   set textToDisplay to __string
end setTextToDisplay

second script

Applescript:


tell application "helperScript" to set myVar to getTextToDisplay()

display dialog myVar

Offline

 

#7 2011-12-12 10:22:31 am

chingizz
Member
Registered: 2011-12-09
Posts: 15

Re: Passing the variable from one script to another.

Done everything you shoved just changed the name of the app but it says that myVar is no defined((((

Last edited by chingizz (2011-12-12 10:23:00 am)

Offline

 

#8 2011-12-12 10:30:59 am

chingizz
Member
Registered: 2011-12-09
Posts: 15

Re: Passing the variable from one script to another.

Might be you could try to sent me a working project to chingiz@li.ru
That would be great!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)