I have an app that slides open a drawer off of the right side of the main window.
I’m trying to pass some data to it but I keep getting error messages so I assume I am not targeting it correctly.
The hierarchy is as:
window(mainWin)–>drawer(exifWin)–>scroll view(dataWinKeysScroll)–>text view(dataWinKeys)
tell window "mainWin"
tell drawer "exifWin"
set contents of text view "dataWinKeys" of scroll view "dataWinKeysScroll" to keywords
i get the following error message
“Can’t set «class scrV» “dataWinKeysScroll” of window “mainWin” to " legs, heels, high heels, pumps, balls, spikes, skirt, black, calves, wood floor, stiletto, strappy, stilettos, alluring, sexy, scandalous”.
Note[Yeah, the file I am pulling EXIF data from is of a woman with phenomenal legs…but its for a medical article, even though the key words make it sound a lot more interesting…;)]
Looks also like a missing reference.
The error message says, the scroll view can’t be set to the string, the text view isn’t mentioned
You’re probably having a reference problem. The best way to reference something is to get the reference for it programatically in ‘awake from nib’. For example using your text view, hook it up to the awake from nib handler in IB. Then use something like this…
on awake from nib theObject
if name of theObject is "dataWinKeys" then
set myTextViewRef to theObject
So myTextViewRef will be the complete reference to the text view. You don’t have to write the drawer, the window, the scroll view etc. In addition, if you move the text view in your interface this method will continue to work without you needing to adjust your code. Once done you can use it like this…
set contents of myTextViewRef to keywords
That’s just clever. Thanks, it worked.