SendCharacter/Text>

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Bill

SendCharacter/Text>

Post by Bill » Wed Sep 08, 2004 3:32 am

I have written a script that pulls records from different Access files and I am sending them out to FoxPro to run a dbase script.

When I run the following independently it runs fine but when I add it to the bottom of the entire script it opens FoxPro but instead of sending the "do" line it opens the view window.

I cannot figure out why it runs by itself but not with the entire script. The line above it closes out Access.

Help.. Thanks.

Bill


Let>RP_WAIT=1
Run c:\VFP\VFP.exe
Let>RP_WAIT=0
wait>2
Send Character/Text>Do C:\VFP\Myfile.prg
wait>5
press Enter
wait>1
press alt
send>Y
release alt

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Sep 08, 2004 4:07 am

Before you use the Send> command, it is a good practice to SetFocus in a specific window, and Navigate to the location where you want the typing to occur. Since you are using "Do......", it would seem to me that you are entering that into a field to execute something with "C:\VFP\Myfile.prg", probably a VFP program? But if you have just closed Access, and then finished with Visual Fox Pro, then it is hard to tell what the active object is when you do the Send>. What will actually be receiving those keystrokes?

When you run it independently, I suspect that you are already in VFP, and probably have the cursor in the correct field also.

Some programs are case sensitive also, so watch the case on your ALT-Y command.

And with RP_WAIT=1, that means the Send> and Press commands will not be sent until VFP is closed.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Wed Sep 08, 2004 7:13 am

then it is hard to tell what the active object is when you do the Send>.
What about to set a

GetActiveWindow>Title,x,y
MessageModal>%Title%
Send>y
.
.
.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Sep 08, 2004 7:26 am

Hi Lumumba

I did not mean to infer that you needed to know the name, only that if SetFocus was not set, the Send> strings could be going anywhere. Your lines to get the Active Windows still do not provide a focus, only makes a variable with that name. It could be used with an IF to see if wanted window is the active window, but it is just as easy to just SetFocus>Windowname*. No need to check for active name. SetFocus will make the desired window active.

I am know I am preaching to the choir re this issue. You certainly know all of that. Just trying to provide some clarification for newer users....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Wed Sep 08, 2004 7:31 am

Confirmed :wink: :D

Bill

Post by Bill » Wed Sep 08, 2004 11:41 am

Thanks.

SetFocus did it.

Bill

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts