Jump to content
Macro Express Forums

Can a variable/wildcard be used in a Control's Info/Details?


Recommended Posts

Running ME 3.5.5.2 on XP and having an issue with Controls with the program: "HP Service Manager" AKA HPSM (the locally installed client, not the web client).

 

I've been using ME for three years now and have been very successful with the use of Controls in various applications. In general, most applications have two or more controls for a given field, button, etc., and working with Cory a few years ago I can up with a handy little way of taking all of those different controls in to account by using: (see: http://pgmacros.invisionzone.com/index.php...amp;#entry10965)

 

Get Control C1 (1)

If NOT Control C1 Enabled

Get Control C1 (2)

End If

 

Various ticketing programs, websites, Outlook, Excel, to name a few, all have worked using this method. But HPSM has been giving me trouble as a given Control's Indexing changes depending on how many tickets are currently open in the client, what position they are in, and what order they are in (they are each their own tab within the same parent window). For example: if you have three tickets open and close the one on the far right, the Control Indexes for the one that is NOW on the far right (which was previously second from the right) change to the base (1st) index and all of the other change.

 

Far Right Window:

 

JAVAW.EXE

HP Service Manager - [sWT_Window0]

SWT_Window0 - [index 19]

SWT_Window0 - [index 1]

SWT_Window0 - [index 1]

SWT_Window0 - [index 1]

SWT_Window0 - [index 1]

SWT_Window0 - [index 2]

SWT_Window0 - [index 5]

SWT_Window0 - [index 1]

 

Second from the right:

 

JAVAW.EXE

HP Service Manager - [sWT_Window0]

SWT_Window0 - [index 19]

SWT_Window0 - [index 1]

SWT_Window0 - [index 1]

SWT_Window0 - [index 137]

SWT_Window0 - [index 1]

SWT_Window0 - [index 2]

SWT_Window0 - [index 5]

SWT_Window0 - [index 1]

 

No matter what field, button, etc. I am trying to capture a control for, the fourth Index changes depending on how many are open (but the number it starts at is different each time: 137, 14, 28, 39).

 

I've tried using Capture Control to grab the Control during playback of the macro, but have not been able to get that to work but in a very few instances.

 

What I'd LIKE to do, it either leave it a wildcard so it will find the control based on all of the other Indexes, or possible use a variable in that Index number and loop through changing that number until it finds the correct Index.

 

If anyone can help me accomplish this, or possible point me in another direction, I'd greatly appreciate it!

Link to comment
Share on other sites

I can't help with your problem but I would have thought this is better dealt with using a program like AHK or AutoIt which can dig deeper and get the actual window handles etc. After a couple of hours playing with AutoIt I was getting information that ME simply can't get. Those apps are not particularly user-friendly but get the job done. I've written a number of macros using AutoIt to get/translate the info and ME to manipulate. I'm not sure how the hybrid would work with live, changing windows.

Link to comment
Share on other sites

Hi John,

 

I've used AutoIT a little bit before but there are two issues I'd have with it.

 

1) I design a large set of macros for about 300 people (so I have to take in to account multiple configurations, set ups, etc.) and adding another program to the mix would be one hell of a headache.

 

2) The type of business I work for is highly regulated and open source software like AutoIT are not normally approved for use in the environment.

 

Thanks for the input though!

Link to comment
Share on other sites

I can see how Item 2 could be a problem. On top of that, the extra capabilities in digging deeper could be an issue.

 

AutoIt scripts can be configured so that you don't even see the icon when it runs. Providing the error handling is good, the user would never know that AutoIt was running in the background while running ME as the interface (other than via Task Manager).

Link to comment
Share on other sites

I was thinking about that as well... Or maybe just compile the AutoIT script as an EXE and then have Macro Express call it when need be, pass the info to the clipboard via the script and then have Macro Express pull it in to a variable and parse.

 

I did some testing with AutoIT to try this out, and I run in to the same issue. In AutoIT it just shows in more detail how the Handle, ID and Instance all randomly change depending on how many tabs are open and the order they are in. So I still can't figure out how to make AutoIT grab even one field's data consistantly.

 

This is really killing me! There has to be SOME way of grabbing on to a field in Macro Express or AutoIT without using a Handle, Instance, or ID...

 

Anyone have any other suggestions that have worked for them???

Link to comment
Share on other sites

I was thinking about that as well... Or maybe just compile the AutoIT script as an EXE and then have Macro Express call it when need be, pass the info to the clipboard via the script and then have Macro Express pull it in to a variable and parse.

 

I did some testing with AutoIT to try this out, and I run in to the same issue. In AutoIT it just shows in more detail how the Handle, ID and Instance all randomly change depending on how many tabs are open and the order they are in. So I still can't figure out how to make AutoIT grab even one field's data consistantly.

 

This is really killing me! There has to be SOME way of grabbing on to a field in Macro Express or AutoIT without using a Handle, Instance, or ID...

Do you have any way of discovering whether HPSM is an mdi application? And are you saying that the handle of a particular window or control changes? I'd be very surprised if this were so. In Microsoft Access (an mdi application) I have seen indexes change - the currently active 'window" always seems to be #1. But I have never seen handles change. In fact, if handles do change, how can Windows identify anything with any degree of certainty?

If your application is mdi, then the rules change, and it becomes much harder to manage. But I'll wait to hear from you about HPSM before providing more details about mdi.

Link to comment
Share on other sites

AutoIt scripts that I've posted in the forum have used:

ME External Script command to run "internally" and pass the results as a text string via the Console (or per below)

Ini file

Text file

Non-posted macros I've done it via registry. Standalone AutoIt exe files run by ME I've interfaced via ini, text, registry. I've skipped Clipboard because it's too high traffic and you could get the wrong info. To give you a rough idea of the differences. Using the ME Get Control Tool I could get the Group Box of a group of 4 pieces of data from an application. With AuInfoTool I could get the individual pieces of data I was interested in. I used AutoIt to export the data to ME for processing and display. I have not used on webpages, which may be very different.

 

The advantage of an exe file is that it is continually running and very fast. With the ME External Script command the script runs every time ME passes through the repeat loop containing the command (if that is the setup) and is therefore intermittent and slow - fine for many uses. If the script does everything itself with one access only and passes all data at the end, then it is equally fast.

 

Adding my non-expert opinion to Paul's, the handle of a window never changes until it's removed. Isn't that what the Capture Control is relying on?

 

(edit) Here's an example that I remembered reading a few weeks back, this is from an example in the AutoIt UDF Help:

 

; Get the handle of a notepad window that contains "this one"

$handle = WinGetHandle("classname=Notepad", "this one")

 

There are numerous window functions. Once you have the handle, you never lose the window no matter what it does. I repeat that I have not tried on webpages. Judging by the number of people in the AutoIt forum writing game cheats I would surmise that it's not bad. You should look into AutoIt or AHK even if it's for personal work. Now that ME can handle VBS, JS, HTA and AutoIt scripts with the External Script command the usefulness of ME has been greatly extended.

Edited by JohnS
Link to comment
Share on other sites

  • 2 weeks later...

When you edit the details of a collection item, under the "Library" tab, the collection that item is associated with is set on "Collection" field.

 

Although, you have created a new collection, I dont think your items are actually associated with it.

 

When you imported your data from BC, you can specify the collection the items are to be associated with.

 

Hope this helps

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...