The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle Extras (http://forums.omnigroup.com/forumdisplay.php?f=7)
-   -   How do I test a property value in Applescript? (http://forums.omnigroup.com/showthread.php?t=23309)

Simon Knight 2012-01-26 05:35 AM

How do I test a property value in Applescript?
 
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[/CODE]

best wishes
Simon

RobTrew 2012-01-26 07:21 AM

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[/CODE]

or even just

[CODE]tell self
set collapsed to not collapsed
end tell[/CODE]

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 [B]Help > Send Feedback[/B] ?

RobTrew 2012-01-26 07:26 AM

Analogous to [URL="http://forums.omnigroup.com/showthread.php?t=10992"]this issue[/URL], perhaps ?

Simon Knight 2012-01-26 08:18 AM

Thanks for the code.I have sent an email reporting the strange behaviour which also occurs in the editing mode.

best wishes

Simon

RobTrew 2012-01-26 10:11 PM

[QUOTE=Simon Knight;106589]Thanks for the code.I have sent an email reporting the strange behaviour which also occurs in the editing mode.[/QUOTE]

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 :-)
[INDENT][I]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.[/I][/INDENT]
Entering infinite loop territory here ...

[COLOR="White"]--[/COLOR]

DerekAsirvadem 2012-03-15 06:40 PM

Have you tried that (named) forum ?

RobTrew 2012-03-16 12:46 AM

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 :-)


All times are GMT -8. The time now is 01:42 PM.

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