Re: Can somebody point me in the right direction for dialog popup with textfields
Re: Can somebody point me in the right direction for dialog popup with textfields
- Subject: Re: Can somebody point me in the right direction for dialog popup with textfields
- From: email@hidden
- Date: Thu, 11 Jul 2002 22:33:54 EDT
Bjorn...I had a hard time following the script you posted. Maybe it got
mangled by the list server. But here's a snippet that may help you:
set folder1 to (choose folder) as alias
tell application "Finder" to set list1 to name of every folder of folder1 as
list
set value1 to item 1 of list1
tell application "Finder" to set list2 to name of every folder of alias
((folder1 as string) & value1 & ":") as list
set value2 to item 1 of list2
tell application "Finder" to set list3 to name of every file of alias
((folder1 as string) & value1 & ":" & value2 & ":") as list
set value3 to item 1 of list3
set theDialog to {size:[280, 160], name:"Settings", style:movable dialog,
contents:[,
{class:push button, bounds:[198, 120, 258, 140], name:"OK"}, ,
{class:pop up, bounds:[240, 33, 275, 53], contents:list1, text field:3}, ,
{class:text field, bounds:[140, 35, 235, 51], name:"Wich Client?", name
bounds:[10, 35, 130, 51], value:value1}, ,
{class:pop up, bounds:[240, 58, 275, 78], contents:list2, text field:5}, ,
{class:text field, bounds:[140, 60, 235, 76], name:"Wich job of Client?",
name bounds:[10, 60, 130, 76], value:value2}, ,
{class:pop up, bounds:[240, 83, 275, 103], contents:list3, text field:7},
,
{class:text field, bounds:[140, 85, 235, 101], name:"Wich Client page?",
name bounds:[10, 85, 130, 101], value:value3}, ,
{class:static text, bounds:[10, 10, 180, 19], contents:"Settings."}]}
dd install with grayscale
set d to dd make dialog theDialog
repeat
set i to dd interact with user
if i is 1 then -- "OK" button
set choice1 to get item (dd get value of item 2 of d) of list1
set choice2 to get item (dd get value of item 4 of d) of list2
set choice3 to get item (dd get value of item 6 of d) of list3
exit repeat
else if i is 2 then -- 1st popup
set choice1 to get item (dd get value of item 2 of d) of list1
dd set value of item 3 of d to choice1 -- sets text field to item
chosen in popup
tell application "Finder" to set list2 to name of every folder of
alias ((folder1 as string) & choice1 & ":") as list
dd set contents of item 4 of d to list2
dd set value of item 5 of d to item 1 of list2
tell application "Finder" to set list3 to name of every file of alias
((folder1 as string) & choice1 & ":" & (item 1 of list2) & ":") as list
dd set value of item 7 of d to item 1 of list3
else if i is 4 then -- 2nd popup
set choice2 to get item (dd get value of item 4 of d) of list2
dd set value of item 5 of d to choice2 -- sets text field to item
chosen in popup
tell application "Finder" to set list3 to name of every file of alias
((folder1 as string) & choice1 & ":" & choice2 & ":") as list
dd set contents of item 6 of d to list3
dd set value of item 7 of d to item 1 of list3
end if
end repeat
dd uninstall
{choice1, choice2, choice3}
Of course, this will get mangled, too, but if you can unmangle it it will
work, sort of.
The Dialog Director issue is this: "dd interact with user" returns only the
index number of the dialog item that the user touched. It doesn't tell you
what he/she did. So you have to write a lot of "dd get"s to determine the
state of the dialog after each click.
You'll also notice that I'm using a Finder tell instead "list folder". List
folder returns the names of all of the items (files and folders) in the
target folder. What you need, I think, is folder names only for the first two
popups and file names only for the third.
If you can use Tanaka's OSAX, I'd suggest using MT List Folders and MT List
Files instead.
You might want to add some error checks just in case your user selects a
subfolder that doesn't contain any files, for example.
I also wonder if you really want to use text fields linked to your popups?
That means a user could type in a name that doesn't exist in the selected
folder, which could get messy. If you use a simple popup, the user can't make
that mistake and your script gets simpler.
HTH
Robert Kyle
Star Tribune
Minneapolis
In a message dated 7/10/2002 8:18:19 AM, Bjorn Van Blanckenberg writes:
>
Want to display dialog with Dialog Director
>
>
With 3 popup's
>
First one you can choose Client
>
>
Second one has to look at the server client folder (wich is the chosen
>
client of first popup) and list the folders wich are the client jobs
>
>
third one has to look at the server client folder and then the client job
>
(wich is the chosen job of second popup) folder and list the folder in
>
the
>
job wich are the pages
>
>
If started with a dialog like this
>
If the client is chosen list the active jobs that are found on te servers
>
client folder
>
But don9t get any listing
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.