AppleScript script command implementation - cocoa

I'm trying to implement a trivial script command, byt have no success..
My sdef file
...
<class name="image" plural="images" code="imag" description="Image class">
<cocoa class="MyImage" />
<property name="width" code="wdth" type="real" access="r" description="The width of the image."/>
<property name="height" code="hght" type="real" access="r" description="The height of the image."/>
<responds-to name="rotate">
<cocoa method="scriptingRotate:"/>
</responds-to>
</class>
<command name="rotate" code="frwkrota" description="Rotate the image.">
<direct-parameter type="image"/>
<parameter name="by" code="by " type="real" description="Degrees to rotate.">
<cocoa key="angle"/>
</parameter>
</command>
...
My dictionary is ok: image responds to rotate and so on..
But
tell application "MyApp"
rotate image 1 by 1
end tell
says that: "Expected end of line but found class name." Where is the mistake?
get image 1 works normally (MyImage have objectSpecifier).
SOLVED
Seems like it was a bug with ScriptEditor..
Restarting ScriptEditor solved the problem.

Related

Why SUMO output different using veins_launchd and without veins_launchd?

First, I use veins_launchd to conect omnet and sumo, the command line is "D:/example_project/veins-5.1/veins-veins-5.1/sumo-launchd.py -vv -c 'D:/Program Files (x86)/Eclipse/bin/sumo.exe' "
The ouput lane data is shown below:
But I want to run SUMO manually, so I modify TraCIScenarioManagerLaunchd to TraCIScenarioManager and use the command line "sumo -c llcd.sumocfg --remote-port 9999", and then waiting for omnet to connected. This approach is inspired by this answer Is there a way to connect multiple TraCI modules to the OMNet++/veins simulation?
But when I run this way, the output result is like this:
Why do simulation results make such a huge difference? I didn't change any other parameters, and the sumo configure file is the same.
some of the parameter setting in omnetpp.ini:
##########################################################
# TraCIScenarioManager parameters #
##########################################################
*.manager.updateInterval = 1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.autoShutdown = false
*.manager.launchConfig = xmldoc("llcd.launchd.xml")
sumo.config:
<configuration>
<input>
<net-file value="D:\FTT\sumo_test\llcd\llcd.net.xml"/>
<route-files value="D:\FTT\sumo_test\llcd\llcd.rou.xml"/>
<additional-files value="D:\FTT\sumo_test\llcd\llcd.add.xml"/>
</input>
<output>
<lanechange-output value="D:\FTT\sumo_test\llcd\llcd.lanechange.xml"/>
<summary-output value="D:\FTT\sumo_test\llcd\output_sumo.xml"/>
</output>
<time>
<begin value="0"/>
<end value="3600"/>
</time>
<processing>
<time-to-teleport value="-1"/>
</processing>
<report>
<no-duration-log value="true"/>
<no-step-log value="true"/>
<no-warnings value="true"/>
</report>
</configuration>
If anyone can give some insights? Thank you in advance!
I figured out the problem. I found veins_launchd will change the configure file of SUMO by adding
<random_number>
<random value="false"/>
<seed value="0"/>
</random_number>

FHIR Snapshot - Base selection

If an element in an SD has a type.profile, from where should the snapshot draw element descriptive information?
Given:
<StructureDefinition>
...
<name value="Acme-Patient" />
<baseDefininition value="http://hl7.org/fhir/StructureDefinition/Patient" />
...
<differential>
<element>
<path value="identifier" />
<type>
<code value="Identifier" />
<profile value="http://example.com/fhir/SD/id-qualified" />
...
</StructureDefinition>
HL7's Patient http://hl7.org/fhir/StructureDefinition/Patient has short:"An identifier for this patient" for Patient.identifier.
Example.com's id-qualified Identifier type has short: "An identifier qualified with a required system."
What should the Acme-Patient snapshot element for Patient.identifier have for its short value?
Before answering, consider that extensions are the more common use case here. The type.profile defines the extension. If from the baseDefinition, all extensions will have short "Additional Content defined by implementations". However, in the above example, the type is much more generic than the base's short.

Whats the applescript syntax for sending arguments?

I'm following apples applescript example for scripting parameters
I can send the direct parameter no problem using the following syntax
tell app "SimpleScriptingVerbs" to do command with args "Im a direct parameter"
However I can't figure out the correct syntax for sending the other optional arguments.
The rest of the accepted optional arguments look like this
<command name="do command with args" code="SVrbAgCm" description="run a command with a bunch of arguments">
<cocoa class="CommandWithArgs"/>
<direct-parameter description="a text parameter passed to the command">
<type type="text"/>
</direct-parameter>
<parameter name="blinking" code="savo" type="boolean" optional="yes"
description="a boolean parameter.">
<cocoa key="SaveOptions"/>
</parameter>
<parameter name="preferred hand" code="LRnd" type="preferredhands" optional="yes"
description="a parameter using our enumeration.">
<cocoa key="TheHand"/>
</parameter>
<parameter name="prose" code="Pros" type="text" optional="yes"
description="a text parameter.">
<cocoa key="ProseText"/>
</parameter>
<parameter name="ivalue" code="iVal" type="integer" optional="yes"
description="an integer parameter.">
<cocoa key="IntegerValue"/>
</parameter>
<parameter name="rvalue" code="rVal" type="real" optional="yes"
description="an real number parameter.">
<cocoa key="RealValue"/>
</parameter>
<result type="text" description="the direct parameter enclosed in quotes"/>
</command>
What's the correct applescript syntax to send the rest of these arguments.
You must use a parameter's name with a value, like this:
tell application "SimpleScriptingVerbs" to do command with args "Something" prose "bla 1" preferred hand Left Hand ivalue 299 rvalue 75.777
The application logs -->
proc=-[CommandWithArgs performDefaultImplementation] The other parameters are: '{
"" = Something;
IntegerValue = 299;
ProseText = "bla 1";
RealValue = "75.777";
TheHand = 1279816302;
}'

