Page 1 of 1

gtk: script with variable external

Posted: Tue 26 Sep 2017, 17:49
by arivas_2005
regards
How to pass an external variable (DATA1)inside the gtk script
see the code :oops:

Code: Select all

#!/bin/sh
DATA1="John Master"
export script='
<vbox>
  <entry>
    <variable>ENTRY_DATA</variable>
    <input>echo "$(DATA1)"</input>
  </entry>
  <button>
    <label>Refresh</label>
    <action>echo "$(DATA1)"</action>
    <action>refresh:ENTRY_DATA</action>
  </button>
</vbox>'

gtkdialog -p script
pass the value from DATA1 (external) to ENTRY_DATA (internal)-- not work!
It's possible?
in advance thanks!

Re: gtk script and variable external

Posted: Wed 27 Sep 2017, 02:50
by MochiMoppel
arivas_2005 wrote:How to pass an external variable (DATA1)inside the gtk script
export DATA1="John Master"

For testing always run your script from console and pay attention to error messages. "$(DATA1)" causes an error. Remove the () parentheses or - if you like it complicated - replace them with curly braces {}

Posted: Wed 27 Sep 2017, 09:03
by fabrice_035
and next tip, if i can :)

I suppose you want new entry pass in echo cmd ?

-->

Code: Select all

#!/bin/sh

export DATA1="John Master"

export script='
<vbox>
  <entry>
    <variable>ENTRY_DATA</variable>
      <default>"'$DATA1'"</default>
  </entry>
  <button>
    <label>Refresh</label>
    <action>echo "$ENTRY_DATA"</action>
    <action>refresh:ENTRY_DATA</action>
  </button>
</vbox>'

gtkdialog -p script