• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to retrieve variables from palette to palette

Enthusiast ,
Jul 30, 2021 Jul 30, 2021

Copy link to clipboard

Copied

Hi Gurus!, Please Help me, I'm Stuck now, I'm trying to pass some variables from Palette to another Palette (from Find Options (palette) to GREP Find (palette) but i cant!, no response at all when hit OK Button,

how to retrieve variable from palette to palette.jpg

This is Example for the second Palette (Find Options) Have 2 Check Boxes + Slider Control

function CalltheFindOptions() {
#targetengine "MyOptions";
//Find Options Window
findoptions.text = "Find Options";
//
//Parent - Input Panel Prepare
var SelectPanel = findoptions.add("panel", undefined, undefined, { name: "panel1" });
SelectPanel.text = " Find Options : ";
SelectPanel.preferredSize.width = 1000;
SelectPanel.orientation = "row";
SelectPanel.alignChildren = ["center", "center"];
SelectPanel.spacing = 10;
SelectPanel.margins = 16;

//Children -  input Panel Inside Prepare
var mySelectPanelInside = SelectPanel.add("group", undefined, { name: "mySelOpt" });
//--Adding Find What
//mySelectPanelInside.add("statictext", undefined, "Find Options :");
//myInputPanelInside.alignment = "center";
//Show Finding Results
var ShowResultsDirect = mySelectPanelInside.add("checkbox", undefined, "Show Results");
ShowResultsDirect.value = false; //by Default
ShowResultsDirect.helpTip = "This will Show Results Directly for Character,Paragraph and Object Styles Depending in your Computer Speed"

var ShowResults = mySelectPanelInside.add("checkbox", undefined, "Show Results Delayed in milliseconds(Ms) :");
ShowResults.value = false; //by Default
ShowResults.helpTip = "This will Delay Execution due to Slider Control in milliseconds for Character,Paragraph and Object Styles to let User See Find/Change Results"

//Adding Slider to Control MS Time
var SliderControlText = mySelectPanelInside.add ("edittext", undefined, 10, {readonly: false}); //read only prevent user Entering Nums
SliderControlText.characters = 3;
var slider = mySelectPanelInside.add ("slider {minvalue: 1, maxvalue: 100, value: 10}");
slider.helpTip = "You Can Control Delay Time with this in milliseconds, 1 Second equal 1000 ms"

//Slider Listener Plus SliderControl Text Listener
slider.onChanging = function () {SliderControlText.text = slider.value;} //Listen to Slider

so if hit (OK) Button from the Palette (behind the Find Options) nothing Happened at all!, the function for the Button is something like this :

Read from Find Options Palette.jpg

So Both (Showresult.value) and (TimeMS) must be read from (Find Options) Palette but the OK Button Ignore them, in the past the script was in the (Behind) Palette, but when i Seperate the Script to new Palette it Cut the Connection Between Code!, Please Help, and Thanks in Advance.

Best
Mohammad Hasanin
TOPICS
Scripting

Views

277

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

Hi Gurus,

I endup passing all the variables from palette(options) to main palette using invisible text boxes!, that solve the problem!

This is Insane!?, maybe its impossible!, i don't know, the documentation its not clear enough about that,  i hope i didn't ask a stupid question!, because script ui palettes made me mad! 🙂, Thanks all

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

Does each palette have its own target engine? In this case that might be the problem because the variables exist only in their respective target engine and can't be accessed from outside that target engine..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

Thank you @crazyPanda  for your answer, Actually every palette have the same targetengine session , Actually i do the following for the three palette:

#targetengine "session1";
var w = new Window("palette", {independent:true}); //Main Palette Windows
var gqmanager = new Window("palette"); //GREP Query Manager Palette
var findoptions = new Window("palette"); //Options Palette

  and i call palette with function like this  :

/------------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------Find Options Palette----------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------
function CalltheFindOptions() {
#targetengine "session1";
//Find Options Window
findoptions.text = "Find Options";
//
//Parent - Input Panel Prepare
var SelectPanel = findoptions.add("panel", undefined, undefined, { name: "panel1" });
SelectPanel.text = " Find Options : ";
SelectPanel.preferredSize.width = 1000;
SelectPanel.orientation = "row";
SelectPanel.alignChildren = ["center", "center"];
SelectPanel.spacing = 10;
SelectPanel.margins = 16;
..................................etc

do you have better scenario? and thanks again

 

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2021 Aug 01, 2021

Copy link to clipboard

Copied

Hi @M.Hasanin,

Can you share a simple demo code of two palettes(keep the UI elements to just minimum to demonstrate the issue) that want to share the variable, that way we can easily debug and discuss our findings. At first thought I concur with @crazyPanda that if we use the same targetengine the shared variables should have access. I think its quite probable that you might be stuck with JS scoping issue which is not necessarily related to Script UI.

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 02, 2021 Aug 02, 2021

Copy link to clipboard

Copied

LATEST

Hi @Manan Joshi 

Thank you for the reply, I will make a tiny version and reply again, thanks a lot

 

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines