You need to be careful what you place in a tell block, as you may be unintentionally telling iTunes to do something, rather than your application. All apps have a set of commands and properties that they are able to understand, and asking an app to do something outside of this set will produce the error you’ve recieved. Using script editor, select “Open Dictionary” from the file menu , and then select the dictionary for the app you’re controlling. It’s contents will tell you if what you’re trying is actually possible.
If you really have to load a nib, it may not necessarily be important when you load the nib, but rather when you display the content that the nib contains that is the important factor. Also, do you have multiple nibs, or just one nib containing multiple windows? In the “Files” tab in PB, under “Resources” are all of the nibs your project has. By default there is only “MainMenu.nib”. From your code example…
…it would seem that you’re just trying to display a window rather than load a whole nib. If all of your windows actually reside in your main nib, then you do not need to load the nib again to call the window… just use [show window “mywindow” & hide window “mywindow”] to toggle it’s visibility, because the windows in the main nib are all loaded at launch. It is much easier for us to help if we have some actual code to troubleshoot, so if you can’t figure it out post your code here and you’ll get some help.
it worked perfekt in plain apple script - but i want to have “nicer” interfaces, so i’m trying ASS now
i was trying with multiple nibs - but then i got the iTunes error (which i now understand due to your “Open Dictionary”-Tip - ASS is much more compley than Apple script with its simple “display dialog” windows)
now i’m trying with mutlitple windows in the MainMenue.nip but i’m not near any solution yet…
But here is my script anyway
on clicked theObject
close window of theObject – (closes the main window)
global old_enconder
tell application “iTunes”
set keine_schleife to false
repeat while keine_schleife is false
set theCD to “”
set theiPod to “”
set theArtist to “”
repeat with z from 1 to (count of sources)
set sz to kind of source z
if sz is iPod then
set theWiPod to source z
set theiPod to library playlist 1 of theWiPod
else if sz is audio CD then
set theCD to audio CD playlist 1 of source z
end if
end repeat
if theiPod is not “” and theCD is not “” then –
set myCD to first source whose kind is audio CD
tell audio CD playlist 1 of myCD
set theArtist to (artist)
end tell
repeat with i from 1 to the count of every source
if the kind of source i is audio CD then
set CD_Name to the name of source i as text
set a_CD to true
exit repeat
end if
end repeat
if a_CD then -- if there is something in the CD tray...
if name of (get view of front window) is CD_Name then -- CD hilited?
if CD_Name contains "Audio CD" then
set the window of "Gracenote" to true -- (opens another Interface window)
else
set the window of "Select Time" to true -- (opens another Interface window)
end if
else
set the window of "NoCDSelected" to true -- (opens another Interface window)
end if
else
set the window of "NoCD" to true -- (opens another Interface window)
end if
else
set the window of “NoNothing” to true – (opens another Interface window)
end if
end repeat
end tell
end clicked