AutoHotKey Recipes for Vivaldi
-
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 }
-
@shifte said in AutoHotKey Recipes for Vivaldi:
Hello.
Could you move the post content?
What does this mean? Sorry I don't understand English. Stop publishing articles and write only in the Vivaldi forum! Does this mean? ...🥲Or do you want me to keep the article but write the content in the Vivaldi forum? I didn't have the idea of writing in the Vivaldi forum because it's kind of my record .
Sorry, I was mistaken!
Oooooh! Thank you. After staring at it for a few hours since then, I am now using the following code.
; Vivaldiウィンドウをアクティブにする IfWinNotActive, ahk_exe vivaldi.exe { WinActivate, ahk_exe vivaldi.exe } else { Sleep 100 Send, ^r Sleep 100 Send, {Enter} ExitApp } WinGet, winList, List, ahk_exe vivaldi.exe Loop, %winList% { this_id := winList%A_Index% WinGetTitle, title, ahk_id %this_id% If (title != "ピクチャー イン ピクチャー") { WinActivate, ahk_id %this_id% Sleep 100 Send, ^r Sleep 100 Send, {Enter} WinMinimize, ahk_id %this_id% break } } ExitApp
I knew you would use IfWinNotActive in the same way...! Excellent. It is very helpful. If I have created another window with Picture-in-Picture, the Picture-in-Picture will be active and executed, so I try to execute it on the Vivaldi window, not on the window title "Picture-in-Picture".
It is mostly left to ChatGPT rather than me creating it...
Note that I am using the snapshot version, so it is not a random number, just Enter. It saves it with the current date.
Thank you so much for taking the trouble to send me the modified code. I'm glad to hear it. Have a great day.
Translated with www.DeepL.com/Translator (free version)
-
@naporitan0sushi
すいません。言葉足らずで、物凄い想定外の勘違いをさせてしまいました。
「post content」は画像の赤で囲った部分のことです。ナポさんのブログ記事のことではありません。
赤を黄緑の所に移動できると良いなあ、という話のつもりでした。
「 -
日本語助かります…️️️️️
物凄い想定外の勘違いをさせてしまいました
想定外すぎる勘違いしちゃってすみません(笑)ちょー面白いです(笑)
画像の赤で囲った部分
なるほど!って、よっぽど @shifte 様のほうが詳しいとは思いますが、僕のほうでも試してみました。以下のCSSって感じですかね?
/*スレッドのタイトル横幅*/ .col-md-6 { width: 75%; } /*スレッド内容の横幅、左余白*/ .col-md-3 { width: 68%; margin-left: 70px; }
タイトルと内容の横幅(width)は、好みで調整する感じです。スレッド内容の左余白(margin-left)の数値も好みで調整します。
本当は、以下のコードも必要かなーと思ったんですが、なんか、内容の横幅を変えたら、勝手に下に移動してくれたので、いらないのかな?とも思ったり。
/*スレッド内容、下部移動*/ li[component="categories/category"]>div:nth-of-type(3) { float: none; }
僕はデザインセンスが全くないので、単に下移動、ちょっとインデントみたいに、左余白を設けているだけです。
-
/*スレッドのタイトル横幅*/ .col-md-6 { width: 75%; } /*スレッド内容の横幅、左余白*/ .col-md-3 { width: 68%; margin-left: 70px; }
↓素晴らしい!! 何か上手くいかなくて「ナポさんならできるだろ」と丸投げに走りましたw
記事の公開をやめて、Vivaldi フォーラムだけに書き込みましょう! これはどういう意味ですか?
これが何の話なのかが最初は全く分からなくて・・・行き違いをしていることに気が付くのに2分かかりました(笑)
これだけ想定外だった勘違いは、友達8人くらいで「銀座のライオン」で待ち合わせをしたら、他の7人が三越のライオンの像の前に集まっていたのに、
1人、ビアホールの銀座ライオンでビールを飲んで待っていたN君以来の出来事ですw