forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Automating input to another program

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Feb 20, 2003 3:16 pm    Post subject: Automating input to another program Reply with quote

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
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Feb 20, 2003 5:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Feb 20, 2003 5:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Feb 20, 2003 6:42 pm    Post subject: Reply with quote

Aaaah, man! Why didn't DDE cross my mind Question Rolling Eyes (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) Very Happy

I may just live to see the next day now Shocked
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
View user's profile Send private message
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Thu Feb 20, 2003 6:54 pm    Post subject: Reply with quote

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 Wink

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Feb 20, 2003 7:25 pm    Post subject: Reply with quote

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


SnarlingSheep wrote:

Quote:
hmmm, actually why is programming such a male thing?

I think most women have lives Wink


ROFL. Laughing Laughing 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
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Feb 20, 2003 7:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Feb 20, 2003 8:30 pm    Post subject: Reply with quote

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

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Hortalonus
Valued Contributor
Valued Contributor


Joined: 15 Mar 2002
Posts: 344
Location: Western USA

PostPosted: Fri Feb 21, 2003 3:58 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Feb 21, 2003 4:07 pm    Post subject: Reply with quote

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

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Feb 21, 2003 4:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Fri Feb 21, 2003 6:26 pm    Post subject: Reply with quote

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
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Fri Feb 21, 2003 6:30 pm    Post subject: Reply with quote

That kind of things are what I like... Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group