Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

running COM commands on vista


  • Please log in to reply
2 replies to this topic
panayotis
  • Guests
  • Last active:
  • Joined: --
hello there

I am trying to enter gmail mailbox , I have done it succesfully on windows XP on the machine in my workplace, but encountered problems when I tried to run it on VISTA on my home PC.


I tried some ways, I took the script as is from tanks suggestion at http://www.autohotke... ... b document

for making things easier let's say i am trying this one:

sUrl := "http://www.gmail.com"
Name := "UserName"
PW := "Password"

COM_Init()
pweb := COM_CreateObject("InternetExplorer.Application")
COM_Invoke(pweb, "Visible", True)
COM_Invoke(pweb, "Navigate2", sUrl)

While, COM_Invoke(pweb, "ReadyState") <> 4 ; While, COM_Invoke(pweb, "Busy")
Sleep, 10

COM_Invoke(pweb, "document.all.Email.Value", Name)
COM_Invoke(pweb, "document.all.Passwd.Value", PW)
COM_Invoke(pweb, "document.all.signIn.click")

COM_Invoke(pweb, "Navigate2", sUrl2, 0x0800) ; 0x0800 parameter causes this webpage to be opened in a new tab

COM_Release(pweb) ; releases "pweb" - COM Object
COM_Term() ; terminates COM environment
Return




regarding this, I have two problems :

1. it seems that two Internet explorer windows are opened, one is blank and the other gmail, then the scripts stuck , I get messagebox concerening the "readystate" function which seems unautorized.
anyway, I can get over this , If I cancel the following line :
COM_Invoke(pweb, "Visible", True)

then one gmail webpage is loaded withouth stucking the script. and that's get me to the next problem:

2. the username & password isn't filled . seems there is a problem with the line : COM_Invoke(pweb, "document.all.Email.Value", Name)
running on vista. I have tried it on other websites and got the same results.


appreciate any help

[ Moderator!: Moved from Scripts and Functions ]

jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
This is a shot in the dark, especially since I'm not familiar with Vista. Try opening the Windows Task Manager and closing all the iexplore.exe processes before you run this code, and then see if you get the same results.

NOTE - in the future, please include code tags around the code you post :wink:

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
Firstly kindly use code tags
sUrl := "http://www.gmail.com" 
Name := "UserName" 
PW := "Password" 

COM_Init() 
pweb := COM_CreateObject("InternetExplorer.Application") 
COM_Invoke(pweb, "Visible", True) 
COM_Invoke(pweb, "Navigate2", sUrl) 

[color=red]While, !pdoc:=COM_Invoke(pweb, "document") 
Sleep, 10 
COM_Release(pdoc)[/color]

While, COM_Invoke(pweb, "ReadyState") <> 4 ; While, COM_Invoke(pweb, "Busy") 
Sleep, 10 

COM_Invoke(pweb, "document.all.Email.Value", Name) 
COM_Invoke(pweb, "document.all.Passwd.Value", PW) 
COM_Invoke(pweb, "document.all.signIn.click") 


; im a little confused here why are we opening a tab and what is sUrl2
COM_Invoke(pweb, "Navigate2", sUrl2, 0x0800) ; 0x0800 parameter causes this webpage to be opened in a new tab 

COM_Release(pweb) ; releases "pweb" - COM Object 
COM_Term() ; terminates COM environment 
Return
there are other methods that work here that are avail but the change i inserted should make most of this work
Never lose.
WIN or LEARN.