2011-03-20 12:45 UTC
Okay, so I've figured out a fairly easy way of sending commands from autocad directly to an html interface by changing the url to something like
javascript:my_command()
however I'm not sure how I'd go about calling an autocad command from javascript on the html page.
For anyone else attempting this the best method I've got so far is to send a command to the window via the syntax above and then use the html page's title attr to communicate back with autocad, basically
1. autocad sends command to html window via the syntax above
2. html window sets title to "received"
3. autocad loops waiting for the title to change to something other than "received", e.g. "done" or command line code to run
4. autocad sends a "javascript:recieved()" message after it detects the above change
5. html sets window title back to "waiting"
but this won't allow me to initiate an action by a user clicking on a button the html page(only works if autocad initiates the communication), is there a way I can setup an event handler to detect changes to the title field or some ActiveX snippet that would allow the javascript -> autocad communication?
Thanks.
javascript:my_command()
however I'm not sure how I'd go about calling an autocad command from javascript on the html page.
For anyone else attempting this the best method I've got so far is to send a command to the window via the syntax above and then use the html page's title attr to communicate back with autocad, basically
1. autocad sends command to html window via the syntax above
2. html window sets title to "received"
3. autocad loops waiting for the title to change to something other than "received", e.g. "done" or command line code to run
4. autocad sends a "javascript:recieved()" message after it detects the above change
5. html sets window title back to "waiting"
but this won't allow me to initiate an action by a user clicking on a button the html page(only works if autocad initiates the communication), is there a way I can setup an event handler to detect changes to the title field or some ActiveX snippet that would allow the javascript -> autocad communication?
Thanks.