 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Ixoyer of Men
Joined: 18 Jan 2006 Posts: 11 Location: Coeur d'Alene, Idaho
|
Posted: Wed Jan 18, 2006 5:37 am Post subject: mouse movement |
|
|
| What would be a sample code that would move the mouse cursor, say, 2 inches up/down/left/right on the screen via the arrow keys (not to be confused with the numpad keys). I would like it to be as simple and straight-forward as possible so that I can edit it later if need be. Thank you very much. |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1275
|
Posted: Wed Jan 18, 2006 5:44 am Post subject: |
|
|
Try this:
| Code: | CoordMode, Mouse, Screen
Up::
Down::
Left::
Right::
MouseGetPos, x, y
if A_ThisHotkey = Up
MouseMove, (x), (y-100)
if A_ThisHotkey = Down
MouseMove, (x), (y+100)
if A_ThisHotkey = Left
MouseMove, (x-100), (y)
if A_ThisHotkey = Right
MouseMove, (x+100), (y)
return |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
Ixoyer of Men
Joined: 18 Jan 2006 Posts: 11 Location: Coeur d'Alene, Idaho
|
Posted: Wed Jan 18, 2006 6:27 am Post subject: |
|
|
| ĦĦThank you, it works great!! |
|
| Back to top |
|
 |
Ixoyer of Men
Joined: 18 Jan 2006 Posts: 11 Location: Coeur d'Alene, Idaho
|
Posted: Fri Jan 20, 2006 5:33 am Post subject: |
|
|
| Now how would you move the mouse to a specific point via {ENTER}? |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1275
|
Posted: Fri Jan 20, 2006 7:09 am Post subject: |
|
|
| Code: | CoordMode, Mouse, Screen
Enter::
MouseMove, 200, 100
return |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Wed Jun 28, 2006 3:46 am Post subject: |
|
|
Maybe you can help me out, too. I am building a script that edits file folder names. The script uses Send, {Down} to select the next folder down in a tree listing. From there, running the script again will right-click the highlighted folder and select rename, and then perform its voodo.
But I do not know how to tell the mouse that it needs to move to the next folder name. Although the next folder name gets highlighted by the {down} command, the mouse is till focused on the last folder it processed. How can I tell the mouse the equivalent of "go to the highlighted folder"? _________________ Zoandar - new user - still learning. |
|
| Back to top |
|
 |
d-man
Joined: 08 Jun 2006 Posts: 247
|
Posted: Wed Jun 28, 2006 3:58 am Post subject: |
|
|
F2 is usually rename, maybe that will help? What is it you need to do with the mouse you can't do with the keyboard? (sorry, a little slow today  |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Wed Jun 28, 2006 4:09 am Post subject: |
|
|
Hmm. I hadn't thought of doing it with the keyboard, since the script I made to work so far was using the mouse. I guess I can shoot for that. The goal is to get the newly highlighted filename into the "edit" mode, so I can run the script on the name. I did try sending things like {home} and {end} so I could do the equivalent of holding shift and end to highlight the name, but it wasn't working.
But, of course, that would be a work-around, and not actually find a way to move the mouse in the fashion I was hoping for. I have been doing several hours of searching on the forum, and so far I haven't seen anybody else trying to do exactly this. Maybe there is no way to do it?
But I'll tackle it from a keyboard-oriented viewpoint, if I can. _________________ Zoandar - new user - still learning. |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Wed Jun 28, 2006 4:19 am Post subject: |
|
|
I tried
And it works! Thanks!! _________________ Zoandar - new user - still learning. |
|
| Back to top |
|
 |
