Here’s a (possible) challenge for ASOC - What I really need to do is move this code to regular Objective C.
Though I’m not using ASOC/Snow Leopard, I know the “Applescript” panel in IB is gone (hidden). So, now you can’t “name” your objects for AS to understand. IE, I could name a button “someButton” and refer to it in ASS like “tell button “someButton” of window 1 to set enabled to true”.
In a recent project I took advantage of this with the code below. What it does, is scan several folders of files and assigns the files to a combo box in one of 5 tabs. Now, there are 7 folders, so it’s not a 1-1 transfer. One of the tabs gets items from 3 folders. In IB, I named one of the tabs with all 3 of the folder names. Then the app adds the files to the combo box in the tab based on whether the ‘tab name contains’ the folder name (that’s the key for using the ASS name).
Can I, in OBJC or ASOC, somehow do the same thing to refer to a UI item by it’s Identifier? Or whose Identifier contains “XX”?
Challenge, or simple?
I know I can find a way to do it in a very wordy or static manner, but these folders could change up frequently so I need to be able to adjust this easily.
Thanks, Chris
property myfolders : {"Blow In", "Business Cards and Magnets", "Center Insert", "DAL", "Envelope", "Kansa", "Postcard"}
repeat with Fo in every item of myfolders
-->Fo = Blow In
tell application "Finder"
set myFiles to every file of folder ("Inserts" & myYear & ": TEMPLATES:" & Fo & ":")
repeat with Fi in myFiles
-->document file "JP9_SV_Jumbo_H.indt" of folder "Postcard" of folder " TEMPLATES" of disk "Inserts2009"
copy {(name of Fi) as string, (Fi as alias) as string, Fo as string} to end of myFileFolderArray
-->{"doc.indd","disk:folder:file.indd","Blow In"}
end repeat
end tell
end repeat
--now myFileFolderArray has all the documents, and their paths, and categories in a list
--build the combo boxes with the myFileFolderArray items based on their 3rd item, the category
repeat with thisItem in every item of myFileFolderArray
tell window "main"
tell tab view "booktabs"
tell combo box "adtemplatefile" of (first tab view item whose name contains (item 3 of thisItem))
make new combo box item at end of combo box items with data (item 1 of thisItem)
end tell
end tell
end tell
end repeat