Jump to content
Macro Express Forums

Find And Set Focus To Text In Control


cyberchief

Recommended Posts

Ok, I posted this question earlier... but now I have a better understanding and can phrase this a little better. Not sure if the outcome is going to be the same though.

 

Is there a way to set focus to a specific text word within a control? The control in a program includes the entire window to text entries. Right now, I have it going to the first text field, copying the 3 characters to the clipboard, checking those 3 to see if they equal the variable set (BN1), and, if so, replacing the data following. If not, it tabs to the next field and repeats the process. There are about 100 text fields, so, as you can imagine, it takes quite a bit of time to go through this. And there are 5 fields that need to be changed. Is there a way to set focus to the specific text within the control? Like, find text and move mouse (then mouse click) or set focus? Or am I grasping at straws. Thanks in adavance!

 

edited to add: Also, Ctrl F does not work in this program to find text.. need to find a way within ME to do this.

Link to comment
Share on other sites

Hi Cyberchief!,

 

It doesn't sound very hopeful! Does the "Getcontrol" get any text? - usually only the Window title (when control is just a frame), as far as I know.

Can you select all the fields at once? (Control-All, or edit select all, or drag mouse over screen to select, right click, copy to clipboard?) - if you can, then you can copy to clipboard, then to a variable, then count tabs between text found in your variable for use in your macro .

 

Good luck - btw, I think Floyd had your program, so he may be able to help more.

Randall

Link to comment
Share on other sites

Sorry, in a rush,

There are tabs , if you do this in excel, just to see it working; I don't know if you have tabs?; you may need to paste, to Notepad, recopy to Word, and look at what you had using the "Show'Hide" tabs , paragraph markers etc?; If you have tabs or other marker; set them as per Floyd (needs you to modify);

If you look up Floyd's "{Single Dimension Sort}, he counts things in variables after finding sometrhing;

<ASCIIC:4:1:9><TMVAR2:09:09:04:000:000:><REM2:Get the number of elements in the string by counting the delimiters.><TMVAR2:09:01:08:000:000:><IVAR2:02:01:0><REP3:08:000001:000002:0001:0:01:0><IVAR2:01:13:1:%T9%><IFVAR2:2:01:4:0><NMVAR:08:02:0:0000001:0:0000000><TMVAR2:21:01:00:000:000:%T9%><ENDIF><ENDREP>

 

Variable Set %T4% to ASCII Char of 9

      Variable Modify String: Copy %T4% to %T9%

  // Get the number of elements in the string by counting the delimiters.

  Variable Modify String: Copy %T8% to %T1%

  Variable Set Integer %N2% to 0

  Repeat Until %N1% = 0

    Variable Set Integer %N1% from Position of Text in Variable %T1%

    If Variable %N1% > 0

      Variable Modify Integer: Inc (%N2%)

      Replace "%T9%" with "" in %T1%

    End If

  Repeat End

Hope this starts you!

Best, Randall

Link to comment
Share on other sites

Variable Set String %T1% from Clipboard

// We will need CR/LF and TAB characters for this example.

Variable Set Integer %N3% from Position of Text in Variable %T1%

Variable Modify String: Copy Part of %T1% to %T2%

Variable Set %T5% to ASCII Char of 10

Variable Set %T3% to ASCII Char of 13

Variable Modify String: Append %T5% to %T3%

Variable Set %T4% to ASCII Char of 9

Variable Modify String: Copy %T3% to %T9%

// Get the number of elements in the string by counting the delimiters.

Variable Modify String: Copy %T8% to %T1%

Variable Set Integer %N2% to 0

Repeat Until %N1% = 0

  Variable Set Integer %N1% from Position of Text in Variable %T2%

  If Variable %N1% > 0

    Variable Modify Integer: Inc (%N2%)

    Replace "%T9%" with "" in %T2%

  End If

Repeat End

// Number of paras to get to "BN1" should be %N2%

Text Box Display: Number of paras to get to "BN1" should be %N2%

<TVAR2:01:03:><REM2:We will need CR/LF and TAB characters for this example.><IVAR2:03:13:1:BN1><TMVAR2:10:02:01:001:N03:><ASCIIC:5:1:10><ASCIIC:3:1:13><TMVAR2:08:03:05:000:000:><ASCIIC:4:1:9><TMVAR2:09:09:03:000:000:><REM2:Get the number of elements in the string by counting the delimiters.><TMVAR2:09:01:08:000:000:><IVAR2:02:01:0><REP3:08:000001:000002:0001:0:01:0><IVAR2:01:13:2:%T9%><IFVAR2:2:01:4:0><NMVAR:08:02:0:0000001:0:0000000><TMVAR2:21:02:00:000:000:%T9%><ENDIF><ENDREP><REM2:Number of paras to get to "BN1" should be %N2%><TBOX4:T:1:CenterCenter000278000200:000:Number of paras to get to "BN1" should be %N2%N2=%N2%>

In the example you send, this gives 137 tabs (as in Word count of tabs to that spot); go back to your macro; "Repeat %N2% times, <TAB>, Endrepeat" to get to BN1; the do the same for %T1% with other items; number of times as needed.

Actually, it looks to me as though there are paragraph markers; you may only need to "repeat N2<Arrowdown> end" for number of apra markers as in this modified scrip? - else go back to counting tabs but ? take off para numbers; you will need to decide if the paras interfere with the number of tabs you need enter?

If you can just go to the correct line, this will save time even if you then tab through the fields on that line; else if the BN1 may be over on the right of the line, it may always be a certain number of tabs over? else you can count them too, but extra work!

What do you think?

Randall

Link to comment
Share on other sites

Hi

Woops, Sorry; there is a line that shouldn't be there, and you have not understood me at all! ("copy T8 to T1" - just delete that -I'm not sure how I put that in!)

 

Now I am confused!; that made no difference!

Does your clipboard actually contain "BN1" after your macro? - ie Is your "select all" working? - It still works for me using any screen text with "BN1" contained

Randall

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