Hi
I'm new to Scripting and i have 2 little questions.
1) How can i get the text that the user is writing to a textfield into my script?
for example, if the User writes 255 | 0 | 0 in 3 diffrent Textfields, how can i get the text out of the UI-Textfield and use it in my script?
2) How can i exectute my script when someone pushs the "OK"-Button?
Thanks
Getting Text out of a Textfield
Getting Text out of a Textfield
A sample dialog:
Code: Select all var aSfxDlg =
"dialog { text: 'A H - Add Suffix', bounds:[100,50,240,220], \
fbSel: Checkbox { text:'FB Sel / Fb Folder', value:'true', bounds:[10, 5, 140, 25]}, \
suf: EditText { text:'<suffix>', bounds:[10, 30, 140, 50]}, \
brws: Button { text:'Browse to Folder', bounds:[10, 55, 130, 75]}, \
tF: EditText { text:'<Target Folder>', bounds:[10, 82, 130, 100]}, \
runBtn: Button { text:'Run', bounds:[10, 110, 130, 130], properties:{name:'ok'}}, \
cancelBtn: Button { text:'Cancel', bounds:[10, 140, 130, 160], properties:{name:'cancel'}} \
}";
var myDlg = new Window(aSfxDlg);
var doReview = aSfx.show();
You need the 'show' to open the window. Then in this case because runBtn has the special name 'OK', it automaticaly closes the dialog when clicked (or if you hit Enter). Alternatively you have an explicit onClick function for runBtn that closes the window.
After your window has closed you capture a textfield value with:
Code: Select allvar sfx = myDlg.suf.text;
Hope that helps.
Andrew
Code: Select all var aSfxDlg =
"dialog { text: 'A H - Add Suffix', bounds:[100,50,240,220], \
fbSel: Checkbox { text:'FB Sel / Fb Folder', value:'true', bounds:[10, 5, 140, 25]}, \
suf: EditText { text:'<suffix>', bounds:[10, 30, 140, 50]}, \
brws: Button { text:'Browse to Folder', bounds:[10, 55, 130, 75]}, \
tF: EditText { text:'<Target Folder>', bounds:[10, 82, 130, 100]}, \
runBtn: Button { text:'Run', bounds:[10, 110, 130, 130], properties:{name:'ok'}}, \
cancelBtn: Button { text:'Cancel', bounds:[10, 140, 130, 160], properties:{name:'cancel'}} \
}";
var myDlg = new Window(aSfxDlg);
var doReview = aSfx.show();
You need the 'show' to open the window. Then in this case because runBtn has the special name 'OK', it automaticaly closes the dialog when clicked (or if you hit Enter). Alternatively you have an explicit onClick function for runBtn that closes the window.
After your window has closed you capture a textfield value with:
Code: Select allvar sfx = myDlg.suf.text;
Hope that helps.
Andrew