Jump to content

Any way to use ShellExecute to open a url in a NEW window instead of tabs?


CrewXp
 Share

Recommended Posts

Hey, I'm trying to use ShellExecute to open a web-link in a new window instead of adding it on to my current browser's list of tabs, but I think the ability isn't really there...

I haven't gone into creating objects in autoit or calling libraries, but I think it might be necessary to get autoit to do what I'm trying to do.

Does anyone have any ideas? Maybe somehow using objcreate to add an additional msdn parameter to get it to open in a new window?

Or maybe using DllCall to create a new process of my browser, then using shellexecute (stupid theory).

I know this works as a alternative to ShellExecute:

$shell=ObjCreate("Shell.Application")

$shell.ShellExecute('"http://www.google.com"')

But I don't know how to add additional parameters.

Here's MSDN's reference page to ShellExecute:

http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

I read using SW_SHOWNORMAL flag with ShellExecute works, but I have no clue on how to use ObjCreate to add that flag.

Example: ShellExecute(NULL,"c:\\program files\\internet explorer\iexplore.exe", NULL, SW_SHOWNORMAL)

Thanks, hopefully this can shed some light and teach me how to apply msdn references to ObjCreate in autoit.

Link to comment
Share on other sites

Hey, I'm trying to use ShellExecute to open a web-link in a new window instead of adding it on to my current browser's list of tabs, but I think the ability isn't really there...

I haven't gone into creating objects in autoit or calling libraries, but I think it might be necessary to get autoit to do what I'm trying to do.

Does anyone have any ideas? Maybe somehow using objcreate to add an additional msdn parameter to get it to open in a new window?

Or maybe using DllCall to create a new process of my browser, then using shellexecute (stupid theory).

I know this works as a alternative to ShellExecute:

But I don't know how to add additional parameters.

Here's MSDN's reference page to ShellExecute:

http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx

I read using SW_SHOWNORMAL flag with ShellExecute works, but I have no clue on how to use ObjCreate to add that flag.

Example: ShellExecute(NULL,"c:\\program files\\internet explorer\iexplore.exe", NULL, SW_SHOWNORMAL)

Thanks, hopefully this can shed some light and teach me how to apply msdn references to ObjCreate in autoit.

What about this idea?

$URL1 = "http://www.bing.com/search?q=Table&form=QBLH&filt=all"
run("C:\Program Files\Internet Explorer\iexplore.exe " & $URL1,@ScriptDir,@SW_MAXIMIZE)

sleep(2000)
$URL2="http://www.google.com/"
ShellExecuteWait("C:\Program Files\Internet Explorer\iexplore.exe",$URL2,@ScriptDir)

sleep(2000)
$URL3="http://www.google.com/products"
ShellExecuteWait("C:\Program Files\Internet Explorer\iexplore.exe",$URL3,@ScriptDir)
Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

I also found this info:

Look at the buttom....

How ShellExecute Works

The following background is for informational purposes only. It is provided so that you can better understand how your application interacts with the operating system. Do not base your designs on assumptions that you draw from this information. Be aware that this functionality may change in future versions of Microsoft products.

How ShellExecute Interprets the URL Passed

ShellExecute parses the string that is passed to it so that ShellExecute can extract either a protocol specifier or an extension. Next, ShellExecute looks in the registry and then uses either the protocol specifier or the extension to determine which application to start. If you pass http://www.microsoft.com to ShellExecute, ShellExecute recognizes the http:// sub-string as a protocol, which causes ShellExecute to view HKEY_CLASSES_ROOT\http\shell\open for information about how to run. If you pass myfile.htm to ShellExecute, ShellExecute recognizes the ".htm" sub-string as an extension. This causes ShellExecute to view HKEY_CLASSES_ROOT\.htm, which leads to HKEY_CLASSES_ROOT\htmlfile\shell\open.

Typically, it is best to fully specify your URL in the string that is passed to ShellExecute, for example: http://www.microsoft.com instead of www.microsoft.com. When you fully specify the URL, you make sure that ShellExecute knows exactly which protocol you want. By default, however, ShellExecute detects some patterns that include www.* and ftp.*, and then maps those patterns to the Hypertext Transfer Protocol (HTTP) protocol and the File Transfer Protocol (FTP), respectively.

How ShellExecute Determines Whether to Start a New Instance

When ShellExecute looks through the registry, it looks for the shell\open subkey. If the shell\open\ddeexec key is defined, then a Dynamic Data Exchange (DDE) message with the specified application IExplore and the topic WWW_OpenURL is broadcast to all top-level windows on the desktop. The first application to respond to this message is the application that goes to the requested URL. If no application responds to this DDE message, then ShellExecute uses the information that is contained in the shell\open\command subkey to start the application. It then re-broadcasts the DDE message to go to the requested URL.

Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

dang. I posted a reply, but I guess it got deleted as it went in right when the forum went down.

Argh, the command-line shortcut doesn't work for Google Chrome as far as i know, so the first method wont work. The second I looked at already, but decided not to do it as it required registry access, which seems like a bad way of doing this in my case. I want to mess with the system as least as possible.

Argh!! So annoying. Is there any way to do this using DllCall or ObjCreate? Probably not right?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...