emendelson Posted February 9, 2020 Posted February 9, 2020 (edited) With the help of many generous people here, I've written a script that runs invisibly, called "PrintFilePrinter." I keep the code and related files in a folder also named "PrintFilePrinter." I've added this code to the top of my script: If @Compiled Then If WinExists("PrintFilePrinter") Then MsgBox(48, "PrintFilePrinter", "Another copy of PrintFilePrinter.exe is already running." & @CRLF & @CRLF & _ "Shut down the other copy, either from its tray icon or from the Windows task manager, " _ & "and then launch me again.") Exit EndIf EndIf The trouble is that when I have the folder "PrintFilePrinter" open in Explorer, and launch the application from it, this code detects the Explorer window named "PrintFilePrinter" and pops up the error message. I only want that code to detect the invisible window named "PrintFilePrinter." I know that the easy way to fix this is to change the name of the folder, or launch the program from a desktop shortcut, but if there's a technique for detecting whether or not a window is invisible, I would be very grateful to learn about it. I tried using this, but it returned an error, meaning that the invisible window did not exist, even though the program was running; but maybe I'm using it incorrectly. I'll be grateful for any help. Edited February 9, 2020 by emendelson Clarifying.
emendelson Posted February 9, 2020 Author Posted February 9, 2020 Answering my own question: #include <Misc.au3> If _Singleton("PrintFilePrinter", 1) = 0 Then MsgBox(48, "PrintFilePrinter", "PrintFilePrinter.exe is already running.") Exit EndIf argumentum 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now