Ok, I'll look into the i/o via JavaScript functions.
That immediately leads to the question of how to obtain a list of available functions and their parameters/formats, etc.

VB - WebBrowser - Page elements - JS functions - Jmol commands ?

I'm a bit fuzzy on the line of events (and exact formats for the functions), since I currently use the first and last (VB and the explicit commands).

** *

Also, what is wrong with using the Page elements (now that I can communicate with them) ?For example, could you simply set up some OUTPUT elements to provide state info or the answer to various queries (or the last question) ?

I see that the tagName may be a group of elements (such as INPUT) rather than a unique name.
So the ID or index is needed to refer to a unique element.
For example I can send a Jmol command via elements 11 (the text) 12 (the button to click), but there is no guarantee that 11 and 12 are stable indices for future versions.Then it would help provide an ID for the button (12).

Michael


On 24/03/2011 06:57, Robert Hanson wrote:
Ah, interesting. What you really need to do is explore whether you can use JavaScript functions on that page and call them from Visual Basic. Here's a link to a possibility:

http://groups.google.com/group/microsoft.public.vb.general.discussion/browse_thread/thread/7c81a612b9fd026e

Looks like:

WebBrowser1.Document.parentWindow.execScript "jmolScript(xxxxx)", "JScript"

Or, possibly, to return a value:

x = WebBrowser1.Document.parentWindow.execScript "jmolEvaluate(xxxxx)", "JScript"


Does that work?

On Wed, Mar 23, 2011 at 9:23 AM, Michael Marden <[email protected] <mailto:[email protected]>> wrote:

    WebBrowser1.Document.All(i).tagNAme
    WebBrowser1.Document.All(i).ID
    WebBrowser1.Document.All(i).Value


This is standard MSIE notation, with capitalization.


    This seems to give unique values, although many elements have no ID.

    For my set up in VB6, I see

    _index tagNameid_
    0HTML
    1 HEAD
    2 TITLE
    3 SCRIPT jmolcmd
    4 SCRIPT
    5 SCRIPT
    6 BODY
    7 SCRIPT
    8 OBJECT jmolApplet0
    9 BR
    10 SPAN span_jmolCmd0
    11 INPUT jmolCmd0
    12 INPUT
    13 BR
    14 INPUT msg
    15(error)



These are just the elements of your page. These days, we use the ID field for addressing specific elements. the NAME field is also useful in that it groups radio buttons. (Can't think of anything else it is useful for.)


    So, for example, I can send commands with:

    WebBrowser1.Document.All(11).Value = "select9 ; wireframe 80 ;
    color yellow ; spacefill 300"
    WebBrowser1.Document.All(12).Click


Certainly that is one way to do it. Still a hack, though.


    This seems good so far, but there are some obvious questions.
    1)Are the names and numbers (index) subject to change in future
    versions of Jmol ?


These names and numbers are just based on that particular web page you have loaded. You get to decide what you have there.

    2)Is this the best way to go ?


I think so.

    3)What name or index are to be used to obtain state information?
    For turning the spin on and off, it would help to know its current
    state.


Yes, hmm. I think you will have to have a JavaScript function on the page that runs jmolEvaluate and then returns a value to VB


    In conclusion, these first results are encouraging, but it was
    done somewhat blindly.
    To be continued.

    Michael Marden
    INSERM U779
    Hopital de Bicetre / Bat. Broca, Niveau 3
    University Paris 11
    78 rue du General Leclerc
    94275 Le Kremlin-Bicetre / France
    Tel: (Int. code + 33 1) 49 59 56 63
    <tel:%2B%2033%201%29%2049%2059%2056%2063>  Fax: -61
    E-mail: [email protected] <mailto:[email protected]>


    
------------------------------------------------------------------------------
    Enable your software for Intel(R) Active Management Technology to
    meet the
    growing manageability and security demands of your customers.
    Businesses
    are taking advantage of Intel(R) vPro (TM) technology - will your
    software
    be a part of the solution? Download the Intel(R) Manageability Checker
    today! http://p.sf.net/sfu/intel-dev2devmar
    _______________________________________________
    Jmol-users mailing list
    [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/jmol-users




--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar


_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to