Along with this thread, now comes this:
Why does this work in applescript but not in AS Studio?
property theList : {}
tell application "Printer Setup Utility"
set theList to name of every printer
end tell
on clicked theObject
display dialog item 1 of theList as string
--if I remove "as string" the error dialog says "can't get item 1 of {}
end clicked
That works perfectly when run from script editor, but AS Studio claims it can’t make item 1 into a string.
Lastly, is there an event log in AS Studio that I’m missing? I put log commands in my script, but never get any feedback that I can find.
And I’ll save drag and drop issues for next time.
That does not work in Script Editor for me. I don’t see how this is supposed to work in AS Studio. At what point do you get the printer names?
Wait, do you mean this works in Script Editor?
property theList : {}
tell application "Printer Setup Utility"
set theList to name of every printer
end tell
display dialog item 1 of theList as string
If that’s what you mean, then the problem is that your Studio app never gets the list of printers. In Interface Builder, connect the File’s Owner to the ‘will finish launching’ handler, then try something like this:
property theList : {}
on will finish launching theObject
tell application "Printer Setup Utility"
launch
set theList to name of every printer
quit
end tell
end
on clicked theObject
display dialog (item 1 of theList)
end clicked
Sorry copy/pasted from the wrong window. That is exactly what I meant, thank you for the help.
Aa