AutoHotKey Recipes for Vivaldi
-
@barbudo2005
Thank you for your message.
I did not know about this extension.
I have to install AutoControl right away!! ^^ -
Autofill date and time in save session
Settings>Keyboard>Sava Selected Tabs as Session : Ctrl+Alt+s
Settings>Keyboard>Save Open Tabs as Session : Ctrl+Alt+Shift+s^!s:: Send,^!s Sleep,200 /*IME_OFF()*/ FormatTime,TimeString,,yyyy/MM/dd/HH:mm Send,%TimeString%_ Return ^!+s:: Send,^!+s Sleep,200 /*IME_OFF()*/ FormatTime,TimeString,,yyyy/MM/dd/HH:mm Send,%TimeString%_ Return
-
Audio Controller
1, Check "Settings>Display All>Play All Audio"
2, Settings>Keyboard>
Mute All Tabs: Ctrl+Alt+Numpad6
Unmute All Tabs: Ctrl+ Alt+Numpad7
Mute/Unmute tab: Ctrl+Alt+Numpad8^!m:: { Gui, 1:Add, Button,W300 Gpause,Pause/Resume Video Gui, 1:Add, Button,W300 Gactive,Play Only in Active Tab Gui, 1:Add, Button,W300 Gmute, Mute All Tabs Gui, 1:Add, Button,W300 Gunmute,Unmute All Tabs Gui, 1:Add, Button,W300 G3minutes,Pause for 3 minutes Gui, 1:Show,,Audio Controller Return } pause: Gui,1:Hide SendEvent,{Media_Play_Pause} Return active: Gui,1:Hide Send,^!{Numpad6} Sleep,100 Send,!^{Numpad8} Return mute: Gui,1:Hide Send,^!{Numpad6} Return unmute: Gui,1:Hide Send,^!{Numpad7} Return 3minutes: Gui,1:Hide SendEvent,{Media_Play_Pause} Sleep 180000 SendEvent,{Media_Play_Pause} Return GuiEscape: Gui, 1:Destroy Return
Pause/Resume also works in background tabs and windows. -
Focus address field + Auto-IME-Off / Focus Quick command + Auto-IME-Off
F1:: Send,^l Sleep, 100 IME_OFF() Return F2:: Send, {F2} Sleep, 100 IME_OFF() Return IME_OFF() { If (IME_IsON(WinExist("A"))) { IME_ON(WinExist("A"), False) } } IME_IsON(hWindow) { ; WM_IME_CONTROL= 0x0283 ; IMC_GETOPENSTATUS = 0x0005 bufCurrentDetectMode := A_DetectHiddenWindows DetectHiddenWindows, On buf := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint",hWindow), "UInt", 0x0283, "Int", 0x0005, "Int", 0) DetectHiddenWindows, %bufCurrentDetectMode% Return buf } IME_ON(hWindow, IsON) { ; WM_IME_CONTROL = 0x0283 ; IMC_SETOPENSTATUS = 0x0006 bufCurrentDetectMode := A_DetectHiddenWindows DetectHiddenWindows, On buf := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint",hWindow), "UInt", 0x0283, "Int", 0x0006, "Int", IsON) DetectHiddenWindows, %bufCurrentDetectMode% Return buf }
Japanese OK?
Because only Japanese will use this script.
アドレスバー / クイックコマンドのフォーカス時にIMEをOFFにします。
無変換キーを送ってIMEをOFFにするだけでも良いのですが、それだと稀にOFFに失敗するので、こうなりました。 -
Move the PIP to the XYcoordinates/height/width you want
^!p:: WinMove,Picture in picture,, 0, 711,548,308 ; Return
Depens on Vivaldi's UI Language, you need to change the "Picture in picture".
In the English UI, title is "Picture in picture".
If in the Deutsche UI, you should replace title with "Bild-in-Bild".
Use "Windows Spy" to get the title, coordinates, and size.
-
full version:
Move the PIP to the XYcoordinates/height/width you wantChangelog: 2021/8/21
I improved a script to work in Deutsche, Japanese, French, Spanish, Italian, Russian and Norwegian UI as default.NumLock:: KeyWait,NumLock, T0.3 if (ErrorLevel){ SetTimer, piplock, Off ToolTip, PIP Unlocked sleep, 5000 ToolTip Return } else{ SetTimer, piplock, 1500 ToolTip, PIP Locked sleep, 5000 ToolTip Return } piplock: WinMove,Picture in picture,, 0, 733,548,308 ; WinMove,ピクチャー イン ピクチャー,, 0, 733,548,308 ; WinMove,Bild-in-Bild,, 0, 733,548,308 ; WinMove,Video flotante,, 0, 733,548,308 ; WinMove,Mode PIP (Picture-in-Picture),, 0, 733,548,308 ; WinMove,Картинка в картинке,, 0, 733,548,308 ; WinMove,Bilde-i-bilde,, 0, 733,548,308 ; Return
Press NumLock:
Move the PIP-windows, and always lock the coordinates/size.
It will contenue to lock, even if you switch Vivaldi' windows or tabs.Hold down NumLock over 0.3 seconds:
Unlock PIP-windows.
Allow you to move and resize the PIP-windows.Please refer to a one above post about how to get the coordinates/size.
If you rewrite a little, this can also use lock the Vivaldi's window position.
-
Lock/Unlock the Vivaldi's window position you want
By the way. "emoji(絵文字)" is now in English, but...No way... "kaomoji(顔文字)" is not in English yet?
┐(´~`)┌I made it quickly.
Insert:: KeyWait,Insert, T0.3 if (ErrorLevel){ SetTimer, Vlock, Off ToolTip, (T T)< sleep, 5000 ToolTip Return } else{ SetTimer, Vlock, 1500 ToolTip, (^ ^)v sleep, 5000 ToolTip Return } Vlock: SetTitleMatchMode, 2 WinRestore,A WinMove,- Vivaldi ,, 285,0,1637,1043 ; Return
-
Auto open File-Manager when downloaded
Changelog: 2021/8/29
Supported folder download.1, Please create a new folder. (for example, F:\Vivaldi_Download)
2, Do not use the User-Folder (C: \Users).
Change "Settings>Downloads>Download Location". (for example, F:\DL_mirror )
3, Empty the mirror folder once. (important)This is a tricky script.
5th line is strange, but it works.
Structurally, download files move from the "DL_mirror" to "Vivaldi_Download".#Persistent SetTimer,filer, 5000 filer: Loop,F:\DL_mirror\*,1,1 if %A_LoopFileExt% ,tmp{ } else{ Run,explorer.exe "F:\Vivaldi_Download" FileMove,F:\DL_mirror\%LoopFile%,F:\Vivaldi_Download\%LoopFile%,1 FileMoveDir,F:\DL_mirror\%LoopFile%,F:\Vivaldi_Download\%LoopFile%,1 } Return
-
Opera-Presto style "go to nickname" ?
How could I not realize it before?
In "Settings>Quick Commands>check Open Bookmarks on Nickname Match".
For example, "ca" is a nickname for "vivaldi://calendar/".
I can't input "cabbage", "carrot", "cauliflower" and so on.
So change nickname "ca" to "@ca", and use this one.F14:: Send,{F2} Sleep 100 /* IME_OFF() */ Send, {@} Return
-
Open current page in other profile
your taste key:: Send, ^l Sleep 200 Send, ^c ClipWait,1 Run, C:\browser\vivaldi\Application\vivaldi.exe --profile-directory="Profile 1" "%Clipboard%" Return
Replace "C:\browser\vivaldi\Application\vivaldi.exe" with your installpath.
Replace "Profile 1" with your profile name.
If you need private window, "~\vivaldi.exe -incognito "%Clipboard%" -
Floating window like MDI (Multiple Document Interface)
Insert:: KeyWait,Insert, T0.3 if (ErrorLevel){ Run, C:\software\vivaldi_s\Application\vivaldi.exe --new-window "vivaldi://calendar/" Sleep 2000 Winset, Alwaysontop, TOGGLE, A WinRestore,A WinMove,A,, 1270, 567,600,450 Send, ^{F11} } else{ Winset, Alwaysontop, TOGGLE, A } Return
hold down Insert-key over 0.3 seconds: start
press Insert-key: toggle "window always on top" -
Don't cancel character selection when left-click and right-click at the same time
↓before
↓after
~LButton::LButton LButton & RButton:: Send,{LButton Up} Sleep 100 Send,{RButton} Return
-
DeepL for Vivaldi
This version merged with the current version. -
AutoSave Session periodically
You can AutoSave Session periodically with Windows Task Scheduler.
If you don't need periodic, this works just a double-click.
It works even if Vivaldi is not active.
It works even if Vivaldi is not running.
This script uses a random number between 0 and 99.1, Vivaldi Settings keyboard shortcut
Session All Tabs as Session: Ctrl+Alt+Shift+s
2 Paste the following code to Notepad.
3, Save as "session.ahk"(UTF-8 BOM).
4, Let Task Scheduler take the reins of "session.ahk".#Persistent IfWinExist ahk_exe vivaldi.exe { WinActivate, ahk_exe vivaldi.exe Sleep 300 Send,^!+s Sleep,300 Random, rnd ,10,99 Send,%rnd% Sleep 500 Send,{Enter} } else { Run, C:\software\vivaldi\Application\vivaldi.exe Sleep 3000 Send,^!+s Sleep,300 Random, rnd ,10,99 Send,%rnd% Sleep 500 Send,{Enter} } Sleep 300 ExitApp
日本人の方は以下をお使いください。IMEをOFFにする必要があるからです。
#Persistent IfWinExist ahk_exe vivaldi.exe { WinActivate, ahk_exe vivaldi.exe Sleep 300 Send,^!+s Sleep,300 IME_OFF() Sleep,300 Random, rnd ,10,99 Send,%rnd% Sleep 500 Send,{Enter} } else { Run, C:\software\vivaldi\Application\vivaldi.exe Sleep 3000 Send,^!+s Sleep,300 IME_OFF() Sleep,300 Random, rnd ,10,99 Send,%rnd% Sleep 500 Send,{Enter} } Sleep 300 ExitApp IME_OFF() { If (IME_IsON(WinExist("A"))) { IME_ON(WinExist("A"), False) } } IME_IsON(hWindow) { ; WM_IME_CONTROL= 0x0283 ; IMC_GETOPENSTATUS = 0x0005 bufCurrentDetectMode := A_DetectHiddenWindows DetectHiddenWindows, On buf := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint",hWindow), "UInt", 0x0283, "Int", 0x0005, "Int", 0) DetectHiddenWindows, %bufCurrentDetectMode% Return buf } IME_ON(hWindow, IsON) { ; WM_IME_CONTROL = 0x0283 ; IMC_SETOPENSTATUS = 0x0006 bufCurrentDetectMode := A_DetectHiddenWindows DetectHiddenWindows, On buf := DllCall("user32.dll\SendMessageA", "UInt", DllCall("imm32.dll\ImmGetDefaultIMEWnd", "Uint",hWindow), "UInt", 0x0283, "Int", 0x0006, "Int", IsON) DetectHiddenWindows, %bufCurrentDetectMode% Return buf }
By the way, are "persistent" and "patient" forked from the same word?
-
-
Take the rein of Vivaldi's window
If Vivaldi is active: Switch between Vivaldi windows
If Vivaldi is inactive: Activate the newest Vivaldi window
If Vivaldi is non-existent: Start up Vivaldi.exePlease, rewrite line 17 to your installation path and your profile name.
#z:: IfWinExist,ahk_exe vivaldi.exe { IfWinActive,ahk_exe vivaldi.exe { WinGetClass, className, A WinActivateBottom, ahk_class %className% } else { WinActivate,ahk_exe vivaldi.exe } } else { Run, C:\browser\vivaldi\Application\vivaldi.exe --profile-directory="Default" } Return
-
Switching between Vivaldi window (Version "Show
Splash-Tooltips")If Vivaldi is active: Switch between Vivaldi windows
If Vivaldi is inactive: Activate the newest Vivaldi window
If Vivaldi is non-existent: Start Vivaldi.exePlease, rewrite "C:\software\vivaldi\Application\vivaldi.exe" "C:\software\vivaldi2\Application\vivaldi.exe" "C:\software\vivaldi3\Application\vivaldi.exe" to your installation path.
On mini-wiondow(Vivaldi3), I'll be ok without splash-tooltip, so there is no splash-tooltip.
#z:: IfWinExist,ahk_exe vivaldi.exe { IfWinActive,ahk_exe vivaldi.exe { WinActivateBottom, ahk_exe vivaldi.exe IfWInActive,ahk_exe C:\software\vivaldi\Application\vivaldi.exe { SplashImage,,B1 FM50 W400 X900 Y300,,Main-Active Sleep 500 SplashImage,off } IfWInActive,ahk_exe C:\software\vivaldi2\Application\vivaldi.exe { SplashImage,,B1 FM50 CT00008B W400 X900 Y300,,Sub-Active Sleep 500 SplashImage,off } } else { WinActivate,ahk_exe vivaldi.exe IfWInActive,ahk_exe C:\software\vivaldi\Application\vivaldi.exe { SplashImage,,B1 FM50 W400 X900 Y300,,Main-Active Sleep 300 SplashImage,off } IfWInActive,ahk_exe C:\software\vivaldi2\Application\vivaldi.exe { SplashImage,,B1 FM50 CT00008B W400 X900 Y300,,Sub-Active Sleep 300 SplashImage,off } } } else { Run, C:\software\vivaldi\Application\vivaldi.exe --profile-directory="Default" } Return
-
-
DeepL for Vivaldi / Hover Translation Version
This version merged with the current version. -
DeepL for Vivaldi / Hover Translation Version 2.1
2021/12/12
Fixed the timing of translation start.
Start translating at the mouse-left-button is released.New feature is that.
When mouse is idle for 60 seconds, automatically turn off "Hover Translation" and "Always on Top" .
I don't know why, but it works without "#InstallMouseHook".
You can change the idle time in line 69.F11:: SetTitleMatchMode, 2 KeyWait,F11, T0.3 If(ErrorLevel) { Winset, Alwaysontop, Off, DeepL WinMinimize, DeepL SplashImage,,B1 FM40 CT8a2be2 W700 X900 Y300,,Turned Off "Hover-Translation" Sleep 1000 SplashImage,off SetTimer, translation, Off Return } KeyWait,F11, D, T0.3 If (!ErrorLevel) { SplashImage,,B1 FM40 CT000000 W700 X900 Y300,,Turned On "Hover-Translation" Sleep 1000 SplashImage,off SetTimer, translation, 100 SetTimer, HoverOff, 100 Return } else Clipboard = Send,^c ClipWait, 2 IfWinExist,DeepL { WinActivate,DeepL WinWaitActive, DeepL Send, ^a^v } else { Run, C:\browser\vivaldi_mini\Application\vivaldi.exe https://www.deepl.com/translator Sleep 5000 Send, ^a^v } Return translation: KeyWait,LButton Clipboard = Send,^c ClipWait, 2 if ErrorLevel <> 1 { IfWinExist,DeepL { WinActivate,DeepL WinWaitActive, DeepL Send, ^a^v } else { Run, C:browser\vivaldi_mini\Application\vivaldi.exe https://www.deepl.com/translator Sleep 5000 Send, ^a^v } } Return HoverOff: if (A_TimeIdleMouse) > 60000 { Winset, Alwaysontop, Off, DeepL SetTimer, translation, Off } Return >+F11:: Winset, Alwaysontop, On, DeepL WinActivate,DeepL SplashImage,,B1 FM40 CT48d1cc W700 X900 Y300,,Turned On "Always On Top" Sleep 1000 SplashImage,off Return >^F11:: Winset, Alwaysontop, Off, DeepL WinMinimize, DeepL SplashImage,,B1 FM40 CTff8c00 W700 X900 Y300,,Turned Off "Always On Top" Sleep 1000 SplashImage,off Return
Press F11:
Translate selected text.Press F11 twice:
Turn on hover-translation.Hold down F11 over 0.3seconds:
Turn off hover-translation.Right-Shift + F11:
Turn on a DeepL window "Always on top" .Right-Ctrl + F11:
Turn off a DeepL window "Always on top" .Please rewrite installation path in line 38 & 60.
If you want to use DeepL-App instead of Vivaldi's mini window, erase line 30-41 & 52-63, and add the following to Line 30 & 52. ( I haven't confirmed, but maybe works. )Send,^c^c
-
Activate Tab-Thumbnails on Hover
#Persistent #IfWinActive ahk_exe vivaldi.exe SetTimer, hover, 50 hover: MouseGetPos, MouseX, MouseY PixelGetColor, color, %MouseX%, %MouseY% if color=0xFCC8CE { if(A_TimeIdle > 200) { Click } } Return
This script send Click when the mouse pointer hover over the right side of tab-thumbnail.
And use this with excellent "Activate Tab On Hover" by @luetage together.First, set tab-thumbnails background-color in CSS.
eg. #ccccff
And add a gradient, for block the Click on the left side of thumbnail.#vivaldi-tooltip .tooltip .tab-group .tooltip-item:hover { background: linear-gradient(90deg,#ffeeff 10%,#ccccff 55%); }
Color conversion.
#ccccff → 0xFCC8CE and change color to your background-color in line 9.↓ PixelGetColor-AHK-Script
^!z:: MouseGetPos, MouseX, MouseY PixelGetColor, color, %MouseX%, %MouseY% MsgBox, The color at the current cursor position is %color%. Return
-
Two Junk AHK for Picture-in-Picture
1、Mouse control Picture-in-Picture
Change the mouse actions only when hover mouse cursor over the PIP.
Wheel up: volume up
Wheel down: volume down
Middle button: pause/play
Right button: close PIP
4th button: play previous video
5th button: play next videoIf your Vivaldi's User Interface Language is not in English or Japanese, replace "Picture in picture" with your window title.
eg. In German, it's "Bild-in-Bild".Menu Tray, Icon, imageRes.dll, 104 #Persistent SetTimer,get_title,100 get_title: MouseGetPos,,,guideUnderCursor WinGetTitle, WinTitle, ahk_id %guideUnderCursor% Return ~WheelUp:: if WinTitle=ピクチャー イン ピクチャー { Send,{Volume_Up} Return } if WinTitle=Picture in picture { Send,{Volume_Up} Return } ~WheelDown:: if WinTitle=ピクチャー イン ピクチャー { Send,{Volume_Down} Return } if WinTitle=Picture in picture { Send,{Volume_Down} Return } ~MButton:: if WinTitle=ピクチャー イン ピクチャー { Send,{Media_Play_Pause} Return } ~RButton:: if WinTitle=ピクチャー イン ピクチャー { Send,!{F4} Return } if WinTitle=Picture in picture { Send,!{F4} Return } ~XButton2:: if WinTitle=ピクチャー イン ピクチャー { Send,{Media_Prev} Return } if WinTitle=Picture in picture { Send,{Media_Prev} Return } ~XButton1:: if WinTitle=ピクチャー イン ピクチャー { Send,{Media_Next} Return } if WinTitle=Picture in picture { Send,{Media_Next} Return }
2、Toggle Picture-in-Picture
Add Command Chain, and set a key shortcut to "Ctrl+Alt+Shift+/".Open Link in Current Tab
parameter:
javascript:(function(d, v) {if(v = d.querySelector("video")) {if(v == d.pictureInPictureElement) {d.exitPictureInPicture();} else {v.requestPictureInPicture();}}})(document);( reference source )
^!p:: IfWinExist,Picture in picture { WinActivate,Picture in picture WinWaitActive, Picture in picture Send,!{F4} Return } IfWinNotExist,Picture in picture { IfWinActive ahk_exe vivaldi.exe { send,^!+/ Return } }
Same as above, if your Vivaldi's User Interface Language is not in English, replace "Picture in picture" with your window title.