anything like DialogDiector for OSX

I used to have a script for ircle in OS9.2 that used dialog director to make a an eleberate dialog but it doesn’t yet work in osx and probably never will. Is there any scripting additions out there that will do roughly the same thing that can be distributed freely with my script? If not does any one know anything about making scripting additions and if so maybe point me in the right direction towards some good documentation on making scripting additions?

Hi,

For osx, you can use AppleScript Studio to make more complex dialogs:

http://www.apple.com/applescript/studio/

It’s probably already in your computer as part of the developer install. There is also Smile:

http://www.satimage.fr/software/en/

although I don’t like the Smile app running when you need to disp lay your dialog. There are others, but these are free.

gl,

Unfortunately Applescript studio requires OS X 10.3 and I am only using 10.2.8 and I have been experimenting with smile and I like it’s dialog builder but I can’t get my script that runs loaded in ircle to call the dialog. Any ideas?

Hi PolarBear,

You can find out how to install the developer tools at:

“Macintosh HD:Applications:Installers:Developer Tools:”

Read the documentation.

I’m not sure how you would use this with ircle with an analogy to DialogDirector. It has been a while since I’ve used DD and I’m still a newbie at ASS. I’ll try to work on it when I have time, but it might take a while unless someone else replies. After you install the developer tools, you might want to post at the AppleScript Studio forum at this bbs.

Hope you’re not too pressed for time.

gl,

24U appearance osax.
http://www.osaxen.com/appearance.html

:wink:

Dev Tools are also available through http://connect.apple.com/ (free membership), I think you can install the December 2002 Developer Tools package.
I don’t know neither how does it work Ircle, but seems that it maybe able to run only compiled scripts? If so, I think Hanaan described somewhere a very simple mechanism: you create a compiled script as the following (pseudo-code):

tell app "StudioAppWithUI"
     --> this launches your interface, eg, a text field and a button
     --> which, on clicked, hides the main window
     repeat while exists button "OK" of window "main"
          delay 1 --> wait while window "main" is visible
     end repeat
     --> grab info from text field
     set myInfo to contents of text field "foo" of window "main"
end tell
--> continue your script

I already have the developer tools installed but it’s an older version, like I said I’m running OS X 10.2.8. and last I looked applescript studio needs at least OS X 10.3 I have a dialog already built in smile. and the first hurtle I have to jump is a simple one. I just want to get the damn dialog to open. I’ve got an ircle srcipt loaded in ircle with the On button event handler so that on button, if code = n then tell “smileDialog” to open. sounds simple right? nope. I get the error “smileDialog” does not understand the open message. The documentation that comes with smile sucks. The samples that come with smile suck. It says the dialogs can be called from other scripts but there is not one example that I have seen of that actually working.

This is the dialog I’ve made just as an example of the complexity of it. Simple dialogs with one text field and one button do not cut it.

Thanx but there’s a shareware fee for that which means I wouldn’t be able to distribute it with my script.

“smileDialog” is not an application, so it can’t accept events such as “open”, nor “launch”. You must instruct Smile to open the dialog, since it is a Smile document (as a text file or a compiled script):

tell app "Smile" to open alias "path:to:mydialog:"

Or:

make new dialog with properties {path name:alias "path:to:mydialog:"}

Or this one, which will act as a double-click in the Finder:

tell app "Finder" to open alias "path:to:mydialog:"

And, BTW, Smile is one of the best documented apps in the world, as far as I know. Check the “The custom dialogs” chapter in the online docs:
http://www.satimage.fr/software/en/documentation_map.html
Also available as PDF, here:
http://www.satimage.fr/software/en/downloads_documentation.html

No, JJ is correct. Earlier versions of Dev Tools didn’t include Studio, but the Dec 2002 release for OS 10.2 does.

I’m getting ready for work right now, so if you want to wait until I get back, I have a script somewhere that creates a smile dialog unless somebody else posts one.

later,

OK I just check my hard drive and it was the dec 2002 dev tools I installed but I haven’t seen hide nor hair of applescript studio. Can you tell me where I would find that?

