tell window help

hi,
i’m trying to make a text field (uneditable) which is inside a tab view to display text,
i’ve tried

	tell window "MainWindow"
		set the contents of text field "SourceFolderView" to "Hi"
	end tell

and even

	tell window "MainWindow"
		tell tab view "TabThing"
		set the contents of text field "SourceFolderView" to "Hi"		end tell
	end tell

and i keep on getting this error:

what an i doing wrong? how do i fix this?
thanks in advance, this forum is great!

Usually, you will need target “text field w of tab view item x of tab view y of window z” (or similar).

i tried this

tell window "MainWindow"
		set the contents of text field "SourceFolderView" of tab view item "BuildAlbumTab" of tab view "TabThing" of window "MainWindow" to ("hi" as string) -- (LastImageFolder of prefs as string)
	end tell

got this error

ok, i figured out the second error, i set it to window “mainwindow” of window “mainwindow”, which doesn’t exist. when deletdint the second window “mainwindow” i get the first error again. any ideas?

try

set the contents of text field "SourceFolderView" of window "mainWindow" to "hi"

or

tell window "MainWindow"
       set the contents of text field "SourceFolderView" of view of tab view item "BuildAlbumTab" of tab view "TabThing" to "hi" -- (LastImageFolder of prefs as string)
   end tell

none of those worked :frowning:
i tried this

tell window tab view item "BuildAlbumTab" of tab view "TabThing" of window "MainWindow"
		set contents of text field "SourceFolderView" to "hi" --of tab view item "BuildAlbumTab" of tab view "TabThing" to "hi" -- (LastImageFolder of prefs as string)
	end tell

and i get this error

STUPID ME!!! :stuck_out_tongue:
i did “tell window tab view” :smiley:
did this:

tell tab view item "BuildAlbumTab" of tab view "TabThing" of window "MainWindow"
       set contents of text field "SourceFolderView" to "hi" --of tab view item "BuildAlbumTab" of tab view "TabThing" to "hi" -- (LastImageFolder of prefs as string)
   end tell

its working!

another question, (sorry about spamming this forum, there aren’t any books on applescript studio)
how do i set the contents of a popup button to a list of items? like lets say the list is {“1”,“2”,“3”} how do i get the popup buttons options to be 1, 2 and 3?