如何实现Photoshop的AHK GUI按钮点击后仅执行快捷键且不消失?
Photoshop AHK 自定义混合模式GUI修复方案
当前你用AHK写的Photoshop混合模式切换GUI存在问题:点击任意功能按钮(比如Normal、Multiply)时,GUI窗口会直接消失。需求是只有点击左上角的[✘]按钮时才关闭GUI,其他按钮仅触发对应的Photoshop快捷键,保持GUI持续显示。
修改思路
原代码里每个功能按钮的命令块开头都加了Gui, blend_custom_layer:Destroy,这就是点击按钮后GUI消失的核心原因——每次执行快捷键前都主动把窗口销毁了。只需要把所有功能命令里的这行代码删掉,仅保留closewanrmenu标签里的销毁命令即可。
你之前尝试的Gui, Submit命令在这里完全不需要,因为这个GUI里没有输入框、复选框这类需要提交数据的控件,加了反而可能干扰快捷键执行。
修改后的完整代码
alt & d:: CoordMode, Mouse, Screen MouseGetPos, XposA, YposA XposA-=+0 YposA-=+0 gui, blend_custom_layer:destroy gui, blend_custom:Submit,nohide Gui, blend_custom_layer: Font, s9,Segoe UI Gui, blend_custom_layer:Color, EEAA99 ;-------- UI Gui, blend_custom_layer:Add, Button, x0 y0 w20 h20 BackgroundTrans gclosewanrmenu, ✘ Gui, blend_custom_layer:Add, Button, x21 y0 w200 h20 BackgroundTrans gnormal_blend_layer_command, Normal Gui, blend_custom_layer:Add, Button, x221 y0 w20 h20 BackgroundTrans gclosewanrmenu, ☰ Gui, blend_custom_layer:Add, Button, x21 y20 w110 h20 BackgroundTrans gmultiply_blend_layer_command, Multiply Gui, blend_custom_layer:Add, Button, x130 y20 w111 h20 BackgroundTrans gscreen_blend_layer_command, Screen Gui, blend_custom_layer:Add, Button, x21 y40 w110 h20 BackgroundTrans gdarken_blend_layer_command, Darken Gui, blend_custom_layer:Add, Button, x130 y40 w111 h20 BackgroundTrans glighten_blend_layer_command, Lighten Gui, blend_custom_layer:Add, Button, x21 y60 w110 h20 BackgroundTrans gcolor_burn_blend_layer_command, Color Burn Gui, blend_custom_layer:Add, Button, x130 y60 w111 h20 BackgroundTrans gcolor_dodge_blend_layer_command, Color Dodge Gui, blend_custom_layer:Add, Button, x21 y80 w110 h20 BackgroundTrans glinear_burn_blend_layer_command, Linear Burn Gui, blend_custom_layer:Add, Button, x130 y80 w111 h20 BackgroundTrans glinear_dodge_blend_layer_command, Linear Dodge Gui blend_custom_layer:+LastFound +AlwaysOnTop +ToolWindow WinSet, TransColor, EEAA99 Gui blend_custom_layer:-Caption Gui, blend_custom_layer:Show, x%XposA% y%YposA% h500 w500, menus return ;-------- Commands closewanrmenu: Gui, blend_custom_layer:Destroy return normal_blend_layer_command: send {alt down}{shift down}{n down} send {alt up}{shift up}{n up} Return multiply_blend_layer_command: sendinput {alt down}{shift down}{m down} sendinput {alt up}{shift up}{m up} return screen_blend_layer_command: send {alt down}{shift down}{s down} send {alt up}{shift up}{s up} return darken_blend_layer_command: send {alt down}{shift down}{k down} send {alt up}{shift up}{k up} Return lighten_blend_layer_command: send {alt down}{shift down}{g down} send {alt up}{shift up}{g up} Return color_burn_blend_layer_command: send {alt down}{shift down}{b down} send {alt up}{shift up}{b up} Return color_dodge_blend_layer_command: send {alt down}{shift down}{d down} send {alt up}{shift up}{d up} Return linear_burn_blend_layer_command: send {alt down}{shift down}{a down} send {alt up}{shift up}{a up} Return linear_dodge_blend_layer_command: send {alt down}{shift down}{w down} send {alt up}{shift up}{w up} Return
内容的提问来源于stack exchange,提问作者Matsuiko Hiroka
相关产品推荐
相关产品推荐

