Jump to content
Macro Express Forums

Issues with control


Recommended Posts

Hi All,

 

I'm struggling to work out how to manage the Control feature. I want to click a particular box in my clinical system. It's called 'prescription destination'. The following code makes MEP crash every time, so it's obviously not right!

 

<VARIABLE SET CONTROL TEXT Text="Prescription Destination" ControlVar="%name%"/>

<IF CONTROL Option="\x07" Variable="%name%"/>

<TEXT TYPE Action="0" Text="<TAB>"/>

<END IF/>

 

The following just keeps scrolling around endlessly:

 

<TEXT TYPE Action="0" Text="<TAB>"/>

<REPEAT UNTIL Variable="%where%" Condition="\x00" Value="Prescription Destination"/>

<CAPTURE CONTROL Option="\x01" Control="%name%" UseText="FALSE"/>

<GET CONTROL TEXT TextVar="%where%" ControlVar="%name%"/>

<TEXT TYPE Action="0" Text="<TAB>"/>

<END REPEAT/>

 

Any ideas?

 

Also - when I test run, a blue marker comes across the macro script and then I don't seem to be able to test run again. What is that blue bar? I've tried the 'Help' but it wasn't any help!

 

Thanks

 

Tim

 

 

Link to comment
Share on other sites

That's not how it's done. You should check out the sample macro using Windows Calculator which installed with MEP. But to give you a shorter answer for what you want to do you do not set the control text.

 

First you need to define a control variable. This confused me for some time because it's eccentric compared to other variables. On first blush the command to define a control variable "Get Control" seems confusing. The key is to understand that first. Controls have an address called a handle. But these change all the time. EG you could close an WinForm (Windows Form what most programs are you see on your computer) and open it again and the address will change. Also you can multiple instances of a WinForm. EG I have two Calculators open right now. So Get Control is actually a command that finds the address of the control you want at run time. To do this it uses a sort of map. When you set the Get Control and use the Utility (Launch Utility button) drag the little blue X to your control you will see what I mean. It's a set of directions on how to [drumroll] You guessed it... "Get the Control".

 

Next you don't want to set the control text. In fact many will not let you. What you want to do is use the Text Type command to Send Text Directly to Control. And that's it. To fill in one field it on a WinForm it takes exactly 2 commands.

 

If you then want to click an "OK" button define a control variable for the button and use the Mouse Click on Control.

 

There you have it, 4 commands to fill a WinForm and submit. And the best part is you don't have to even have the WinForm visible to do this and there are generally no timing issues or mistakes. And it's super fast.

 

I attached a demo using Calculator. Have it open and run this and you should instantly see "123" appear in the window.

Control Demo.mex

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