Jump to content

Recommended Posts

Posted (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 by emendelson
Clarifying.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...