ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Find And Run Robot

Display FARR Near Pointer

(1/1)

ewemoa:
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.

promotionThe script may end up as part of Nea.



--- Code: Autohotkey ---#SingleInstance#Persistent ; change this as desiredKeySequence := "^+p" ; XXX: may need to change thisFarrFullPath := 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

mouser:
neat.  :up:

Nod5:
nice  :up:

Tip: Autohotkey's variable A_ProgramFiles makes the default script compatible with different localized paths for the program files folder.

--- ---FarrFullPath = %A_ProgramFiles%\FindAndRunRobot\FindAndRunRobot.exeedit: I made a mistake in the code above (had both qoutes and %'s), fixed now.

ewemoa:
Thanks a lot for the tip, Nod5  :)

Think I'll update the original post.

Navigation

[0] Message Index

Go to full version