Hiding GUIs if another program is closed, minimized or not currently active

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Off Topic
Posts: 43
Joined: 07 Oct 2017, 20:57

Hiding GUIs if another program is closed, minimized or not currently active

23 Oct 2017, 22:57

Image Greetings, just discovered AHK. I'm a rather visual person without much coding experience and I have some trouble extrapolating what to do in code if in not in the specific context I'm doing, can't find an example of what I'm trying to do through forum searches and my terminology is all animation/illustration instead of programming so I'm unsure of what terms to actually search for. I'd like to create image overlay GUIs to speed up or otherwise help me in certain programs, there are 3 GUIs in the below screenshot:

Image

It's just a test but the above is linked so that I can update and design the UI with ease through use of a Photoshop GUI that prompts some AHK scripting:



Feels really cool to accomplish something like this, even if so simple, for someone who's never done much coding and it could really revolutionize my workflow. I know I can't be doing things very well because my current script is just stitched together from other examples I'd searched for:

Code: Select all

;
#IfWinActive, ahk_exe illustrator.exe
;Header
Gui, 1:Margin , 0, 0
GUI, 1:+AlwaysOnTop -Border -SysMenu +Owner -Caption +ToolWindow
GUI, 1:Add, Picture, , guiAI.png
GUI, 1:Show, NoActivate X0 Y0 autosize, dropDesk
Gui, 2:Margin , 0, 0
GUI, 2:+AlwaysOnTop -Border -SysMenu +Owner -Caption +ToolWindow
GUI, 2:Add, Picture, , guiAItoolbar.png
GUI, 2:Show, NoActivate X950 Y0 autosize, dropDesk
Gui, 3:Margin , 0, 0
GUI, 3:+AlwaysOnTop -Border -SysMenu +Owner -Caption +ToolWindow
GUI, 3:Add, Picture, , guiAIsidepanel.png
GUI, 3:Show, NoActivate X575 Y1195 autosize, dropDesk
They're single pictures because I'm using them as a visual reference for a footpedal. It's very simple so far and I don't need them to be individual buttons though toolbars would be awesome to be able to make and I do plan to try.

I tried an #IfWinNotActive for ahk_exe illustrator.exe but kept getting an error saying I had an Else but no "if", so I figure I can't use that as an If Statement but I don't understand how to hide a GUI in this context or where that goes in the syntax hierarchy itself when I want it to rely on multiple variables: hide/destroy/or fade when Illustrator is minimized, closed, or when I switch the window to a different program like Photoshop. I don't really get the grammar of when to build the GUI compared to when to modify it over time like this, so far I've been using AHK for a lot of key remappings and input sequences. Any help from examples I can look at or points in the right direction?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jollyjoe and 201 guests