“System Events” behaves differently when run in different ways… why?

I have run into another instance of inconsistency with “System Events”, this time in depending on how I execute a script which calls on “System Events”. From one script menu, everything is fine; from the other menu, the script returns an error… an example script is as follows:

if application "iTunes" is not running then error number -128
tell application "iTunes" to set Visibility to visible of window "iTunes"
if not Visibility then tell application "System Events" to tell application process "iTunes"
	set frontmost to true
	tell menu item "iTunes" of menu "Window" of menu bar item "Window" of menu bar 1
		if not enabled then error number -128
		click
	end tell
end tell
tell application "iTunes" to if not (visible of window "iTunes") then error number -128
tell application "iTunes" to tell front browser window to set {WindowName, PlaylistName} to {name, view's name}
tell application "System Events" to tell application process "iTunes" to tell window WindowName to tell (first scroll area whose description = PlaylistName) to set {{x, y}, {w, h}} to {position, size}
return display dialog (("{" & (join {x, y, x + w, y + h} using ", ") & "}") as text)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
If run in the following ways, the the script works:
✓ if the script is run [⌘-R] directly from within “Script Debugger 4.5”
✓ if the script is run [⌘-R] directly from within “AppleScript Editor”
✓ if the script is run [⌘-R] directly from within “Smile”
✓ if the script is run [⌘-R] directly from within “Spark” or by setting a hotkey run the script (entire script is pasted into the script entry box)
✓ if the file is executed indirectly by “Spark” after setting a hotkey to execute the script file
✓ if the file is executed from the system’s script menu (top right of the menu bar near Spotlight’s search, the date, and anything else you may have there)
✓ if the file is executed from the “Terminal” with osascript (with these two words removed: display dialog)
✓ if the script is saved as an application bundle and then launched in any manner, including from the application’s script menu
✓ using an agent to launch the script directly. The content of the agent is:

set TestScript to alias "Aesthir:Users:aesthir:Library:iTunes:Scripts:TestScript.scpt"
return run script TestScript

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
If run in any of these ways, the the script doesn’t work:
྾ if the file is executed from the application’s script menu (centered in the menu bar next to the “Help” menu)
¢ not every application has this type of script menu, but “iTunes” can if you want it
྾ if the file is executed by pressing a hotkey set by the system’s “Keyboard” settings
྾ if the file is executed by pressing a hotkey set by “Spark” to select the menu item “TestScript”
྾ using an agent to launch the script indirectly. The content of the agent is:

tell application "System Events" to tell application process "iTunes" to return click menu item "TestScript" of menu "Scripts" of menu bar item "Scripts" of menu bar 1

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The wording used in this post refers to different execution methods:
● run: the script is open in some application and its content is directly run (in all cases, using [⌘-R]) from within software capable of performing this task.
● execute: the script file (.scpt) is run by software capable, such as clicking the particular script menu item, using “Spark” (or “Automator”, “Quicksilver”, etc.)
● launch: this word is generally reserved for applications. but I use it here when the “.scpt” file is run by a secondary script launch agent or the “.app” file is opened.
━━━━━━━━━━━━━━━━━━━━━━━━━
Model: iMac 7,1
AppleScript: AppleScript 2.2.1
Browser: Firefox 11.0
Operating System: Mac OS X (10.7)

Aesthir