Hi,
I gave up on something like you’re trying to do with Smile a while ago and tried it again. Still can’t figure out how to pass the values back to the compiled script from the Smile dialog. Here’s how far I got:
using terms from application “Smile”
property w : {name:“sfHostDialog2”, bounds:{71, 249, 520, 593}}
property m1 : {«class key »:“Worlds:”, menu:{“Island World”, “Gandawana”}, class:dialog item, control kind:400, enabled:true, bounds:{20, 20, 320, 40}, font:{font:-1}, call script:false, «class Auto»:false}
property m2 : {«class key »:“Camera Rules:”, menu:{“Camera inside pilots head”, “Camera inside pilots nose”}, class:dialog item, control kind:400, enabled:true, bounds:{20, 60, 320, 80}, font:{font:-1}, call script:false, «class Auto»:false}
property m3 : {«class key »:“Restarts:”, menu:{“GroundStart”, “GroundRestart”, “GroundStart+GroundRestart”}, class:dialog item, control kind:400, enabled:true, bounds:{20, 100, 320, 120}, font:{font:-1}, call script:false, «class Auto»:false}
property cb1 : {«class key »:“Full Fuel Load”, «class size»:0, class:dialog item, control kind:369, enabled:true, bounds:{22, 156, 131, 187}, font:{font:-1}, call script:true, «class Auto»:false}
property cb2 : {«class key »:“Full Ammo Load”, «class size»:0, class:dialog item, control kind:369, enabled:true, bounds:{22, 207, 131, 238}, font:{font:-1}, call script:false, «class Auto»:false}
property cb3 : {«class key »:“Team ID Help”, «class size»:0, class:dialog item, control kind:369, enabled:true, bounds:{187, 156, 296, 187}, font:{font:-1}, call script:false, «class Auto»:false}
property cb4 : {«class key »:“Vulching”, «class size»:0, class:dialog item, control kind:369, enabled:true, bounds:{187, 207, 296, 238}, font:{font:-1}, call script:false, «class Auto»:false}
property b1 : {«class key »:“Cancel”, tag:“canc”, class:dialog item, control kind:368, enabled:true, bounds:{149, 278, 247, 298}, font:{font:-1}, call script:true, «class Auto»:false}
property b2 : {«class key »:“Host”, tag:“dflt”, class:dialog item, control kind:368, enabled:true, bounds:{285, 278, 383, 298}, «class dflt»:true, font:{font:-1}, call script:true, «class Auto»:false}
end using terms from
property script_string : "
global q
on prepare theDialog
end prepare
on click in theDialog item number i
if i = 8 then – cancel
set q to true
quit
else if i = 9 then – host
set q to false
quit
end if
end click in
on quit
if not q then
set final_values to contained data of first dialog
– how to pass final_values back?
end if
continue quit
end quit
"
tell application “Smile”
launch
activate
set d to (make new dialog with properties w)
set mode of d to true
set m1_ref to (make new dialog item at d with properties m1)
set m2_ref to (make new dialog item at d with properties m2)
set m3_ref to (make new dialog item at d with properties m3)
set cb1_ref to (make new dialog item at d with properties cb1)
set cb2_ref to (make new dialog item at d with properties cb2)
set cb3_ref to (make new dialog item at d with properties cb3)
set cb4_ref to (make new dialog item at d with properties cb4)
set b1_ref to (make new dialog item at d with properties b1)
set b2_ref to (make new dialog item at d with properties b2)
set script of d to script_string
set modified of d to false
set mode of d to false
end tell
set e to true
repeat until not e
tell application “System Events”
set e to (exists process “Smile”)
end tell
end repeat
– how to get final_values?
I tried using the clipboard, Smiles permanent variables, and a bunch of other stuff. I don’t like the idea of writing the final_values for the dialog items to file.
Maybe I should rest on it until spring break and maybe look at it from a different point of view.
gl,