The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
How do I test a property value in Applescript? Thread Tools Search this Thread Display Modes
Hi,
I'm attempting to write an applescript to sit in a subgraph object. the aim of the script is to toggle the state of the subgraph. I am failing to get my if statement to work and have tried all sorts of incorrect syntax. Please correct my code


Code:
tell application "OmniGraffle Professional 5"
	tell canvas of front window
		set theProps to (get the properties of subgraph -1)
		
		if theProps(collapsed) then
			--display dialog "I'm Collapsed"

			--else

			--display dialog "I'm Expanded"
			
		end if
		
		--set properties of subgraph -1 to {collapsed:true}
	end tell
end tell
best wishes
Simon
 
I think in theory you should be able to use something like this:

Code:
tell application id "OGfl"
	tell self
		set blnCollapsed to ((collapsed) as boolean)
		set collapsed to not blnCollapsed
	end tell
end tell
or even just

Code:
tell self
	set collapsed to not collapsed
end tell
but I notice that an error message is generated in Presentation mode, though it seems to work from the Run Script button of the Action inspector.

A case for Help > Send Feedback ?
 
Analogous to this issue, perhaps ?
 
Thanks for the code.I have sent an email reporting the strange behaviour which also occurs in the editing mode.

best wishes

Simon
 
Quote:
Originally Posted by Simon Knight View Post
Thanks for the code.I have sent an email reporting the strange behaviour which also occurs in the editing mode.
Good luck ! I also attempted to report the bug,
(which boils down, I think, to the fact that well-formed scripts which compile and run in the Action inspector dialog may fail to resolve references in Edit or Presentation mode) but the response was a "proceed to self-service" message :-)
Currently, we are unable to assist in troubleshooting custom scripting. That said, if you post your script question within the "AppleScripting Omni Apps" forum you should be able to find help from other folks in the dev community.
Entering infinite loop territory here ...

--

Last edited by RobTrew; 2012-01-27 at 09:53 PM..
 
No need - it's a bug, now acknowledged and recorded.

(The bug-reporting process just needed a slightly more vigorous prod - we all have those moments :-)
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access "Wrap To Shape" property from Applescript? Sophie OmniGraffle General 12 2013-01-19 08:50 PM
Property Layout CaseyH OmniGraffle General 3 2011-03-02 06:35 PM
Can't TYpe in Property Fields joelande OmniGraffle General 0 2010-11-08 08:04 AM
Applescript error: reading the property list of non-inbox tasks RobTrew OmniFocus Extras 1 2008-01-13 11:33 PM


All times are GMT -8. The time now is 07:55 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.