Code: Select all
^+g::
Send, ^c
sleep 50
parameter = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe http://www.dictionary.com/browse/"%clipboard%"
Run %parameter%
Return
Code: Select all
^+g::
Send, ^c
sleep 50
parameter = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe http://www.dictionary.com/browse/"%clipboard%"
Run %parameter%
Return
Code: Select all
chrome := "- Google Chrome"
found := "false"
tabSearch := "gmail.com - Gmail"
curWinNum := 0
SetTitleMatchMode, 2
WinGet, numOfChrome, Count, %chrome% ; Get the number of chrome windows
WinActivateBottom, %chrome% ; Activate the least recent window
WinWaitActive %chrome% ; Wait until the window is active
ControlFocus, Chrome_RenderWidgetHostHWND1 ; Set the focus to tab control ???
; Loop until all windows are tried, or until we find it
while (curWinNum < numOfChrome and found = "false") {
WinGetTitle, firstTabTitle, A ; The initial tab title
title := firstTabTitle
Loop
{
if(InStr(title, tabSearch)>0){
found := "true"
break
}
Send {Ctrl down}{Tab}{Ctrl up}
Sleep, 50
WinGetTitle, title, A ;get active window title
if(title = firstTabTitle){
break
}
}
WinActivateBottom, %chrome%
curWinNum := curWinNum + 1
}
; If we did not find it, start it
if(found = "false"){
Run "https://gmail.com"
}
return
Thanks.I changed script like this but every time this script create new window even though browser has specified TAB.(We have to use send clipboard specified text at the beginning of the script because we don't want to search previous selected text )MaxAstro wrote:Instead of using Run you would have to check if Chrome is open, and if so activate it and switch to the correct tab. Some google searching turned up an old script designed to do that you could tweak as a baseline:Note that this is untested.Code: Select all
chrome := "- Google Chrome" found := "false" tabSearch := "gmail.com - Gmail" curWinNum := 0 SetTitleMatchMode, 2 WinGet, numOfChrome, Count, %chrome% ; Get the number of chrome windows WinActivateBottom, %chrome% ; Activate the least recent window WinWaitActive %chrome% ; Wait until the window is active ControlFocus, Chrome_RenderWidgetHostHWND1 ; Set the focus to tab control ??? ; Loop until all windows are tried, or until we find it while (curWinNum < numOfChrome and found = "false") { WinGetTitle, firstTabTitle, A ; The initial tab title title := firstTabTitle Loop { if(InStr(title, tabSearch)>0){ found := "true" break } Send {Ctrl down}{Tab}{Ctrl up} Sleep, 50 WinGetTitle, title, A ;get active window title if(title = firstTabTitle){ break } } WinActivateBottom, %chrome% curWinNum := curWinNum + 1 } ; If we did not find it, start it if(found = "false"){ Run "https://gmail.com" } return
Code: Select all
^+d::
chrome := "- Google Chrome"
Send ^c
found := "false"
tabSearch := "http://www.dictionary.com/browse/%clipboard%"
curWinNum := 0
SetTitleMatchMode, 2
WinGet, numOfChrome, Count, %chrome% ; Get the number of chrome windows
WinActivateBottom, %chrome% ; Activate the least recent window
WinWaitActive %chrome% ; Wait until the window is active
ControlFocus, Chrome_RenderWidgetHostHWND1 ; Set the focus to tab control ???
; Loop until all windows are tried, or until we find it
while (curWinNum < numOfChrome and found = "false") {
WinGetTitle, firstTabTitle, A ; The initial tab title
title := firstTabTitle
Loop
{
if(InStr(title, tabSearch)>0){
found := "true"
break
}
Send {Ctrl down}{Tab}{Ctrl up}
WinGetTitle, title, A ;get active window title
if(title = firstTabTitle){
break
}
}
WinActivateBottom, %chrome%
curWinNum := curWinNum + 1
}
; If we did not find it, start it
if(found = "false"){
Send ^c
parameter = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe http://www.dictionary.com/browse/"%clipboard%"
Run %parameter%
}
return
Users browsing this forum: Descolada, doodles333, roeleboele, ulysim and 390 guests