AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Emulate drop of a text file on a window

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Frank_D
Guest





PostPosted: Tue Feb 15, 2005 1:30 pm    Post subject: Emulate drop of a text file on a window Reply with quote

I´m using an application that activates its debugging mode when a text file with some magic words in it is being dropped on its window. As I would like to use this function with a simple hotkey, I´ve worked on SendMessage/Winspector and ControlSend for a while - with very limited success. The application does not react at all Sad .
So, how can I "drop" (the contents of) a file without actually dropping it?

The application in question is SAP GUI, the magic words are as follows:
Code:

[FUNCTION]
Command=/H
Title=Debugger
Type=SystemCommand


Thanks for your help!

Best regards,
Frank
Back to top
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Tue Feb 15, 2005 2:20 pm    Post subject: Reply with quote

maybe i don't fully understand the problem but..

you want:

Hotkey -> (ahk thinks) file dropped -> debug mode


so why not:

Hotkey -> debug mode
_________________
Back to top
View user's profile Send private message
Frank_D
Guest





PostPosted: Tue Feb 15, 2005 2:35 pm    Post subject: Emulate drop of a text file on a window Reply with quote

The point is that the application has no button to activate debugging mode, but it reacts on dropping a file with the given text on it. So, what I actually want to do is sending whatever message is needed to let the application believe someone has dropped such a file.

At the end of the day "hotkey -> debug mode" is exactly what I want - the question is how this can be done.
Back to top
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Tue Feb 15, 2005 11:33 pm    Post subject: Reply with quote

ok i understand the problem now... but i'm sorry i can't think of any solution at the moment... but i'll surely get back in case i think of something.
_________________
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Wed Feb 16, 2005 12:34 pm    Post subject: Reply with quote

You could try monitoring the app to see if there is a particular message you could send to it. Try Rajat's SendMessage Tutorial.
Back to top
View user's profile Send private message Send e-mail
Frank_D



Joined: 15 Feb 2005
Posts: 3

PostPosted: Wed Feb 16, 2005 6:45 pm    Post subject: Reply with quote

I already followed the tutorial and found a couple of WM_COMMAND messages that are being sent when I activate debugging mode. However, sending them with ahk does not seem to work. Besides WM_COMMANDs I also noticed some messages recorded called "SAP_READ (Registered messages)". Does anyone know what this might be?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Wed Feb 16, 2005 9:09 pm    Post subject: Reply with quote

I should have read the whole topic. Embarassed

Anyway, you've probably already thought of this already, but as a last resort, simulate a drag and drop operation with something like:

WinActivate, X
MouseClick, left, 500, 100,,, D ; Hold down the mouse button on the object.
WinActivate, Y
MouseMove, 50, 50
MouseClick, left,,,,, U ; Release the mouse button to drop the object.
Back to top
View user's profile Send private message Send e-mail
Frank_D



Joined: 15 Feb 2005
Posts: 3

PostPosted: Thu Feb 17, 2005 1:08 pm    Post subject: Reply with quote

With MouseClick/MouseMove I would need an explorer window at a constant position, right? I guess this wouldn´t be very comfortable.

As soon as my schedule allows it, I will continue working on the SendMessage approach. There must be a way...
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Feb 17, 2005 2:00 pm    Post subject: Reply with quote

Quote:
With MouseClick/MouseMove I would need an explorer window at a constant position, right?
No. Not necessarily. Check AHK's CoordMode command.
Back to top
Frank_D



Joined: 15 Feb 2005
Posts: 3

PostPosted: Thu Feb 17, 2005 6:00 pm    Post subject: Reply with quote

I´ve checked out the following code:

Code:

Run, H:\Daten\Programmvorlagen\Debugger\, , UseErrorLevel
WinActivate, H:\Daten\Programmvorlagen\Debugger\
CoordMode, Mouse, Relative
MouseClick, Left, 60, 120, , , D   
WinActivate, ahk_class SAP_FRONTEND_SESSION
MouseMove, 160,160,10
MouseClick, Left, , , , , U


Please, no comments on the code. This is just a proof of concept... Wink
However, this doesn´t work. The file I want to drag is highlighted and even moved within the explorer window if I ommit the second WinActivate. But the drag&drop does not seem to work over the border of an application. After running the script the file to drag&drop is selected, the target window is active and the mouse pointer is located within the target window. But no drop occured...

Any ideas?

Best regards,
Frank
Back to top
View user's profile Send private message
Beastmaster



Joined: 15 Apr 2004
Posts: 181

PostPosted: Thu Feb 17, 2005 8:20 pm    Post subject: BoBo Reply with quote

Code:
But the drag&drop does not seem to work over the border of an application


WinGetActiveStats of source window
ControlFocus at source window (rel. coords)
WinGetActiveStats of destination window
ControlFocus at destination window (rel. coords)
MouseMove to source window (screen coords)
MouseMove within source window (rel. coords)
MouseClickDrag from source- to destination window (screen coords)

Eh, braindump overdoze ... Shocked
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1687

PostPosted: Thu Feb 17, 2005 11:43 pm    Post subject: Reply with quote

Quote:
Post subject: BoBo

ooops!!!
Laughing
_________________
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 2951
Location: Minnesota

PostPosted: Thu Feb 17, 2005 11:44 pm    Post subject: Reply with quote

Laughing
Back to top
View user's profile Send private message
Beastmaster



Joined: 15 Apr 2004
Posts: 181

PostPosted: Fri Feb 18, 2005 6:36 am    Post subject: Reply with quote

Quote:
Post subject: BoBo
Shocked
Should have been @ BoBo blablabla ...
Had another thread open in parallel. So I've mixed up both by mistake. That yerk (just kidding Wink ) seems to be everywhere around here. First evidence of a BoBoMania Laughing

@ BoBo
Sorry pal Very Happy
Back to top
View user's profile Send private message
robiandi
Guest





PostPosted: Sat Apr 22, 2006 5:04 pm    Post subject: Reply with quote

The following was working on my PC
Code:
coordmode mouse,screen
^1::
mouseclick,     L,1 ,75,,,D
WinActivate, ahk_class SAP_FRONTEND_SESSION
mousemove         300 ,0,,R
mouseclick      L,,   ,,,U
return

As you will see from the coordinates, I placed the explorer at the upper left corner, moved it to the left (past the left corner of the desktop), so that it will practical not consume any space on the desktop. In the directory (of the explorer) exists only one file.
Now you can even by means of AHK arbitrarely replace the Command line by other commands, for example
Code:
Command=/nsa38
The line
Code:
Title= ...
has no function, hence can be omitted.
Command=/h is perhaps the most important case, because in some cases it can not be executed using the control Edit1 of the SAP_FRONTEND_SESSION
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group