d-man
Joined: 08 Jun 2006 Posts: 247
|
Posted: Wed Jun 28, 2006 4:33 am Post subject: |
|
|
also
| Code: | | Shift F10 will bring up context menu of selected file from any mouse position |
the keyboard is a powerful thing!!  |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Wed Jun 28, 2006 5:02 am Post subject: |
|
|
I agree! It is odd I didn't just go at it that way, because I use a fully programmable AnyKey keyboard, and, before I learned of AHK, all my "scripting" consisted of macros assigned to keys on it. I guess I had a case of brain fade!
Shift+F10 works, except that in the Paperport 11 program folder view, which is where this script will ultimately be put to serious work, the context menu that opens is proprietary to Paperport, and is quite different from that used by Windows Explorer. What you get is the following:
Folder Color
Folder Notes
Create New Folder...
Open Folder (grayed out)
Folder Manager
Copy
Paste (grayed out)
Delete
Copy to Folder
Move to Folder
Add to All-in-One Search
Sharing and Security
DesktopDelivery
Delete OCR Cache
Properties
Strangely, they chose to omit the Rename function! But you have some other options to rename a folder if you like. You can either slowly click the name twice, and it will switch to "rename mode", or, you can select Properties from the context menu. That opens a dialog window where, among other things, you can edit the name of the folder. I did not want to get involved in that, as it would add unnecessary time consumed in each renaming operation.
However, the F2 key DOES put a highlighted folder name into "rename mode" in Paperport 11, so I can use it.
I still remember the first time I learned ( way back in Windows 95) that you can navigate completely by keyboard and not even use the mouse! It later came in handy when for some reason my mouse or its driver had given me trouble and stopped working. I was able to shut down and restart Windows "correctly" without having to force a reset. _________________ Zoandar - new user - still learning. |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Wed Jun 28, 2006 6:01 am Post subject: A New Problem |
|
|
Well, now I have a new problem.
When the script runs in Paperport 11 folder view (much like Windows Explorer) the renamed folder immediately moves to its new position in the sorting scheme for the tree. What that means, is that I can no longer simply execute
to get to the next folder for renaming. Now, I need to establish a "base folder" at the top of the branch, to keep going back to, and then proceed forward by executing the above Send, {Down} code from there each time. The script now checks to make sure the selected folder name on each pass isn't already converted. If it is, it advances one more folder with another {Down} command.
I am trying to use the
| Code: |
SetWorkingDir %A_ScriptDir%
|
command, in the first line of the script, and place a folder at the top of the branch of the tree, put the AHK script file in that folder, and run the script from there. According to the Help File, if I understand it correctly, this forces the script to use the folder in which it is running as its working directory. What I THOUGHT would happen was that the script would cause that folder to get "focused" and select it each time the script ran. But that isn't happening.
So, I need a command that will select the script's folder, so I can start from there on each pass. I haven't been able to figure out which command to use. Any suggestions will be appreciated! _________________ Zoandar - new user - still learning. |
|
| Back to top |
|
 |
d-man
Joined: 08 Jun 2006 Posts: 247
|
Posted: Wed Jun 28, 2006 6:11 am Post subject: |
|
|
| I don't understand what you're saying, it's not clear to me. But why can't you just work with the files directly instead of through Paperport?! |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Wed Jun 28, 2006 7:46 am Post subject: |
|
|
I suppose I could. The folders are all visible from outside of Paperport just like any other folders. But I wanted to be able to do this from within the program, so I could take care of a few other Paperport-specific housekeeping tasks along the way ( like folder color assignments, conversion to PDF files, stacking of multiple files into a single "file" -- these tasks are all part of the Paperport program interface that are not easily available outside of the program).
I suppose it is difficult to picture if you aren't familiar with Paperport. The program is both wonderfully amazing and one of the biggest headaches I have ever owned. If it weren't that it is so capable of just about anything imaginable with a document or image file, I would have ditched it long ago. But NO ONE offers anything else even close.
The current problem has to do, apparently, with the way Paperport navigates its folders. But, I also have not actually tried the folder navigation part outside of Paperport either. I guess that will be my next step. I'll revert back to the central core of the script -- the changing of the folder name once it is selected -- which DOES work, and start trying to build the script to move from one folder to the next in Windows Explorer instead.
In Windows Explorer, you can set the view to sort by things other than the folder name, like the file date or type. So when you edit a folder name, the folder still stays in the same location on the tree branch. Paperport doesn't display those attributes in folder view. If you change the name of a folder there, it immediately moves to watever position it would have if sorted by name. For example. lets say you had 3 folders:
21 File Example
Another File
The Last File
These would fall as I listed them, in an alphabetic sort. If you changed
'The Last File''s name to something like '00 Last File' while in Explorer, the files would still reside in this same order, so long as you weren't sorting by file name.
But if you did that in the Paperport folder view, the new name for "00 Last File" would cause it to immediately jump up to the top of the list.
In my attempt to create a script that works its way down one file at a time, this is a bad thing, because now it is possible for files to move either above or below the point at which I am renaming. I could miss some files unintentionally.
That's why I wanted to be able to tell the script how to know where to go next in the list of files. From Paperport, the only option becomes having a file at the top of the list that never changes, and then jumping back to it (kind of like pressing the Home key in a drop-down list, before you press the down arrow to get where you want to go) so it could then proceed forward, making sure it checked every file on its way down the list each time.
Your solution to do this in Explorer will prove to be easier, no doubt. I guess I'll have to compromise and just do it that way.
Thanks for the help!! _________________ Zoandar - new user - still learning. |
|
| Back to top |
|
 |
Zoandar
Joined: 08 Jun 2006 Posts: 91 Location: Northern Ohio - USA
|
Posted: Thu Jun 29, 2006 5:22 am Post subject: |
|
|
Trying to work in Windows Explorer poses some problems that are non existent in Paperport.
For starters, I would not be able to use any kind of WinWaitxxxx command to keep the script focused to the Explorer window, because, according to Window Spy, and observing the top of the Explorer window by eye, the Window Title changes every time you move to a new folder!
In Paperport (don't ask me how??) it doesn't! So there is actually an advanatge to staying within Paperport...IF I can get the script to work the way I want it to. _________________ Zoandar - new user - still learning. |
|
| 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
|