In Project Builder, select File > New Project… > Application > AppleScript Application/AppleScript Document-based Application/AppleScript Droplet to create a new Studio project. See the Studio documentation for more information.

“Applescript Studio” is a bit of a misnomer. There is no APPLICATION named “Applescript Studio.” It is part of the Project Builder/Interface Builder applications. I remember scouring my hard drive looking for “Applescript Studio.” :rolleyes:

Brad Bumgarner, CTA

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,

Wow thanx that is pretty interesting. I probably will tinker with that. How to pass the values back to the compiled script? hmm. Off the top of my head the only thing I can think so far is a jury rigg kind of a hand off to the clipboard with some kind of mark at the beggining like set tempString to (“FromDialog” & values) set the clipboard to tempString

Then in the compiled script have some thing in the on idle handler like set tempString to get contents of clipboard If temPstring starts with “FromDialog” then set valuesFromDialog to rest of tempString.

Man that looks hokey as heck now that I wrote it. Think it would work?

Hi PolarBear,

One more option might be to keep monitoring the dialog from the compiled script. But, I was thinking that might interfere with the dialog, so I just wanted to get the data after the user was done with the dialog.

Don’t know why I couldn’t set the clipboard from the dialog script. Maybe the mind was to tired.

Off to work.

gl,

Hi PolarBear,

I was reading more of the documentation of Smile on permanent variables. If you’re still using Smile for this, then this may be one way to do this.

The permanent variables are stored in the Globals compiled script in the users Library. You can use that to store and get the dialog values. Here’s an example:

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 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 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 : "
on prepare theDialog
set my final_values to {}
end prepare

on click in theDialog item number i
if i = 3 then – cancel
quit
else if i = 4 then – host
set my final_values to contained data of every dialog item of theDialog
quit
end if
end click in
"
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 cb1_ref to (make new dialog item at d with properties cb1)
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
prepare d
repeat
try
set d_list to (every dialog)
if d_list is {} then exit repeat
on error
exit repeat
end try
end repeat
end tell
tell application “System Events”
set e to (exists process “Smile”)
end tell
if e then quit application “Smile”
set app_support to (path to application support from user domain)
set global_script to (“” & app_support & “Smile:Class Scripts:Globals”) as alias
set global_object to load script global_script
set user_prefs to final_values of global_object
if not user_prefs is {} then
set item_index to item 1 of user_prefs
set menu_value to item item_index of menu of m1
set cb1_value to (item 2 of user_prefs) as boolean
return {menu_value, cb1_value}
end if

gl,

Well that is very close. we’re getting there. The dialog opens as it should and closes when cancel or host is clicked but I’m getting an error “can’t get item_index of {“Island world”,“Fantasy Isaland”,“Solomon Islands”,“Mountain world”}” So appearently set item_index to item 1 of user_prefs
set menu1_value to item_index of menu of m1
does not get the selected item but the whole list. Any ideas?

I tried something else that’s producing a strange error.

The error dialog says “Some Parameter is missing for <>.”

Any idea what that might be?
The error seems to be produced in irlce where my compiled script is loaded not in smile. But the variable d isn’t used anywhere but inside the tell to smile so I don’t understand this error.

Wait, never mind I think I found the problem.

Nope I was wrong. Still getting the “Some Parameter is missing” error

You typed the line:

set menu1_value to item_index of menu of m1

item_index is a number. It’s the index of the item. There should be ‘item’ infront of it:

set menu1_value to item item_index of menu of m1

Also, you might want to change the end of the last script:

if not user_prefs is {} then
set item_index to item 1 of user_prefs
set menu_value to item item_index of menu of m1
set cb1_value to (item 2 of user_prefs) as boolean
return {menu_value, cb1_value}
end if

change to:

if user_prefs is {} then return
set item_index to item 1 of user_prefs
set menu_value to item item_index of menu of m1
set cb1_value to (item 2 of user_prefs) as boolean
return {menu_value, cb1_value}

I don’t know why you’re getting the coregetd error, but it must be something with ircle using the script. It has nothing to do with the variable d I think, but an error getting data or something. Maybe the returned data?

gl,