I would appreciate advice in developing a hotkey script to accomplish the following:
- open Firefox, or, if Firefox is already running add a new tab
- place the cursor in the address bar and enter the phrase "microsoft access" with a space after the phrase
- leave the cursor in the address bar ready for me to finish entering the search phrase
Here's what I have, but it does not work reliably, often executing the Run line and stopping.
^+6::
Run, https://firefox.com
Sleep 3000
Send ^t
Sleep 1200
Send ^l
Sleep 700
Send microsoft access
Sleep 600
Send {Esc}
Sleep 600
Send {Space}
Return
What can I do to make it work reliably?
Thanks.
Enter Firefox search phrase
-
- Posts: 9
- Joined: 08 Feb 2018, 09:46
Re: Enter Firefox search phrase
Code: Select all
!c:: ; press ALt+C to start script
Send, ^c ; this will copy a previously selected string to the clipboard
Run,% "firefox.exe https://www.google.de/search?q=microsoft+access+" . ClipBoard ; ... that will be added to the predefined command and start the search
ClipBoard := ""
Return
-
- Posts: 9
- Joined: 08 Feb 2018, 09:46
Re: Enter Firefox search phrase
Thank you BoBo but that does not appear to do what I want. Or at least I do not see how it can do what I want. My goal is to have the script open Firefox, type "microsoft access " in the address bar and wait for me to enter the rest of the search term and press ENTER. I have configured Firefox to use the duckduckgo search engine.
Thank you.
Thank you.
Re: Enter Firefox search phrase
Try this:
HTH
Code: Select all
#NoEnv
SetWorkingDir, %A_ScriptDir%
Title := "My Duck Duck Go Search"
Prompt := "Enter Text to Search"
DefaultSearchTerm := "microsoft access "
$1::
SetTimer, setText, -1
InputBox, SEARCHSTRING, % Title, % Prompt
if (ErrorLevel = 0) ; Searches using default browser:
Run, % "https://duckduckgo.com/?q=" . StrReplace(SEARCHSTRING,A_Space,"+") . "&t=hy&ia=web"
return
; This is for setting the default text without highlighting which is inputbox default:
setText:
WinWait, %Title% ahk_class #32770
ControlSetText, Edit1, % DefaultSearchTerm, %Title% ahk_class #32770
ControlSend, Edit1, {Ctrl Down}{Right}{Right}{Ctrl Up}, %Title% ahk_class #32770
return
Who is online
Users browsing this forum: Google [Bot], haomingchen1998 and 152 guests