cyberchief Posted March 29, 2005 Report Share Posted March 29, 2005 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. Quote Link to comment Share on other sites More sharing options...
randallc Posted March 29, 2005 Report Share Posted March 29, 2005 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 Quote Link to comment Share on other sites More sharing options...
cyberchief Posted March 29, 2005 Author Report Share Posted March 29, 2005 Thanks for the reply! I can copy entire screen to the clipboard. But not sure how to count tabs. Could you expand on that? this may help! Quote Link to comment Share on other sites More sharing options...
randallc Posted March 29, 2005 Report Share Posted March 29, 2005 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 Quote Link to comment Share on other sites More sharing options...
randallc Posted March 31, 2005 Report Share Posted March 31, 2005 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 Quote Link to comment Share on other sites More sharing options...
cyberchief Posted April 1, 2005 Author Report Share Posted April 1, 2005 Thanks Randall. I am going to work with what you posted. It seems right now that the code comes back with %N2% always equalling 0 for some reason. Thanks for putting me in the right direction! Quote Link to comment Share on other sites More sharing options...
randallc Posted April 1, 2005 Report Share Posted April 1, 2005 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.