Welcome Guest.   Make a donation to an author on the site December 22, 2014, 08:19:49 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2011! Download 30+ custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Display FARR Near Pointer  (Read 1224 times)
ewemoa
Honorary Member
**
Posts: 2,524



View Profile Give some DonationCredits to this forum member
« on: December 07, 2011, 02:54:06 AM »

The following AHK_L script should display FARR's main window and then move it close to the pointer.  I use this when there's something near the pointer I want to drop in FARR's main window (reduce dragging distance and hence risk of mis-drop).

May want to tweak the full path to FARR's exe (see FarrFullPath in code) and/or the hotkey (see KeySequence in code).

Tested on XP SP3 and 7 Pro SP1.


Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1.  
  2. ; change this as desired
  3. KeySequence := "^+p"
  4.  
  5. ; XXX: may need to change this
  6. FarrFullPath := A_ProgramFiles . "\FindAndRunRobot\FindAndRunRobot.exe"
  7.  
  8. CoordMode, Mouse, Screen
  9.  
  10. ShowFARRAtPointer()
  11. {
  12.  global FarrFullPath
  13.  SplitPath, FarrFullPath, FarrExe
  14.  Process, Exist, % FarrExe
  15.  If (ErrorLevel != 0) ; yes FARR
  16.  {
  17.    MouseGetPos, X, Y
  18.    Run, % FarrFullPath . " -show"
  19.    WinWaitActive, % "Find and Run Robot 2 ahk_class TMainForm"
  20.    If (ErrorLevel == 1)
  21.    {
  22.      OutputDebug, % "WinWaitActive timed out waiting for FARR"
  23.      Return
  24.    }
  25.    ; XXX: will this work for multi-display set-ups?
  26.    WinMove, % "Find and Run Robot 2 ahk_class TMainForm", , % X, % Y
  27.  }
  28.  Else ; no FARR
  29.  {
  30.    ; OK/Cancel - esc dismisses dialog
  31.    MsgBox, 1, % "Did Not Find Running FARR"
  32.          , % "FARR doesn't seem to be running.`n`nOk to start FARR?"
  33.    IfMsgBox, OK
  34.    {
  35.      Run, % FarrFullPath
  36.    }
  37.  }
  38. }
  39.  
  40. Hotkey, % KeySequence, DoShowFARRAtPointer
  41.  
  42.  
  43. DoShowFARRAtPointer:
  44. {
  45.  ShowFARRAtPointer()
  46. }

Updated: as per Nod5's suggestion to use A_ProgramFiles
« Last Edit: December 07, 2011, 05:19:27 PM by ewemoa » Logged
mouser
First Author
Administrator
*****
Posts: 33,795



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: December 07, 2011, 06:55:34 AM »

neat.  thumbs up
Logged
Nod5
Supporting Member
**
Posts: 749



View Profile Give some DonationCredits to this forum member
« Reply #2 on: December 07, 2011, 11:28:03 AM »

nice  thumbs up

Tip: Autohotkey's variable A_ProgramFiles makes the default script compatible with different localized paths for the program files folder.
[copy or print]
FarrFullPath = %A_ProgramFiles%\FindAndRunRobot\FindAndRunRobot.exe
edit: I made a mistake in the code above (had both qoutes and %'s), fixed now.
« Last Edit: December 07, 2011, 05:22:45 PM by Nod5 » Logged
ewemoa
Honorary Member
**
Posts: 2,524



View Profile Give some DonationCredits to this forum member
« Reply #3 on: December 07, 2011, 05:17:56 PM »

Thanks a lot for the tip, Nod5  smiley

Think I'll update the original post.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.055s | Server load: 0.2 ]