Problem after switching to Xcode 3.0 (unrecognized window object)

Hi All,

After switching to Xcode 3.0, I suddenly had problem with my application that worked with the older version of Xcode.

In my “will open” handler, I have these code snippets:


on will open theObject
try
set objectname to name of theObject as Unicode text
--no problem reading codes in window "main"
 if objectname is"main"then
tell window"main"
--codes inside this tell block are read perfectly; no problem
 end tell
end if

--problem entering and reading the codes in this "if-end if" block
if objectname is "genPrefs" then
--display dialog "I am inside this if block" (Note: this line is not even  read at all)
tell window "genPrefs"
--it follows that the codes inside this tell block aren't read either
end tell
end if
end try
end will open

Is there any particular reason why the codes in the second “if-end if” block above can’t be accessed? Note: The object “genPrefs” is a
preference window that contains tab view and tab view items but the most immediate problem obviously is reading the first line (display
dialog) in the block. I put that line simply for test.

Would appreciate any lead on the above problem.

Many thanks.

archseed :(:frowning:

2 thoughts,

  1. since you have that in a try block is there some error happening somewhere before your if-end if block that’s making it skip over it?
  2. you mention that the genPrefs is a different window from the one that works. So my question is do you have the genPrefs window linked to the “will open” handler and is it linked to the correct applescript? double check on that.

Good luck.

Hi regulus6633,

Thanks for the lead.

I did check the applescript link of my “on will open” handler and that was alright. The problem, as you correctly surmised, was that an error occurred somewhere which led to skipping one “if-end if” block in the handler.

But it was quite strange - single-line code where I set one variable to an integer was not doing its job. It did when I moved it into the property section suggesting that I must have failed to declare that variable before as global. The stranger thing was it was working well before until I switched to Xcode 3.0. I wonder why? Oh well.

archseed