AutoHotKey Recipes for Vivaldi
-
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.
-
7~8秒間 Vivaldiを操作しなかったらIMEを自動でOFFにする
日本語OSの方以外が使う理由は「皆無」なので日本語で書きます。
2~3週間使わないと効果が分からない、非常に地味ですが実は強力で有能かもしれない気がしないでもなくないかもしれないような気がしないでもない magical scriptです。
時々、IMEが暴走するのを防ぎますwMenu Tray, Icon, imageRes.dll, 123 #Persistent SetTimer,turnoff_ime,1000 turnoff_ime: if(A_TimeIdle > 7000) { 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 }
-
Ppafflick moved this topic from Vivaldi for Windows on
-
Ppafflick pinned this topic on
-
When "I'm not a robot" show up, automatically search using another search engine.
Update: Oct. 24, 2022
e.g. startpage.com
Menu Tray, Icon, imageRes.dll, 96 #Persistent SetTimer,Startpage,3000 Startpage: IfWinActive, ahk_exe vivaldi.exe { SetTitleMatchMode, 2 IfWinActive, www.google.com/search?q= { ClipSaved := ClipboardAll sleep 50 send, ^k sleep 80 send, ^c ClipWait,2 send, ^w Run, https://www.startpage.com/do/search?q=%Clipboard% Clipboard := ClipSaved sleep 50 ClipSaved = } } Return
-
Multiple Search & Tile
^+k:: Gui, Color, e6e6fa, f5f5f5 Gui, Add, Edit Gui, Add, Button, Ggoogle, Google(JP) Google(En) Gui, Add, Button, Ggooduck , Google DuckDuckGo Gui, Add, Button, Gyodoama , Yodobashi Amazon Gui, show Return google: ClipSaved := ClipboardAll GuiControlGet, clipboard, , Edit1 Run, https://www.google.com/search?q=%clipboard%&num=100 Run, https://www.google.com/search?q=%clipboard%&hl=en&num=100 sleep 1000 send, ^{F9} Clipboard := ClipSaved ClipSaved = GUI, Destroy Return gooduck: ClipSaved := ClipboardAll GuiControlGet, clipboard, , Edit1 Run, https://www.google.com/search?q=%clipboard%&num=100 Run, https://duckduckgo.com/?q=%clipboard% sleep 1000 send, ^{F9} Clipboard := ClipSaved ClipSaved = GUI, Destroy Return Yodoama: ClipSaved := ClipboardAll GuiControlGet, clipboard, , Edit1 Run, https://www.yodobashi.com/?cate=&word=%clipboard%&ginput= Run, https://www.amazon.co.jp/s?k=%clipboard% sleep 1000 send, ^{F9} Clipboard := ClipSaved ClipSaved = GUI, Destroy Return
-
@shifte
I do date and time entries so often in so many apps, I just use this to automatically do date and time whenever it type 3 ds or 3 ts:*:ddd:: ;Date alone, not bold
Formattime, Currentdate,, MMM dd yyyy
SendInput %CurrentDate%
Return:*:ttt:: ;time alone
Formattime, CurrentTime,, hh:mm
sendInput %CurrentTime%
Return -
@steveshank
Great job! -
@shifte hallo, someone has already done it through AutoControl, or a different suggestion than to do so???
-
AutoControl is a extension for Chrome, so not have commands for Vivaldi.
-
@VAIO73
I'm not sure. I'm not using AutoControl now. -
Hello!!!
I have a question about session autosave!!!
https://forum.vivaldi.net/post/530280
In my environment, I don't have to set an appropriate number as the name, but if I hit enter, with no input, it automatically becomes the name of the date! Is it just me? Or was this implemented in a recent update? I forgot.
(Forgive the Japanese in the image. ️)Personally, I'd be more than happy to have it set to the date on its own, so here's what I've done!(I assign session save to Ctrl+R, so that's what the code is for.)
#Persistent IfWinExist ahk_exe vivaldi.exe { WinActivate, ahk_exe vivaldi.exe Sleep 300 Send,^r Sleep,300 Send,{Enter} } else { Run, "%LOCALAPPDATA%\Vivaldi\Application\vivaldi.exe" Sleep 4000 Send,^r Sleep,300 Send,{Enter} } Sleep 300 ExitApp
Still, great code, thanks seriously! Woo hoo!!!
-
@naporitan0sushi
Yeah, you're right! I have never noticed that.
With the Stable Channel, I can't press the save button when the Session Name is blank.
With the Snapshot, I can press the save button. -
【translation】
Yay!!!
Question.When the Vivaldi browser is inactive, is it possible to save the session and then make the originally open window active again?
For example.
1, I am working in Notepad.
2, At the time specified in the task scheduler, the Vivaldi browser becomes active and automatically saves the session.
3, minimize the Vivaldi browser and make Notepad active again...I have tried everything in my own way and asked ChatGPT for a few days, but I couldn't get it to work...
The idea is to get the current active window before executing the code, and switch to the acquired active window after executing the code...?
Or, minimize the Vivaldi browser after the code is executed, but not if Vivaldi was already active before the code was executed...?
I can come up with the idea, but I am having trouble with the technology to code it....
I've asked various ChatGPTs to code it for me, but they were all very subtle.
It minimizes even when Vivaldi is active, and vice versa, it doesn't minimize even when the Vivaldi browser is not active....
I would be glad if you could let me know if you have some free time.... Ignoring is totally OK. Sorry for asking so brazenly.
Translated with www.DeepL.com/Translator (free version)
【Text before translation】
やっほーーです!!
質問です。Vivaldiブラウザがアクティブではない時、セッション保存した後、元々開いていたウィンドウをアクティブに戻すことは可能でしょうか?
例:
1、メモ帳で作業している
2、タスクスケジューラで指定した時刻になり、Vivaldiブラウザがアクティブになり、セッションを自動保存する
3、Vivaldiブラウザを最小化して、再度、メモ帳をアクティブに戻す…数日、自分なりに色々試してみたり、ChatGPTに聞いてみたりしましたが、うまい具合にできなくて…。
考え方としては、コード実行前に現在のアクティブウィンドウを取得して、コード実行後に取得したアクティブウィンドウに切り替える…とかですかね…?
それとも、コード実行後にVivaldiブラウザを最小化するようにして、コード実行前に既にVivaldiがアクティブだった場合は、最小化しない…的な感じですかね…?
考え方は思いつくのですが、それをコード化する技術がなくて困っています…。
色々ChatGPTに聞いて、コードを作成してもらいましたが、どれも微妙な感じでした。
Vivaldiがアクティブの時でも、最小化しちゃったり、その逆でVivaldiブラウザがアクティブじゃない時も最小化してくれなかったり…。
暇なときでいいので、もしよろしければ、教えていただければ、嬉しいです…。無視でも全然OKです。図々しく聞いてすみません
-
@naporitan0sushi
It just needs to add "WinMinimize ahk_exe C:\your installation path\vivaldi\Application\vivaldi.exe " to one line above "ExitApp".btw, what a coincidence! I wanted to ask you as well.
As for https://www.naporitansushi.com/vivaldi-forum-recently-posted-height/ .
Could you move the post content?
-
@naporitan0sushi
Sorry, I was mistaken!
↓ Try this!#Persistent IfWinExist ahk_exeC:\software\vivaldi\Application\vivaldi.exe { IfWinActive ahk_exeC:\software\vivaldi\Application\vivaldi.exe { Send,^!+s Sleep,300 IME_OFF() Sleep,300 Random, rnd ,10,99 Send,%rnd% Sleep 500 Send,{Enter} } IfWinNotActive ahk_exeC:\software\vivaldi\Application\vivaldi.exe { WinActivate, ahk_exe C:\software\vivaldi\Application\vivaldi.exe Sleep 300 Send,^!+s Sleep,300 IME_OFF() Sleep,300 Random, rnd ,10,99 Send,%rnd% Sleep 500 Send,{Enter} sleep 200 WinMinimize ahk_exe C:\software\vivaldi\Application\vivaldi.exe } } 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 200 } 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 }