Skip to main content
Known Participant
May 2, 2008
Question

using variables defined in another script

  • May 2, 2008
  • 5 replies
  • 587 views
hallo

i have two separate scripts trigered by two unique shortcuts:

lets say first SCRIPT_1 takes a color (or any other property) of currentlly selected object and saves it in a variable "objCOLOR"

than i work on something else for a while or select different objects and eventually run SCRIPT_2 where id like to use value "objCOLOR" which i defined a while ago using SCRIPT_1

is it possible to define variables in one script and after a while use them in another script ? some kind of SUPER GLOBAL variables stored in memory of InDesign ? available to be used by various scripts ?
This topic has been closed for replies.

5 replies

Known Participant
May 2, 2008
aha

alert is poping up the script alerts... of course :)
Known Participant
May 2, 2008
only #targetengine routine seems to pop up some extra "script alerts" in indesign can i make a whole script perform in silent mode ?
Known Participant
May 2, 2008
thanks guys

great tips for exploring

#targetengine works perfect

InsertLabel will explore ASAP

thanks both
Known Participant
May 2, 2008
I'm not JS man - but you can do this other way - use InsertLabel and ExtractLabel

description from VB:

Sub InsertLabel(Key As String, Value As String)
Member of InDesign.Document
Sets the label to the value associated with the specified key. / Key: The key. / Value: The value.

Function ExtractLabel(Key As String) As String
Member of InDesign.Document
Gets the label value associated with the specified key. / Return value: The label. / Key: The key.

example in VB:

first script:
...
myDoc.InsertLabel("objCOLOR","0,120,24,0")
...

second script:
...
myColor = myDoc.ExtractLabel("objCOLOR")
...

I don't know if you can save color value directly ...

I'm not sure - but you can use .InsertLabel and .ExtractLabel with all objects in InDesign

robin

--
www.adobescripts.com
Known Participant
May 2, 2008
Yes,
you can.
js1:

#targetegine "__123__"

var a = "123";

js2:
#targetegine "__123__"

alert(a);

jxswm