Old 05-13-2015, 10:30 AM   #1
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default AHK script: Move LICEcap window to mouse cursor

Download AHK:
http://www.autohotkey.com/


Move LICEcap window to mouse cursor.ahk:
Code:
#persistent
CoordMode, mouse,screen
SetTitleMatchMode 2 ; 2: A window's title can contain WinTitle anywhere inside it to be a match. 
DetectHiddenWindows, on
SetWinDelay, 10
#MaxThreadsPerHotkey 2

; detect window by window title:
;window_title = LICEcap
window_title = - LICEcap [recording]

toggle = 0

CapsLock::
  if (toggle = 0) {
    toggle = 1
    SetTimer, check, 10
  } 
  else {
    toggle = 0
    SetTimer, check, off
  }
return

check:
  MouseGetPos, xpos,ypos
  WinGetPos, X, Y, Width, Height, %window_title%
  WinMove, %window_title%,, xpos-(0.5*Width), ypos-(0.5*Height)
return
  • Save as Move LICEcap window to mouse cursor.ahk (for example)
  • For Windows 8 users, select the ahk file and "Run as administrator"
  • Exit the script as shown in the first gif below:




(CapsLock toggles the script on and off)

Last edited by spk77; 05-13-2015 at 10:36 AM.
spk77 is offline   Reply With Quote
Old 05-13-2015, 10:40 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,579
Default

So here were are. Scripting for LiceCap...

HAHA

Well done sir :P Could be useful !
X-Raym is offline   Reply With Quote
Old 05-13-2015, 10:47 AM   #3
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Thanks
I made a feature request here: http://forum.cockos.com/showthread.php?p=1519687

It would be nice if it was a native feature in LICEcap.
spk77 is offline   Reply With Quote
Old 05-13-2015, 01:15 PM   #4
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,901
Default

so great!
I would add a zone in the center that doesn't trigger the window moving. Only when approaching to the edges of the window it would move.
heda is offline   Reply With Quote
Old 05-13-2015, 02:29 PM   #5
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by heda View Post
so great!
I would add a zone in the center that doesn't trigger the window moving. Only when approaching to the edges of the window it would move.
Zone added



Code:
#persistent
CoordMode, mouse,screen
SetTitleMatchMode 2 ; 2: A window's title can contain WinTitle anywhere inside it to be a match. 
DetectHiddenWindows, on
SetWinDelay, 10
#MaxThreadsPerHotkey 2

; detect window by window title:
;window_title = LICEcap
window_title = - LICEcap [recording]
;window_title = stopped ; for debugging

toggle = 0

CapsLock::
  if (toggle = 0) {
    toggle = 1
    SetTimer, check, 10
  } 
  else {
    toggle = 0
    SetTimer, check, off
  }
return

check:
  MouseGetPos, mx, my
  WinGetPos, win_x, win_y, win_w, win_h, %window_title%
  dx := mx - win_x 
  dy := my - win_y
  rel_x := dx / win_w
  rel_y := dy / win_h
  ;tooltip %dx% %dy% %rel_x% %rel_y%
  
  if (rel_x <= 0.2) {
    new_x := mx-0.2*win_w
  }
  if (rel_x >= 0.8) {
    new_x := mx-0.8*win_w
  }
  if (rel_y <= 0.2) {
    new_y := my-0.2*win_h
  }
  if (rel_y >= 0.8) {
    new_y := my-0.8*win_h
  }
  
  WinMove, %window_title%,, new_x, new_y
return
Todo: Have to check how to get the client area dimensions (= borders and titlebar excluded)

Last edited by spk77; 05-13-2015 at 02:36 PM.
spk77 is offline   Reply With Quote
Old 05-13-2015, 06:23 PM   #6
Fergler
Human being with feelings
 
Fergler's Avatar
 
Join Date: Jan 2014
Posts: 4,239
Default

Thanks spk!

I will make great use of this, I'm sure
__________________
Check out my hip-hop, funk-rock band Theatre Crisp
Fergler is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.