Static text reference for older OSX?

I’m running Xcode 2.1 on 10.4.4 and am trying to target some 10.3.9 machines. I have some static text in a window (produced by dragging “System Font Text” from the IB control palette window) which under 10.4.4 I can successfully reference as “text field X”, but when I move it to a 10.3.9 machine this reference gives me an NSReceiverEvaluationScriptError.

If I try “static text X” it won’t compile.

If I try “text X” (which is what UI Browser indicates it is on my 10.4.4 machine) then the 10.3.9 machine gives an NSCannotCreateScriptCommandError.

Also, “control X” gives the NSReceiverEvaluationScriptError, which makes me think that nothing will work, but I’m still holding out hope.

Can anyone tell me how to reference this text in my project so that 10.3.9 will accept it? Or is there some target setting? I’ve been much more of a drain than a contributor in this forum so my apologies but also my sincere thanks.

  • Dan

Until something better comes along:

I notice that on 10.3.9 I can reference all of the controls as control 1, control 2, … Unfortunately I have 216 controls in this window (only a dozen or two are visible at any one time). If I write a little script to record the names of each of these controls I then have a look-up table where text field “lblCustomer” corresponds to control 133, for example.

So, I can get there from here, I just want to find a paved road instead of this ugly path.

  • Dan

Would you please post the actual reference that isn’t working?

Sure. It’s not straightforward though, but here’s an abbreviated version (thanks for taking a look):

-- list of text field names that I want to move downward in the window
-- to make things neat before revealing the window:

property lblNameL : {"lblCustomer", "lblIssue", "lblAdName", "lblSize"}

-- I'm calling a handler to move each of these text fields down a certain number of pixels:

set pxlDistance to 100 -- this is actually determined programatically
repeat with ctlName in lblNameL
	my moveDown(ctlName, pxlDistance)
end repeat

on moveDown(ctlName, pxls)
	tell window "wndDataEntry"
		set bndsL to bounds of text field ctlName -- errors at this point under 10.3.9, but works under Tiger
		set item 2 of bndsL to (item 2 of bndsL) - pxls
		set item 4 of bndsL to (item 4 of bndsL) - pxls
		set bounds of text field ctlName to bndsL
	end tell
end moveDown

First of all, my thanks to MacScripter for hosting my personal blogspace here.

I installed Xcode 2.2.1 this morning since I thought that this could only help. I discovered this in the documentation:

Obviously the answer must lie somewhere in there. However, I haven’t been able to locate these packages. Would they have been automatically installed during the default installation and I just can’t find them? Does anyone have any experience retro-targeting Xcode applications?


  • Dan