DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Display FARR Near Pointer  (Read 4,795 times)

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • Plugin Coding Medal
    • Participated in NANY Challenge Three Times
Display FARR Near Pointer
« on: December 07, 2011, 08:54 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.

promotion
The script may end up as part of Nea.

Code: (autohotkey)
#SingleInstance
#Persistent

; change this as desired
KeySequence := "^+p"

; XXX: may need to change this
FarrFullPath := A_ProgramFiles . "\FindAndRunRobot\FindAndRunRobot.exe"

CoordMode, Mouse, Screen

ShowFARRAtPointer()
{
  global FarrFullPath
  SplitPath, FarrFullPath, FarrExe
  Process, Exist, % FarrExe
  If (ErrorLevel != 0) ; yes FARR
  {
    MouseGetPos, X, Y
    Run, % FarrFullPath . " -show"
    WinWaitActive, % "Find and Run Robot 2 ahk_class TMainForm"
    If (ErrorLevel == 1)
    {
      OutputDebug, % "WinWaitActive timed out waiting for FARR"
      Return
    }
    ; XXX: will this work for multi-display set-ups?
    WinMove, % "Find and Run Robot 2 ahk_class TMainForm", , % X, % Y
  }
  Else ; no FARR
  {
    ; OK/Cancel - esc dismisses dialog
    MsgBox, 1, % "Did Not Find Running FARR"
          , % "FARR doesn't seem to be running.`n`nOk to start FARR?"
    IfMsgBox, OK
    {
      Run, % FarrFullPath
    }
  }
  Return
}

Hotkey, % KeySequence, DoShowFARRAtPointer

Return

DoShowFARRAtPointer:
{
  ShowFARRAtPointer()
  Return
}

Updated: as per Nod5's suggestion to use A_ProgramFiles
« Last Edit: December 07, 2011, 11:19 PM by ewemoa »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Display FARR Near Pointer
« Reply #1 on: December 07, 2011, 12:55 PM »
neat.  :up:

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,175
    • Coding Snacks
    • Participated in NANY Challenge Three Times
    • Plugin Coding Medal
Re: Display FARR Near Pointer
« Reply #2 on: December 07, 2011, 05:28 PM »
nice  :up:

Tip: Autohotkey's variable A_ProgramFiles makes the default script compatible with different localized paths for the program files folder.
Code
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, 11:22 PM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • Plugin Coding Medal
    • Participated in NANY Challenge Three Times
Re: Display FARR Near Pointer
« Reply #3 on: December 07, 2011, 11:17 PM »
Thanks a lot for the tip, Nod5  :)

Think I'll update the original post.

Original address: https://www.donationcoder.com/forum/index.php?topic=29176.0