AutoHotkey Community

It is currently May 27th, 2012, 6:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: April 4th, 2011, 8:57 pm 
Offline

Joined: May 22nd, 2006, 2:12 pm
Posts: 150
Hello!

First of all, thank you to all of you that have helped in the past. This forum has helped so much!

Anyway, here's my dilemma. I have a citrix application that identifies page types via a static list. The forms that we handle have a pre-set number of pages, and we have to ID each of the pages separately. I've gotten the script to mouse move the to first page of the form, and click on the form to ID it. What I'm looking for is how to increment the mousemove to move to page 2, page 3 and so on.

In my script, I have placed a mousegetpos to trap the last known position of the mouse. I would think this would work, as the items are listed one right after the other in order (for example, window spy shows page one is at 28,165, page 2 at 28,177). I was wondering how I'd add the value to the mousegetpos?

I envision that I would have a hotkey for each form type (roughly 25 forms). This would set the mouse position. On the next successive press of the same hotkey, it would zoom to the prior stored mouse coordinates, plus 12 on the Y axis until all the available pages in that form have been exhausted.

Any ideas on how to do this?


Code:
f1::
;If first press:
Sendplay {Click 249,132, down}{click 249, 239 , up}
Mousemove,38,170
Mouseclick,l,38,170
mousegetpos,xpos,ypos
If Second  or more presses:
;If press 1-8
Mousemove,%xpos%,%ypos%+12
;If press <8,Sendplay {Click 249,132, down}{click 249, 239 , up}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2011, 10:19 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
Your script listing did not anywhere include the coordinates you wrote about.
Fyi, it makes understanding easier when you show where the coords are used.

If I understand you, your 'forms' have tabs down the left side, approx 12 pixels apart.
When you click on a tab, manually or with AHk, it selects that 'page' pf the form.

If you wanted the same hotkey to switch between pages, I'd suggest the following script that I wrote that shows how to cycle through several mouse locations.
All moves are fixed, but relative to the current window. http://www.autohotkey.com/docs/commands/CoordMode.htm
So, it doesn't matter where the mouse was located before the hotkey is pushed.

I included F2 as a 'backwards' option

Code:
#singleinstance force

tab_x=28 ; x position of tabs does not change

y=165   ; the y starting position of the tabs

; create a list of items,
; this could be hard-coded to something like   ylist=165,177,189,201,213,225,237. . .
loop, 25
{
  ylist.=y ","
  y+=12
}



stringtrimright, ylist,ylist, 1 ; remove the trailing comma from prior operation
msgbox here's the list %ylist%

stringsplit, tab_y,ylist,`, ; split the list into an array, easier to access
;listvars
;msgbox

t_index=1
tooltip, ready for first page
  settimer, tooltip_hide, -1000
return

f1::
mousemove,tab_x, tab_y%t_index%
;Mouseclick ; <-------------------------- turn on tab clicking here
  tooltip, page %t_index%
t_index++
if t_index > %tab_y0%
{
  t_index=1
  tooltip, this is the last tab
}
settimer, tooltip_hide, -1000 ; using settimer 'releases' the ^k hotkey
return         ; therefore it can be used sooner
            ; -1000 means 1 second, and just once

f2::   ; switch tabs in backwards order
t_index-=2
if t_index <1
{
  t_index=1   ; your choice of stop at page 1
;  t_index+=25   ;   or wrap back around to 25
}
goto F1


;---------------- ; this clears the previous tooltip
tooltip_hide:
  tooltip
  return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2011, 7:03 pm 
Offline

Joined: May 22nd, 2006, 2:12 pm
Posts: 150
This is a partial of the script that I came up with. The one issue that I have with it is with the second script. The concept was that the first script would zip to the first page from the specified form type in the list (that part works), and would "store" the cursor location using the Mousegetpos.

The second script I had hoped would use that stored cursor location, add 12 pixels (the location of the the next page of that type) and so on. Unfortunately, it does seem to be grabbing the cursor position correctly for the second operation. Any ideas on what I'm doing wrong?



Code:
!I::
Sendplay {Click 249,132, down}{click 250, 242 , up}
Mousemove,30,223
Mouseclick,l,30,223
mousegetpos,mX,My
return

`::
Mousemove,%mX%,%mY%
Click,%mX%,%mY%
Mousemove, %mX%, % mY + 12
Mousegetpos,Mx,My
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2011, 8:54 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
>>Unfortunately, it does seem to be grabbing the cursor position correctly for the second operation. Any ideas on what I'm doing wrong?

Please review and clarify your remarks. In context, the first sentence above does not make sense.
I would have expected to see, "Unfortunately, it does not seem to be grabbing the cursor position correctly for the second operation.

If you meant the sentence as I re-wrote it, then one of us is confused.
It seems, to me, to perform exactly as you described you wanted.

Here is you script with a few mods, I added F1 & F2 'cause it is easier for me to hit.
I added a log of the mouse travels, result are below.
Code:
#singleinstance force
f1::
!I::
Sendplay {Click 249,132, down}{click 250, 242 , up}
Mousemove,30,223
Mouseclick,l,30,223
mousegetpos,mX,My
tooltip, % mx "|" my
mouse_travel.= mx "|" my "`n-----------`n"
return

f2::
`::
Mousemove,%mX%,%mY%
Click,%mX%,%mY%
Mousemove, %mX%, % mY + 12
Mousegetpos,Mx,My
tooltip, % mx "|" my
mouse_travel.= mx "|" my "`n"
return

f3::msgbox % mouse_travel

esc::exitapp

Code:
---------------------------
test.ahk
---------------------------
30|223
-----------
30|235
30|247
30|259
30|271
30|283
30|295
30|307

---------------------------
OK   
---------------------------


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2011, 8:59 pm 
Offline

Joined: May 22nd, 2006, 2:12 pm
Posts: 150
Thanks for the quick reply, and yes, you did understand my question despite the missing "not".

The difficulty that I am finding is that within the script there are many different hotkeys for different locations in the drop-down list. However, whenever I press the key for the second script (f2 in your example), the cursor doesn't move to the most recent location; instead it moves to a location 36 pixels from the top of the drop down list.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2011, 9:49 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
Please try my script, with notepad as the target window.
After pressing F1, and several of F2, press F3 to display the msgbox
Note: between each press of F2 you may move the mouse manually it will not affect the next location of F2.
While the msgbox is dsplayed, hitting ctl-c will copy the context to the clipboard.

Paste those contents in a reply.

Whoa :shock: Wait a minute...
>>The difficulty that I am finding is that within the script there are many >>different hotkeys for different locations in the drop-down list.

Do any of these other hotkeys, use "mousegetpos,mX,My" with the SPECIFIC variables Mx & My also used??
btw, variable names are not case sensitive so MX,mx,Mxand mX are all the same.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: batto, Exabot [Bot], JSLover and 61 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group