 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Frank_D Guest
|
Posted: Tue Feb 15, 2005 1:30 pm Post subject: Emulate drop of a text file on a window |
|
|
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 .
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
|
Posted: Tue Feb 15, 2005 2:20 pm Post subject: |
|
|
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 |
|
 |
Frank_D Guest
|
Posted: Tue Feb 15, 2005 2:35 pm Post subject: Emulate drop of a text file on a window |
|
|
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
|
Posted: Tue Feb 15, 2005 11:33 pm Post subject: |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Feb 16, 2005 12:34 pm Post subject: |
|
|
| 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 |
|
 |
Frank_D
Joined: 15 Feb 2005 Posts: 3
|
Posted: Wed Feb 16, 2005 6:45 pm Post subject: |
|
|
| 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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Feb 16, 2005 9:09 pm Post subject: |
|
|
I should have read the whole topic.
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 |
|
 |
Frank_D
Joined: 15 Feb 2005 Posts: 3
|
Posted: Thu Feb 17, 2005 1:08 pm Post subject: |
|
|
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 |
|
 |
BoBo Guest
|
Posted: Thu Feb 17, 2005 2:00 pm Post subject: |
|
|
| 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
|
Posted: Thu Feb 17, 2005 6:00 pm Post subject: |
|
|
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...
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 |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 181
|
Posted: Thu Feb 17, 2005 8:20 pm Post subject: BoBo |
|
|
| 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 ...  |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1687
|
Posted: Thu Feb 17, 2005 11:43 pm Post subject: |
|
|
| Quote: | | Post subject: BoBo |
ooops!!!
 _________________
 |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 2951 Location: Minnesota
|
Posted: Thu Feb 17, 2005 11:44 pm Post subject: |
|
|
 |
|
| Back to top |
|
 |
Beastmaster
Joined: 15 Apr 2004 Posts: 181
|
Posted: Fri Feb 18, 2005 6:36 am Post subject: |
|
|
| Quote: | | Post subject: BoBo |
Should have been @ BoBo blablabla ...
Had another thread open in parallel. So I've mixed up both by mistake. That yerk (just kidding ) seems to be everywhere around here. First evidence of a BoBoMania
@ BoBo
Sorry pal  |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Sat Apr 22, 2006 5:04 pm Post subject: |
|
|
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 exampleThe line 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|