How to access XML parameters conditionally

This is a XML code snippet:
<testcase name="T.3.03.02">
<cmd>CMD_EXPORT_RAM_KEY</cmd>
<sreg_pre>40</sreg_pre>
<sreg_pre_bitmask>ff</sreg_pre_bitmask>
<sreg_post>40</sreg_post>
<sreg_post_bitmask>ff</sreg_post_bitmask>
<erc>ERC_NO_ERROR</erc>
<testvector>
<parameter name="UID" type="info">000000000000000000000000000002</parameter>
<parameter name="UID'" type="info">000000000000000000000000000002</parameter>
<parameter name="KeyId" type="info">0e</parameter>
<parameter name="Key" type="info">0f0e0d0c0b0a09080706050403020100</parameter>
<parameter name="AuthId" type="info">00</parameter>
<parameter name="KeyAuth" type="info">2b7e151628aed2a6abf7158809cf4f3c</parameter>
<parameter name="Old counter value of updated key slot" type="info">0000000</parameter>
<parameter name="New counter value C'" type="info">0000000</parameter>
<parameter name="Protection flags F'" type="info">00</parameter>
<parameter name="M1" type="output">000000000000000000000000000002e0</parameter>
<parameter name="M2" type="output">152876f29dc7ca8d18e38d70374492b05d908c8c584a0409849a553c75254def</parameter>
<parameter name="M3" type="output">bc6e79bc4458339174fc80fb08b83188</parameter>
<parameter name="M4" type="output">000000000000000000000000000002e07783b86ae87b87e3ca12809c2df75fae</parameter>
<parameter name="M5" type="output">c8fcc8859c69c8bd840ce8e24c5114e9</parameter>
</testvector>
<precondition>RAM_KEY_PLAIN = 1; RAM_KEY_EMPTY = 0</precondition>
<description>Export plain RAM_KEY with external debugger attached; Note: The security flags SECURE_BOOT_PROTECTION and DEBUGGER_PROTECTION of the key SECRET_KEY are inherited from MASTER_ECU_KEY.</description>
</testcase>
I want to access all "parameter name="Key" type="info" values.
How do I access these values conditionally if the condition <cmd>CMD_EXPORT_RAM_KEY(second line in XML)</cmd> is valid.
In this XML file there are also other commands (<cmd> lines) also with the "Key" parameter,
but in these cases I don't want to get the key-values.
I didn't get it running.
Can anyone help me with some ideas?
Would something like this work?
doc = Nokogiri::parse(File.read( "data.xml" ))
check = doc.xpath( "//cmd" ).select{|el| el.children[0].text == "CMD_EXPORT_RAM_KEY" }
puts "Check: %i" % check.size
if(check.size == 0)
## Do stuff here
end
Try the below XPath with Nokogiri:
//testcase/cmd[text()='CMD_EXPORT_RAM_KEY']/../testvector/parameter[#name="Key" and #type="info"]
Of course, you can parameterize the CMD_EXPORT_RAM_KEY and #name/#type values.
The trick is to locate the specific ones you want using a selector, then narrow down further if necessary.
Using the CSS selector 'parameter[#name="Key"][#type="info"]' Nokogiri easily finds the single occurrence in your sample. If there were more, then more would be returned:
require 'nokogiri'
doc = Nokogiri::XML(<<EOT)
<testcase name="T.3.03.02">
<testvector>
<parameter name="UID" type="info">000000000000000000000000000002</parameter>
<parameter name="Key" type="info">0f0e0d0c0b0a09080706050403020100</parameter>
</testvector>
</testcase>
EOT
doc.search('parameter[#name="Key"][#type="info"]').map(&:content)
# => ["0f0e0d0c0b0a09080706050403020100"]
I used CSS because it looks less like line noise than the equivalent XPath selector would.
Also, when supplying sample data, reduce it to the bare minimum necessary to test the code. Anything beyond that wastes our time, and, if it's too much, can actually cause you to get no answers because nobody wants to wade through that.

Get children and subchildren together?

I am using lxml library in python and I am working with xpath.I have a an xml file example as follows:
<Root>
<Child1 name="child1">
<Child2 name="child2" />
</Child1>
<Child3 name="child3">
<Child4 name="child4" />
</Child3>
<Child5 name="child5" />
</Root>
i need to know if there is a way to get all children at once like child1,child2,child3,child4 at once... currently I am able to get only child1, child3, child5 using root.xpath('node()')

Resources