| View previous topic :: View next topic |
| Author |
Message |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Feb 20, 2003 3:16 pm Post subject: Automating input to another program |
|
|
I'm trying to insert data into another (non-VDS) program. You know the drill:
| Code: |
window activate,#OtherApp
wait .3
if @equal(@winactive(C),OtherApp)
window SEND,#OtherApp,xxxnewdataxxx
else
goto someroutine
end
|
Generally, this works OK. But on some systems it's a NoGo: The target app's taskbar button
will flash and become highlighted, but its window will not become active and then it isn't
possible to insert data. I've tried doing WINDOW CLICK also when the window is not
activated, but it all comes to nothing but a flashing taskbar button.
Any ideas, guys?
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Feb 20, 2003 5:12 pm Post subject: |
|
|
| I don't know in which language the other program is made, and I don't know if you made the program yourself, but maybe you can use DDE? |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Feb 20, 2003 5:27 pm Post subject: |
|
|
Windows has a setting to keep programs from just popping into view, instead it flashes the taskbar button. I believe I've seen a program that had it's own option to forcefully activate it's window when it was done doing something.
I'm wondering if you can't send 2 or maybe even 3 WINDOW ACTIVATE commands.
If that doesn't do it, probably the only other option is DDE like Skit said. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Feb 20, 2003 6:42 pm Post subject: |
|
|
Aaaah, man! Why didn't DDE cross my mind (banging head at keyboard).
Just made a quick test, and the darn proggie actually has a DDE server!! So I just have to
find out which commands it supports (hopefully the ones I need)
I may just live to see the next day now
Thanks, guys (hmmm, actually why is programming such a male thing?)
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Feb 20, 2003 6:54 pm Post subject: |
|
|
So I take it my idea of sending ACTIVATE more than once didn't work?
| Quote: | | hmmm, actually why is programming such a male thing? |
I think most women have lives  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Thu Feb 20, 2003 7:25 pm Post subject: |
|
|
| SnarlingSheep wrote: | | So I take it my idea of sending ACTIVATE more than once didn't work? |
Nope, I had tried that one already, making a 4-times loop trying to activate the window
repeatedly.
| SnarlingSheep wrote: |
| Quote: | | hmmm, actually why is programming such a male thing? |
I think most women have lives  |
ROFL. Hey Sheep, that's be best one I've heard for weeks! (Still having tears in
my eyes from laughing...)
Dread
PS: Still struggling to find out which commands that darn DDE supports _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Feb 20, 2003 7:37 pm Post subject: |
|
|
| Maybe you can download a tool like the Windows Spy, but then named as DDE Spy or something... Or you can go to the website of the program you use, and look for an API... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Thu Feb 20, 2003 8:30 pm Post subject: |
|
|
Coupla thoughts (ya may have tried these already)...
Use a @tab() or @enter() after WINDOW ACTIVATE, or ....
WINDOW ICONIZE
WINDOW NORMAL
And ya might need a WAIT for the window to get focused.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Fri Feb 21, 2003 3:58 pm Post subject: |
|
|
I have the same problem... only the program I'm trying to interact with is not a DDE server. I'm trying to close the program, stop a service, restart the service, then run the program again. All of it works except the part where the program closes. When it receives the WINDOW CLOSE command it pops up a confirmation dialog that doesn't have a taskbar button. The confirmation dialog either pops up under the main dialog or it pops up on top of it but doesn't have the focus... and there is no taskbar button to use Mac's suggestion.
I want the send the Y key to the confirmation dialog. I can get the window handle of it with WinSpy but when my program tries to grab it, the script freezes... then if you manually click the Yes button, my script continues as usual. Wierd, eh? Not sure how to get around this one without the handle of the confirmation dialog because activating the main dialog does not focus the confirmation dialog, but I'm not sure why I can't seem to get the handle of it either. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Feb 21, 2003 4:07 pm Post subject: |
|
|
The window "handle" will usually be different each time the
popup window is open - try using the class name instead,
and WINDOW ACTIVATE or WINDOW ONTOP.
You might hafta check for both the correct program being
open, AND the popup class. Sometimes popup windows
share class names.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Fri Feb 21, 2003 4:22 pm Post subject: |
|
|
here's what I do:
| Code: |
PARSE "%T;%L;%W;%H",@winpos(APPWINDOWNAME,TLWH)
window activate,APPWINDOWNAME
window send,@winatpoint(%T,%L),@ALT(C)
|
That worked for me. Cause I had the exact same problem two days ago...
Hope this helps |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Feb 21, 2003 6:26 pm Post subject: |
|
|
Got the thing going through the DDE interface - when it's there it's really a powerful
way of manipulating another program.
While trying to figure out my target program's DDE, I played with DDE in Internet Explorer -
if anyone is interested, I could tidy things up a bit and post it.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Feb 21, 2003 6:30 pm Post subject: |
|
|
That kind of things are what I like...  |
|
| Back to top |
|
 |
|