Open IE with multiple tabs

2019-03-02 09:56发布

问题:

I'm trying to create an AutoHotkey script that can be added to the Startup folder, to open IE with multiple predetermined tabs. I have several websites at work that I use regularly, & I want to have IE automatically open when I first login with these pages loaded. I've searched & found a few AHKs which I've tried to alter for my needs, but I receive errors with them. Here is the code I'm trying to use:

Pwb :=  COM_CreateObject ("InternetExplorer.Application")
Pwb.Visible:=True
Pwb.Navigate("https://*****.org/***/") 
Pwb.Navigate2("https://*****", 2048)
Pwb.Navigate3("http://*****", 2048)
Pwb.Navigate4("http://*****", 2048)
Pwb.Navigate5("*****", 2048)
Pwb.Navigate6("*****", 2048)
Return

When I launch this I receive error "The following variable name contains an illegal character: "Pwb.Visible" The program will exit." If I try to just delete that part of the code, I then get errors on my websites: "Error: Call to nonexistent function. Specifically: Pwb.Navigate("https://.org/**/") The program will exit."

回答1:

Try this. Make sure you have the latest version of AutoHotkey (v1.1+). COM_CreateObject() should be ComObjCreate() and there are no Navigate3, Navigate4, or Navigate5... methods available in that object.

Pwb :=  ComObjCreate("InternetExplorer.Application")
Pwb.Visible:=True
Pwb.Navigate("http://www.google.com") 
Pwb.Navigate("http://stackoverflow.com", 2048)
Pwb.Navigate("http://news.google.com", 2048)
Pwb.Navigate("https://www.quora.com/", 2048)
Return