Internet Explorer, COM+, Javascript and Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ishpeck

    Internet Explorer, COM+, Javascript and Python

    I need to make IE execute javascript in a web page with COM+ and
    Python.

    Similarly to the way they do it in this article. . .



  • Roger Upole

    #2
    Re: Internet Explorer, COM+, Javascript and Python

    Something like this should be close:

    import win32com.client , pythoncom
    ie=win32com.cli ent.Dispatch('i nternetexplorer .application')
    ie.Visible=1
    ie.Navigate('so mepagewithjavas cript.html')
    id=ie.Document. Script._oleobj_ .GetIDsOfNames( 'somejsfunction ')
    res=ie.Document .Script._oleobj _.Invoke(id, 0, pythoncom.DISPA TCH_METHOD,
    True, <parameter or tuple of parameters> )

    hth
    Roger


    "Ishpeck" <ishpeck@gmail. com> wrote in message
    news:1114609311 .916761.272980@ f14g2000cwb.goo glegroups.com.. .[color=blue]
    >I need to make IE execute javascript in a web page with COM+ and
    > Python.
    >
    > Similarly to the way they do it in this article. . .
    >
    > http://www.codeproject.com/com/jscalls.asp
    >[/color]



    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

    Comment

    • J Correia

      #3
      Re: Internet Explorer, COM+, Javascript and Python


      "Roger Upole" <rupole@hotmail .com> wrote in message
      news:4270c6ed$1 _2@127.0.0.1...[color=blue]
      > Something like this should be close:
      >
      > import win32com.client , pythoncom
      > ie=win32com.cli ent.Dispatch('i nternetexplorer .application')
      > ie.Visible=1
      > ie.Navigate('so mepagewithjavas cript.html')
      > id=ie.Document. Script._oleobj_ .GetIDsOfNames( 'somejsfunction ')
      > res=ie.Document .Script._oleobj _.Invoke(id, 0, pythoncom.DISPA TCH_METHOD,
      > True, <parameter or tuple of parameters> )
      >
      > hth
      > Roger[/color]

      Yes, that definitely works. Only one minor correction: it seems that to
      pass multiple parameters you need to pass them sequentially seperated by
      commas instead of in a tuple, i.e.
      res=ie.Document .Script._oleobj _.Invoke(id, 0, pythoncom.DISPA TCH_METHOD,
      True, param1, param2, param3, ......... )

      Useful test sitefor above code:


      HTH,
      [color=blue]
      >
      >
      > "Ishpeck" <ishpeck@gmail. com> wrote in message
      > news:1114609311 .916761.272980@ f14g2000cwb.goo glegroups.com.. .[color=green]
      > >I need to make IE execute javascript in a web page with COM+ and
      > > Python.
      > >
      > > Similarly to the way they do it in this article. . .
      > >
      > > http://www.codeproject.com/com/jscalls.asp
      > >[/color]
      >
      >
      >
      > ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet[/color]
      News==----[color=blue]
      > http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+[/color]
      Newsgroups[color=blue]
      > ----= East and West-Coast Server Farms - Total Privacy via Encryption[/color]
      =----



      Comment

      • dannyguindi

        #4
        Re: COM+, Javascript and Python

        Do you guys know if there is a way to do this in Linux?
        Thanks.

        Danny

        Comment

        • Peter Hansen

          #5
          Re: COM+, Javascript and Python

          dannyguindi wrote:[color=blue]
          > Do you guys know if there is a way to do this in Linux?[/color]

          What is "this"? Your subject line provides a context, but not a problem
          to which we can give you the solution. Please be specific.

          -Peter

          Comment

          Working...