Jump to content

Import data into canvas (ie.au3)


Morik
 Share

Recommended Posts

Hi, everyone!

I'm making automatic function tests for my web-site. I have there <iframe> with content, like here. I'd like to simulate left mouse click there and pasting of this data:

Spoiler

<cml><MDocument><MChemicalStruct><molecule molID="m1"><atomArray><atom id="a1" elementType="C" x2="-1.958426666665918" y2="1.165093321012586"/><atom id="a2" elementType="C" x2="-3.2919733226642123" y2="0.39509332717258694"/><atom id="a3" elementType="C" x2="-3.2919733226642123" y2="-1.145093327172587"/><atom id="a4" elementType="C" x2="-1.958426666665918" y2="-1.915093321012587"/><atom id="a5" elementType="C" x2="-0.6246933440024536" y2="-1.145093327172587"/><atom id="a6" elementType="C" x2="-0.6246933440024536" y2="0.39509332717258694"/><atom id="a7" elementType="C" x2="-4.756475622357591" y2="0.8710857706922682"/><atom id="a8" elementType="C" x2="-5.6617938117211795" y2="-0.3747067232897079"/><atom id="a9" elementType="N" x2="-4.756723285285446" y2="-1.6206038846117412" lonePair="1"/></atomArray><bondArray><bond atomRefs2="a1 a2" order="2" id="b1"/><bond atomRefs2="a2 a3" order="1" id="b2"/><bond atomRefs2="a3 a4" order="2" id="b3"/><bond atomRefs2="a4 a5" order="1" id="b4"/><bond atomRefs2="a5 a6" order="2" id="b5"/><bond atomRefs2="a6 a1" order="1" id="b6"/><bond atomRefs2="a7 a8" order="2" id="b7"/><bond atomRefs2="a2 a7" order="1" id="b8"/><bond atomRefs2="a8 a9" order="1" id="b9"/><bond atomRefs2="a3 a9" order="1" id="b10"/></bondArray></molecule></MChemicalStruct><MElectronContainer occupation="0 0" radical="0" id="o1"><MElectron atomRefs="m1.a9" difLoc="0.0 0.0 0.0"/><MElectron atomRefs="m1.a9" difLoc="0.0 0.0 0.0"/></MElectronContainer></MDocument></cml>

This code is working preaty fine:

#include <IE.au3>

main()

func main()
local $sQuery = "<cml><MDocument><MChemicalStruct><molecule molID=""m1""><atomArray><atom id=""a1"" elementType=""C"" x2=""-1.958426666665918"" y2=""1.165093321012586""/><atom id=""a2"" elementType=""C"" x2=""-3.2919733226642123"" y2=""0.39509332717258694""/><atom id=""a3"" elementType=""C"" x2=""-3.2919733226642123"" y2=""-1.145093327172587""/><atom id=""a4"" elementType=""C"" x2=""-1.958426666665918"" y2=""-1.915093321012587""/><atom id=""a5"" elementType=""C"" x2=""-0.6246933440024536"" y2=""-1.145093327172587""/><atom id=""a6"" elementType=""C"" x2=""-0.6246933440024536"" y2=""0.39509332717258694""/><atom id=""a7"" elementType=""C"" x2=""-4.756475622357591"" y2=""0.8710857706922682""/><atom id=""a8"" elementType=""C"" x2=""-5.6617938117211795"" y2=""-0.3747067232897079""/><atom id=""a9"" elementType=""N"" x2=""-4.756723285285446"" y2=""-1.6206038846117412"" lonePair=""1""/></atomArray><bondArray><bond atomRefs2=""a1 a2"" order=""2"" id=""b1""/><bond atomRefs2=""a2 a3"" order=""1"" id=""b2""/><bond atomRefs2=""a3 a4"" order=""2"" id=""b3""/><bond atomRefs2=""a4 a5"" order=""1"" id=""b4""/><bond atomRefs2=""a5 a6"" order=""2"" id=""b5""/><bond atomRefs2=""a6 a1"" order=""1"" id=""b6""/><bond atomRefs2=""a7 a8"" order=""2"" id=""b7""/><bond atomRefs2=""a2 a7"" order=""1"" id=""b8""/><bond atomRefs2=""a8 a9"" order=""1"" id=""b9""/><bond atomRefs2=""a3 a9"" order=""1"" id=""b10""/></bondArray></molecule></MChemicalStruct><MElectronContainer occupation=""0 0"" radical=""0"" id=""o1""><MElectron atomRefs=""m1.a9"" difLoc=""0.0 0.0 0.0""/><MElectron atomRefs=""m1.a9"" difLoc=""0.0 0.0 0.0""/></MElectronContainer></MDocument></cml>"
local $oIE = _IECreate ()
_IENavigate ($oIE, "https://marvinjs-demo.chemaxon.com/latest/demo.html", 0)
_IELoadWait($oIE)
MouseClick("left", 403, 572, 1, 1)
ClipPut($sQuery)
send("^v")
MouseClick("left", 403, 572, 1, 1)
;Some other stuff to do
endfunc

But i'd like to avoid using of mouse in tests.

As I understand, data is somehow imported to this <canvas> object, but I haven't found any SendToObject() methods in ie.au3 documentation.

<canvas width="1198" height="914" class="mjs-canvas" id="canvas" tabindex="0" style="width: 1198px; height: 914px;"></canvas>

How should I better solve this issue. And how should be changed solution for <iframe> case?

Thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...