AS Studio problem with text window

Hi

I’ve been mucking about with appleScript Studion via xcode today and trying to get the following to happen.

What I want is a text or similar field to have word wrap and a scroll bar I need to dump a list into this thing occasionaly I may have a long line of text.

I have a basic Applesctipt based application

I have a main window called “winda”
In that I have a scroll view item called “abc”
and with in that I have a text view called “tve”

A button on the same layout fires off the following applescript


on clicked theObject
	set ddd to "ddd;sldkfjas;ldf a;sdlkfjas;ldfkjas;ldfk a;lsdkfja;lskdfjas;ldfj"
	set contents of text view "tve" of scroll view item "abc" of view item "otd" of window "winda" to ddd as text
	end clicked

I am typicaly getting “NSReceiverEvaluationScriptError: 4 (1)”
type errors

Any help, work arounds or other ideas greatly appreciated

Stevea

For reasons I don’t completely understand, I know (think?) that you’ll have to enclose these ‘set’ commands within a ‘tell window “winda”’ block. Or, wait, you’ve also used “item” which isn’t necessary, and what’s “view item “otd””? You didn’t mention that before. A Split View perhaps? Or a Custom view or something? Or a box? Whatever it is, “view item” isn’t the right way to refer to it. If it does indeed contain your scroll view, which contains your text view, then you’ll have to figure out the right way to refer to it. For the following example, I’ll pretend it isn’t there, and that you just have a scroll view (with enclosed text view) sitting inside of a window. So, for instance:

on clicked theObject
   set ddd to "ddd;sldkfjas;ldf a;sdlkfjas;ldfkjas;ldfk a;lsdkfja;lskdfjas;ldfj" as text
   tell window "winda"
      set contents of text view "tve" of scroll view "abc" to ddd
   end tell
end clicked

Or if that “view item “otd”” was a box that contained your scroll view (with enclosed text view) then it’d be like this:

on clicked theObject
   set ddd to "ddd;sldkfjas;ldf a;sdlkfjas;ldfkjas;ldfk a;lsdkfja;lskdfjas;ldfj" as text
   tell window "winda"
      set contents of text view "tve" of scroll view "abc" of box "otd" to ddd
   end tell
end clicked

Hope this helps…

Thanks for your time i’m still getting the old

NSReceiverEvaluationScriptError: 4

I’ll try a re install of Xcode as I’m also getting some weird corruptino things happening (2 projects died … like you cant even open main menu nibs in IB)

Thanks

Steve

I don’t recognize the ‘of view item “otd”’ reference you’re making, either. And, see no need for the ‘as text’. It’s the only thing that I see hasn’t changed so far, so that’s probably the problem generating the errors.

Try…

on clicked theObject
	if name of theObject is "theButton" then -- Insert the applescript name of your button
		set ddd to "ddd;sldkfjas;ldf a;sdlkfjas;ldfkjas;ldfk a;lsdkfja;lskdfjas;ldfj"
		set contents of text view "tve" of scroll view "abc" of window "winda" to ddd
	end if
end clicked

j

Thank you all very much this seems to have sorted it


	tell window "OTDT"
		path to Scroll view/ texview object 
	end tel

Steve A