Hi all, I am taking the plunge into Applescript Studio and xcode,
So here is one of most likely many questions.
Can I, with Applescript Studio have the window name (Title) linked to my current file (loaded image ).
I.e when you command click the window name/title bar, a drop-down of the file Hierarchy is shown.
Of cause I would also like the title to show the icon and name of the file.
Mark, I don’t know how to do this but it seems to me that it may be very similar to my recent problem here. Look at my post #8 for instructions to my solution.
It seems to me that your hierarchal path is just a list, just like my recent searches list. So maybe if you create a new menu like I described and figure how to link it to the top of the window (or file’s owner or something like that) maybe it would work. Anyway, it’s just a thought.
property imageView : null
on awake from nib theObject
if name of theObject is "imageView" then
set imageView to theObject
end awake from nib
on clicked theObject
if name of theObject is "setImage" then
set filePath to POSIX path of ((choose file without invisibles) as string)
set fileName to call method "lastPathComponent" of filePath
delete image of imageView
set image of imageView to (load image filePath)
tell window "window"
set associated file name to filePath
set title to fileName
If I understand correctly, what you’re describing is just the default behavior of all document based applications. It works this way in Pages, iWork, TextEdit and so on. The whole document management side of things is handled by the OS (Cocoa), including command clicking to navigate the path, dragging the window title’s icon into the Finder to copy the file, showing the icon of the file in the window title, updating the “Open Recent” menu in the File menu and so on.
The good news is that you get all this functionality simply by creating a Document Based Application in XCode. It works fine for an AppleScript application (document based). You can instead in Interface Builder manually link up a window in an existing Xcode project to be the document for that application, but it’s a bit fiddly.
I suggest you don’t reinvent the wheel since you’ll only get half the user experience working and your program won’t be consistent with the Mac look & feel.