Jump to content
iAmNewbe

Problem with Web Browser opening URL via ShellExecute

Recommended Posts

I created an application to catch keyboard programmed keys.  Some of the keys open URL's via ShellExecute and then they open in the default browser.

The problem I am having is that when the browser is opened in this manner 3rd party applications such as Logitech Setpoint for Logitech mouse and keyboards and programs like auto password form filling stop working with the browser.  In the mouse specific situation the Cruise Up and Cruise Down buttons, normally back and forward, do not work. If I open the browser manually via the browsers icon and then press the keyboard buttons to open the web page everything works normally.

I have two questions:

1:  Why does 

ShellExecute("http://www.autoitscript.com")

when the browser is not open and then is launched, via the above line, cause third party apps to not be able to interface with the browser?


2:  What is a better way to launch URL's if not via ShellExecute?


The application is NOT using #RequireAdmin and is not 64bit.

Share this post


Link to post
Share on other sites

I ended up changing the ShellExecute line to include the actual browser executable, this no longer opens the default browser and instead whatever executable I call directly but it fixes the issue with third party apps accessing the browser.

I do not understand why just entering the URL by itself without an executable causes this problem.

Share this post


Link to post
Share on other sites
Posted (edited)

Sorry, I can't answer your questions. However, you can open the link in your default browser by using _RunDos and windows URI:

#include <Process.au3>
_RunDos("start www.google.com")

Sometimes, you can use Windows URI to open URL(s) in specific browsers by:

;For Internet Explorer
_RunDos("start iexplore google.com ")
_RunDos("start iexplore google.com bing.com")

;For Firefox
_RunDos("start firefox google.com")
_RunDos("start firefox google.com bing.com")

;For Chrome with normal & incognito mode
_RunDos('start chrome google.com bing.com')
_RunDos('start chrome google.com bing.com google.com')
_RunDos('start chrome google.com bing.com --incognito "google.com"')
_RunDos('start chrome --new-window --incognito "google.com"')

I think this is just another way of ShellExecute, the difference is you type the whole dos command instead of filling them into parameters of ShellExecute function.

I haven't tried for Edge, since my computer is running Windows 7 🤣

Edited by LukeLe
edit URI for chrome browser

Share this post


Link to post
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

  • Similar Content

    • By ambad4u
      Hello and Good Day to All!
      I am trying to install .NET 3.5 on Windows 10 x64bit via autoit (via ShellExecuteWait + PowerShell).
      If I run this line, it will runs without issues:
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\OJP83BU523.ps1' & '"') "OJP83BU523.ps1" contains: DISM /Online /Enable-Feature /FeatureName:NetFX3 /All /Source:D:\Sources\sxs /LimitAccess
      However, since I won't know in advance the drive letter of the "sources" folder, I created a script to generate a PowerShell Script to give a correct path for it.
      With the modified script below, PowerShell only blinks and nothing happens
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & @ScriptDir & '\' & $filename & '"') or
      ShellExecuteWait('PowerShell.exe', '-executionpolicy Bypass -File "' & $filename & '"')  
      I wish I know the difference with "$filename" and "\OJP83BU523.ps1" usage, as for me, it should be the same.
      Attached is my entire autoit script.
      any help is appreciated!, many thanks in advance!
      test.au3
    • By nacerbaaziz
      hello sirs
      please i want to use the WinHttp to get the google drive file title using the api
      i searched in the forom but i didn't found any Google drive api UDF
      for that i liked to ask you for that
      i had read the google drive api documentation but i couldn't do it
      please help me
      here is the api doc
      note i've got the apikey and i have the file id
      what i want is to get the title of the file (the file name)
      because i want to download the files from the google drive using the autoit
      please help me for that
      am sorry because i didn't gave you any example or what i tried but all what tried was  failed
      thanks in advance
    • By nacerbaaziz
      hello sirs
      i've some questions about StringRegExpReplace i hope you can help me
       
      i tried to make a function that give me the host of the url and other give me the url with out host
      for example i've this link
      https://www.example.com/vb/result.php
      i need the first give me the
      example.com
      and the other give me 
      /vb/result.php
      i find that
      $s_source = "https://www.google.com/vb/index.php" Local $s_Host = StringRegExpReplace($s_Source, '.*://(.*?)/.*', '\1') Local $s_Page = StringRegExpReplace($s_source, '.*://.*?(/.*)', '\1') msgBox(64, $s_Host, $s_Page)  
      but i found some problems i need your help to correct it
      first: when i get the host if the url has www i want to remove it
      second: if the url with out host did not have other things 
      i need the result to be ""
      e.g
      https://www.example.com
      the first i want it
      example.com
      and the second i want it to be ""
      i hope that you can help me
      thanks in advance
    • By sosimple
      Is this possible with autoit?
      What I want to do:
      Create a Desctop windows shortcut to run an executable application created with autoit, which shortcut would have some parameters which will send as a variable to the aplicagion .
      For example:
      Create an app : ExampleAppCreatedByAutoit.exe
      Run this with a shortcut which has:  "C:/ExampleAppCreatedByAutoit.exe" -option1
      What I want to do is the ExampleAppCreatedByAutoit.exe take the option1 and do something like this: Shellexecute("c:\myfolder\option1.exe")
      Can I do that?
      Thanks,
    • By Rocker
      I apologize for my poor coding skills, but only on occasion do I have a need to automate a repetitious task to save time.  In a nutshell the following code is supposed to go to a website, save the site using Scrapbook (a plugin used by an older version of Firefox), rename the folder in Windows Explorer that Scrapbook assigns a random name for and then moves on to the next website, of which there are hundreds.  Everything works, except after the address bar gets populated with the URL, it's like the ENTER key never gets pushed.  The weird thing is, this worked yesterday before I left to go home and when I came in this morning it didn't work.  The next thing I'll be trying to learn is to loop this with a the list of the websites.  Thank you for your help!
      WinActivate( "[CLASS:MozillaWindowClass]" ) ;Apply focus to the open Mozilla firefox window Sleep(500) Send("^k") ;Apply focus to the address bar Sleep(500) Send("www.WEBSITE.com {ENTER}") ;Send the website to the address bar Sleep(10000) ;Wait for the website to fully open Send("!c") ;Opens the drop down menu for Scrapbook Sleep(2000) Send("{ENTER}") ;Selects the default drop down selection of save Sleep(20000) WinActivate( "[CLASS:CabinetWClass]" ) ;Applies focus to the open Windows Explorer window where the websites are saved Sleep(1000) Send("{SPACE}") ; Selects a folder in the folders list Sleep(200) Send("{HOME}") ;Moves to the top folder Sleep(200) Send("{F2}") ;Keyboard shortcut to rename the folder Sleep(200) Send("www.WEBSITE.com {ENTER}") ;Applies the new name to the folder  
×
×
  • Create New...