Jump to content

Recommended Posts

Posted

I have a fun problem.

I need a way to tell if I have 2 or more windows with the same name in part of the title. We use a web based ticket system, and I have been building a tool that uses the Function keys as shortcuts. Works great, but I discovered a bug.

One of the buttons closes a ticket by performing a series of send commands. Works fine, just as long as you only have just one ticket open at a time. If I have 2 or more tickets open, I might close the wrong one by accident. I need a way to tell when I have 2 or more similar named windows at once.

Also, If 2 or more windows are there, a message will popup warning the user to close other ticket windows before continuing.

xxxxxxxx = number of ticket. This number changes for every ticket.

The window name would look like this:

"xxxxxxxx Request Detail - Unicenter ServicePlus Service Desk"

The only difference between the names of the windows is the numbers. I figure I will need to use Window handles, but I do not know what to do. HELP!

Posted

The window name would look like this:

"xxxxxxxx Request Detail - Unicenter ServicePlus Service Desk"

Use WinList() to get an array with all open windows and the corresponding handles. Sort the array with _ArraySort() and loop through the array to figure out if there are multiple windows with the same ticket number. See also this thread for a similar problem.

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Posted

I got it!

I did this:

  $WinList = WinList( "Request Detail", "") 

 

    if $WinList[0][0] > 1 then

    MsgBox (0, "ERROR", "You have 2 or more Request tickets open. Please exit other tickets first before printing the ticket you want.")

Works like a champ!

Thanks!

<{POST_SNAPBACK}>

why not just search by ticket number? i mean if you're closing the ticket, you could have a variable holding the ticket number (you probably already do) and just use that variable as the "Title" argument in whatever interactions you have with that window...and since it looks like that's the first part of the window title, you probably wouldn't even need to set your WinTitleMatchMode option.

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...