Jump to content
Macro Express Forums

Paste Data into a database field


Recommended Posts

Hello everyone!

 

I am having a somewhat difficult time trying to figure out a simple thing.

 

I want to Get a control and force a change in the field without having it gain focus. I am using Variable Modify Control to try to force the switch, but it's not working.

 

It works well when you have to GET CONTROL/GET CONTROL TEXT/FOCUS CONTROL/BACKSPACE/TEXT TYPE TO CONTROL(Send Text Directly to Control).

 

What I really want to do is to force the change using Variable Modify Control without having the text "highlight" in blue that it's focused on.

 

In other words, is there anyway of making this seemless without the evidence that a macro is doing the work behind the scenes?

 

Am I thinking this through correctly?

 

Pat

Link to comment
Share on other sites

Just to be clear, the Variable Modify Control command changes the control variable, not the Window Control within the other application.

 

If the application accepts text via Window Controls you can send text to the control use the 'Send Text Directly to Control' option in the Text Type command. With most (all?) applications sending text to a control this way does not set focus to that control. The only way to tell how it is going to work is to try it.

Link to comment
Share on other sites

Kevin,

 

I tried to do this, but for some reason, it doesn't superimpose the new text on top of the old rather it places it right before the old text and leaves the old text to the right of the new text.

 

I'll keep experimenting, but if anyone has a solution to this, I wouldn't mind knowing about it.

 

Thanks,

 

Pat

Link to comment
Share on other sites

Kevin,

 

I tried to do this, but for some reason, it doesn't superimpose the new text on top of the old rather it places it right before the old text and leaves the old text to the right of the new text.

 

I'll keep experimenting, but if anyone has a solution to this, I wouldn't mind knowing about it.

 

 

Try sending <CONTROL>a or <SHIFT><END> before sending the keystrokes to the control. Either of these key sequences should select the text. Then, when you send new text to the control, it will replace the existing text.

 

You may or may not need a short delay between the two steps.

Link to comment
Share on other sites

With "Text Type - Send Directly to Control", it sounds like it is sending the text just as if you first positioned the cursor at the beginning of the field, then did a standard Text Type command. Try appending a bunch of <DELETE> characters to the end of the text before you send it to the control, and see what happens. With luck it will insert your text ahead of what is already there, then delete the original text.

 

Edit: I tested with the Windows Calculator. With "Text Type - Send Directly to Control", and my new data in T1, it works well sending

<HOME><DELETE> .... <DELETE>%T1%

to the control.

Link to comment
Share on other sites

You're correct, it will replace but that's easy to deal with. I would Get Control Text then append my new text to that var and Send Text to Control. This will effectively append the field without focusing it.

Link to comment
Share on other sites

Did you use Set Focus?

No, I didn't use Set Focus. Just

 

Get Control

Text Type | Send Text to Control

 

<GETCONTROL2P:01:CALC.EXE:SciCalcCalculator001:1Edit><TEXTTYPECT:1:<HOME><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE><DELETE>%T1%>

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