DWF Viewer (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API access from HTML pages using VBScript or Javascript

3 REPLIES 3
Reply
Message 1 of 4
heinrich
299 Views, 3 Replies

API access from HTML pages using VBScript or Javascript

Hi,

I am new to Autodesk Express Viewer (AEV) and previously used Whip to display and control drawings in HTML pages. I had written some very simple functions in Javascript to read e.g. drawing extents. Looking at the AEV interface I find a problem since some procedures are called by reference to return something. I would have to call a procedure with a pointer as parameter which is impossible in Javascript.

Unfortuntely, I am not familiar with VBScript. Can it be done with it? The example below explains the problem:
This piece of code should react to a mouse movement over a hyperlink. The corresponding interface function of AEV is defined as

HRESULT OnOverURL (int nX, int nY, IDispatch *pLink, IDispatch *pHandled)
The drawing is embedded into Internet Explorer using the following code:








The result is that the Message Box pops up, i.e. the event is trapped correctly. I can also access the x,y position. The "IDispatch.Show" call (without parameter) also works and changes link color. However, the call "IDispatch.Count( cnt )" produces an error: "Wrong number of arguments or invalid property assignment". Obviously this is because this procedure expects a call-by-reference to return a result. Can this be done using VBScript of even Javascript? Who knows a solution or the correct syntax. Thank you for your help!

Heinrich
3 REPLIES 3
Message 2 of 4
heinrich
in reply to: heinrich

Sorry for the confusion:

The post window swallowed the included HTML code which explains the problem. Here it comes as a comment. I hope this will upload!

Message 3 of 4
heinrich
in reply to: heinrich

Still does not work. Now as a plain text/comment:

Message 4 of 4
Anonymous
in reply to: heinrich

Hi Heinrich,

 

first off, sorry that our API documentation is a
bit on the terse side right now but we are currently working on a more polished
version and hopefully it will be posted soon. In the mean time, attached is a
sample HTML page and drawing which demonstrates
catching the OnOverURL event from VBScript. In this case, when you cruise over
geometry all of which has links, a dialog will pop up displaying the number of
URLs attached to that particular hyperlink. Note that the event handler is
responding that the event has been handled thereby preventing if from being
"clickable". Also note that if you remove this particular event handler, there
is also an example of an OnExecuteURL event handler.

 

Lastly, you should be able to access the API from
either VBScript or Javascript equally as well. The only API for which this is
not true is our "TransformPoint" method which only works in VBScript (Javascript
stores arrays in a completely different manor than VBScript). However you can
also call VBScript methods from Javascript and visa versa so this shouldn't be
too much of a problem.

 

Hope this helps and let me know if there are any
specifics you want me to explain in a little more detail (again, since the more
detailed API doc is not yet available).

 

Larry


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,

I am new to Autodesk Express Viewer (AEV) and previously used Whip to
display and control drawings in HTML pages. I had written some very simple
functions in Javascript to read e.g. drawing extents. Looking at the AEV
interface I find a problem since some procedures are called by reference to
return something. I would have to call a procedure with a pointer as parameter
which is impossible in Javascript.

Unfortuntely, I am not familiar with VBScript. Can it be done with it? The
example below explains the problem:
This piece of code should react to a
mouse movement over a hyperlink. The corresponding interface function of AEV
is defined as

HRESULT OnOverURL (int nX, int nY, IDispatch *pLink, IDispatch *pHandled)

The drawing is embedded into Internet Explorer using the following code:



clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF AEview>

  
  




The result is that the Message Box pops up, i.e. the event is trapped
correctly. I can also access the x,y position. The "IDispatch.Show" call
(without parameter) also works and changes link color. However, the call
"IDispatch.Count( cnt )" produces an error: "Wrong number of arguments or
invalid property assignment". Obviously this is because this procedure expects
a call-by-reference to return a result. Can this be done using VBScript of
even Javascript? Who knows a solution or the correct syntax. Thank you for
your help!

Heinrich

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report