gtk: script with variable external

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
arivas_2005
Posts: 212
Joined: Sun 25 Feb 2007, 14:39

gtk: script with variable external

#1 Post 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!
Last edited by arivas_2005 on Fri 06 Oct 2017, 20:32, edited 2 times in total.

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: gtk script and variable external

#2 Post 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 {}

User avatar
fabrice_035
Posts: 765
Joined: Mon 28 Apr 2014, 17:54
Location: Bretagne / France

#3 Post 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

Post Reply