Google Chrome 没有“退出确认”的提示和按钮,求助 | 您所在的位置:网站首页 › 谷歌浏览器多窗口关闭提示 › Google Chrome 没有“退出确认”的提示和按钮,求助 |
使用 AHK, 在 Chrome 中按下 alt+F4(或 ctrl+w 或其他退出键)时,给出弹窗,当选择 Yes 时,takkill 掉当前进程(Chrome)。 ; 避免误退出 !F4:: { if (WinActive("ahk_exe chrome.exe")){ MsgBox, 4,, Would you like to exit (press yes) or return to menu (no)? `n(Press yes or no) IfMsgBox Yes { ; 弹窗显示要退出 ;MsgBox, 0,, Exiting ; 获取当前激活的窗口的进程名,并存放到变量 activeprocess WinGet, activeprocess, ProcessName, A ; 执行 taskkill 命令,并引用 activeprocess 变量 Run, %comspec% /c taskkill /f /im %activeprocess%,,hide return } else { return } } }效果: 回车就退出,tab 键选 no,再回车,就取消。 上面的代码有 bug。效果不好。taskkill 太猛了,如果是资源管理器下,直接关闭资源管理器,任务栏都不见了。还是使用原有的 alt+F4 的关闭方式,同时为了避免循环调用自身,使用 $!F4 而非 !F4。 $!F4:: { if (WinActive("ahk_class MozillaWindowClass")){ MsgBox, 4,, Would you like to exit (press yes) or return to menu (no)? `n(Press yes or no) IfMsgBox Yes { ; 弹窗显示要退出 ;MsgBox, 0,, Exiting Send !{F4} return } else ; 不退出 { return } } ; 其他程序默认发送 alt+F4 按键 Send !{F4} return }用白名单搜索这些解决办法很方便。搜索引擎黑白名单过滤,自定义搜索引擎 cse.google.com,customsearch.ai,黑白名单过滤插件 uBlacklist reference![]() https://www.reddit.com/r/AutoHotkey/comments/5tm7jm/best_alternative_to_a_yesno_msgbox_for_people/ ![]() ![]() What's the purpose of the dollar sign in AHK script? - posted in Ask for Help: I came across this post: http://www.autohotke...om-copied-text/ I am new to AHK, and I have never used a dollar sign in my AHK script, can you tell me when I should... |
CopyRight 2018-2019 实验室设备网 版权所有 |