Author Topic: AutoHotKey: Share your Scripts!  (Read 34538 times)

0 Members and 1 Guest are viewing this topic.

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« on: Fri, 13 May 2011, 12:35:04 »
Hi there guys,

I don't know if there's already a section or a thread about this, but I wanted to start this so we share our tweaks with AutoHotKey and other Scripts.

First off, for those who don't know; AutoHotKey is a program that allows you to achieve multiple things with your keyboard and mouse. You can do things like remapping keys to more advanced or complex ones like making macros, lunching aplications, setting up key combinations for media controls, etc.

After I found this option/solution, it didn't no longer matter for me if a keyboard had media keys, keys to lunch applications and lately I don't care that much about the layout (since I speak spanish, I used to use 105 key layout with the big enter key).

A couple of days ago I got amazed while reading the tutorials of the program and what you can do with it, so fellow GeekHackers that already use AutoHotKeys, what scripts do you have?

Feel free to share them here!

Regards,
Zet

PS: right now, I only have altgr+, to"<" and altgr+. to ">" which both symbols I can't normally do if I use a 104 US layout keyboard config~ as a 105 keyboard, since those are the symbols I can't get because of the missing key.

Offline Dox

  • Posts: 312
AutoHotKey: Share your Scripts!
« Reply #1 on: Fri, 13 May 2011, 12:57:39 »
Scroll your mouse wheel over your windows taskbar and change your volume!

Code: [Select]
#If MouseIsOver(&quot;ahk_class Shell_TrayWnd&quot;)
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}

MouseIsOver(WinTitle)
{
    MouseGetPos,,, Win
    return WinExist(WinTitle . &quot; ahk_id &quot; . Win)
}
ErgoDox x2 | DoxKB x2 |   IBM SSK   | HHKB pro2

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #2 on: Fri, 13 May 2011, 13:13:09 »
Because that's 3 characters and the use of {} is for sending 1 key/character.

Code: [Select]
#F7::
{
Send &#3232;_&#3232;
}
return
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Dox

  • Posts: 312
AutoHotKey: Share your Scripts!
« Reply #3 on: Fri, 13 May 2011, 13:13:29 »
Quote from: ripster;345802
OK AutoHotkey whizzes - why can't I get this one to work?
Code: [Select]

#F7::
{
SendInput {&#3232;_&#3232;}
}
return


Current AHK build.  Works with other unicodes.

ಠ_ಠ

 
This one works fine with me.
Code: [Select]
F6::send ಠ_ಠ
ಠ_ಠ
You just can't make it in notepad as it doesn't support those ಠ characters.

I've done it in VS2010.
ErgoDox x2 | DoxKB x2 |   IBM SSK   | HHKB pro2

Offline elef

  • Posts: 146
AutoHotKey: Share your Scripts!
« Reply #4 on: Fri, 13 May 2011, 15:40:15 »
Quote from: Dox;345798
Scroll your mouse wheel over your windows taskbar and change your volume!

Code: [Select]
#If MouseIsOver(&quot;ahk_class Shell_TrayWnd&quot;)
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}

MouseIsOver(WinTitle)
{
    MouseGetPos,,, Win
    return WinExist(WinTitle . &quot; ahk_id &quot; . Win)
}

That's impressive and useful, thanks!

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #5 on: Fri, 13 May 2011, 15:47:41 »
Well, since Win-L is lock, I set shift-Win-L to logout:
Code: [Select]
#+L::
  Shutdown 0
return

Inhibit CapsLock, but Win-Caps is lock if I need it, also have CapsLock as a modifier for a bunch of other keys
Code: [Select]
CapsLock::
*+CapsLock::
*!CapsLock::
*^CapsLock::

return

#CapsLock::
  getkeystate,caps,capslock,t
  if caps = D
    setcapslockstate,off
  else
    setcapslockstate,on
  return
return

Sleep button (Win-Pause):
Code: [Select]
#Pause::
  DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
return


Also have a hack of a script available from the AHK forums that does volume on my mouse wheel (with Win-key) with an OSD.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Dox

  • Posts: 312
AutoHotKey: Share your Scripts!
« Reply #6 on: Fri, 13 May 2011, 16:37:12 »
Quote from: ripster;345884
It's like the Windows key is "stuck" without a break.  H won't type until I hit the Windows key (took a while to figure this one out - thought Webwit gave me a virus).
I had this problem too I think it depends on your release order of the keys.
Something I've done that seem to help is to add "send {RWin Up} | send {LWin Up}" at the end of your script.
ErgoDox x2 | DoxKB x2 |   IBM SSK   | HHKB pro2

Offline kpeezy

  • Posts: 55
AutoHotKey: Share your Scripts!
« Reply #7 on: Fri, 13 May 2011, 16:56:43 »
Quote from: Dox;345798
Scroll your mouse wheel over your windows taskbar and change your volume!

Code: [Select]
#If MouseIsOver(&quot;ahk_class Shell_TrayWnd&quot;)
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}

MouseIsOver(WinTitle)
{
    MouseGetPos,,, Win
    return WinExist(WinTitle . &quot; ahk_id &quot; . Win)
}

We should post the OS we're using. I tested this on a VM and confirmed it only works in Windows XP. Doesn't work in W7. I really like this script though.

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #8 on: Fri, 13 May 2011, 16:59:09 »
Quote from: ripster;345884

This one gives me an odd behaviour.  
Code: [Select]
;Win+F6 to send RipOmeter url
#F6::Send [url=http://geekhack.org/showwiki.php?title=Island:6189]RipOmeter[/h]
return

It's like the Windows key is "stuck" without a break.  H won't type until I hit the Windows key (took a while to figure this one out - thought Webwit gave me a virus).


That is strange, my arrow keys get stuck, but all my alpha keys work.  What's even weirder is what fixed it:

Code: [Select]
#F6::
Send [url=http://geekhack.org/showwiki.php
Send ?title=Island:6189]RipOmeter[/h]
return
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #9 on: Fri, 13 May 2011, 17:00:47 »
Quote from: kpeezy;345899
We should post the OS we're using. I tested this on a VM and confirmed it only works in Windows XP. Doesn't work in W7. I really like this script though.

Win7 Volume control is very complicated.  When I get some time I'll post the stripped down script, but it involves downloading a library or 2 depending on which version of AHK you're using.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Brodie337

  • Posts: 414
AutoHotKey: Share your Scripts!
« Reply #10 on: Fri, 13 May 2011, 17:25:17 »
I dont have issues with volume control. Here's mine:
Code: [Select]
+Pause::Send {Media_Next}
return

+PrintScreen::Send {Media_Prev}
return

+ScrollLock::Send {Media_Play_Pause}
return

!WheelDown::Send {Volume_Down}

!WheelUp::Send {Volume_Up}

!Mbutton::Send {Volume_Mute}

^!LControl::Suspend ;Some games need capslock

capslock::Lcontrol

!+WheelDown::Send {Media_Next}
return

!+WheelUp::Send {Media_Prev}
return

!+Mbutton::Send {Media_Play_Pause}
return


I've got two extra buttons on my G700 mouse set to Alt and Alt + Shift.

EDIT: This is on Windows 7, 64 bit.

Offline Dox

  • Posts: 312
AutoHotKey: Share your Scripts!
« Reply #11 on: Fri, 13 May 2011, 18:12:50 »
Quote from: kpeezy;345899
We should post the OS we're using. I tested this on a VM and confirmed it only works in Windows XP. Doesn't work in W7. I really like this script though.

I'm running this script on Win 7 Ultimate x64 and XP x86 and it works fine on both machine.
ErgoDox x2 | DoxKB x2 |   IBM SSK   | HHKB pro2

Offline Ich

  • Posts: 2
AutoHotKey: Share your Scripts!
« Reply #12 on: Fri, 13 May 2011, 18:43:25 »
Quote from: ripster;345884

This one gives me an odd behaviour.  
Code: [Select]

;Win+F6 to send RipOmeter url
#F6::Send [url=http://geekhack.org/showwiki.php?title=Island:6189]RipOmeter[/h]
return


It's like the Windows key is "stuck" without a break.  H won't type until I hit the Windows key (took a while to figure this one out - thought Webwit gave me a virus).


I don't have issues with this (Win XP).
But the Windows key isn't the best modifier key.
("Win (Windows logo key). In v1.0.48.01+, for Windows Vista and later, hotkeys that include the Windows key (e.g. #a) will wait for the Windows key to be released before sending any text containing an "L" keystroke. This prevents the Send within such a hotkey from locking the PC. This behavior applies to all sending modes except SendPlay (which doesn't need it) and blind mode.")

I would use the clipboard for such long things:

Code: [Select]
#F6::
 Clipboard = [url=http://geekhack.org/showwiki.php?title=Island:6189]RipOmeter[/h]
 Send ^v
return

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #13 on: Fri, 13 May 2011, 19:47:36 »
Quote from: Ich;345934
I would use the clipboard for such long things:

Code: [Select]
#F6::
 Clipboard = [url=http://geekhack.org/showwiki.php?title=Island:6189]RipOmeter[/h]
 Send ^v
return

Extra points if you save the previous clipboard contents and put them back when you're done.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline kpeezy

  • Posts: 55
AutoHotKey: Share your Scripts!
« Reply #14 on: Fri, 13 May 2011, 19:53:23 »
Quote from: Dox;345925
I'm running this script on Win 7 Ultimate x64 and XP x86 and it works fine on both machine.

Hmm, it works on my W7 box at home but not at work. The image at work doesn't have anything unusual so I'm not sure what's going on. Thanks.

edit: my work machine isn't 64 bit so maybe that is the issue.
« Last Edit: Fri, 13 May 2011, 20:03:36 by kpeezy »

Offline daerid

  • Posts: 4276
  • Location: Denver, CO
    • Rossipedia
AutoHotKey: Share your Scripts!
« Reply #15 on: Fri, 13 May 2011, 19:55:25 »
AHK rocks. Right now I'm only using it for launching specific programs with Win+Alt combinations.

Offline Ich

  • Posts: 2
AutoHotKey: Share your Scripts!
« Reply #16 on: Sat, 14 May 2011, 00:35:09 »
Quote from: alaricljs;345944
Extra points if you save the previous clipboard contents and put them back when you're done.


Yes, this could be done too (if someone needs this):
Code: [Select]
#F6::
 ClipSaved := ClipboardAll
 Clipboard = [url=http://geekhack.org/showwiki.php?title=Island:6189]RipOmeter[/h]
 Send ^v
 Clipboard := ClipSaved
 ClipSaved =
return

Offline daerid

  • Posts: 4276
  • Location: Denver, CO
    • Rossipedia
AutoHotKey: Share your Scripts!
« Reply #17 on: Sat, 14 May 2011, 01:40:17 »
From what I can tell, that would allow you to automatically paste in the RipOMeter URL without thrashing your current clipboard.

Although, it seems a fairly roundabout way of doing that considering you can just have AHK send the keystrokes directly.

Offline daerid

  • Posts: 4276
  • Location: Denver, CO
    • Rossipedia
AutoHotKey: Share your Scripts!
« Reply #18 on: Sat, 14 May 2011, 01:48:11 »
Ok, I see why it was done that way.... using Send/SendRaw is WAAAAY slower.

Offline niz

  • Posts: 23
AutoHotKey: Share your Scripts!
« Reply #19 on: Sat, 14 May 2011, 02:36:39 »
Have always found this one quite useful...and simple!
Code: [Select]
PRINTSCREEN::
Run C:\Windows\Sysnative\SnippingTool.exe
return

**w/ Win7
       Filco Blue
[SIGPIC][/SIGPIC]

Offline daerid

  • Posts: 4276
  • Location: Denver, CO
    • Rossipedia
AutoHotKey: Share your Scripts!
« Reply #20 on: Sat, 14 May 2011, 03:18:35 »
Quote from: niz;346057
Have always found this one quite useful...and simple!
Code: [Select]
PRINTSCREEN::
Run C:\Windows\Sysnative\SnippingTool.exe
return

**w/ Win7

Okay, that's just damned awesome

Offline sinani206

  • Posts: 16
AutoHotKey: Share your Scripts!
« Reply #21 on: Sat, 14 May 2011, 09:56:46 »
I made AltGr+G to ㅈ because I play StarCraft II and I'm super gosu cool.
gg -> ㅈㅈ ftw

Offline NimbleRabit

  • Posts: 137
AutoHotKey: Share your Scripts!
« Reply #22 on: Sat, 14 May 2011, 11:07:14 »
I'm using this script for volume in windows 7, I love having the little display.

Thanks for the printscreen -> SnippingTool idea, that's pretty slick.

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #23 on: Sat, 14 May 2011, 11:49:39 »
Quote from: NimbleRabit;346164
I'm using this script for volume in windows 7, I love having the little display.

Thanks for the printscreen -> SnippingTool idea, that's pretty slick.

That's the volume script I'm using modified to the Win+mousewheel and win+0/-/=  (mute/down/up)

Snippingtool... lived so long with printscreen/ctrl-printscreen and irfanview that I never knew that existed.  Think I still like the irfanview route better.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #24 on: Sat, 14 May 2011, 23:18:58 »
Quote from: daerid;345949
AHK rocks. Right now I'm only using it for launching specific programs with Win+Alt combinations.

Well between all the uses for autohotkey, to be honest, the less useful is that IMO, since you can already config win7 to do something similar.

You can achieve this in two ways.
Have them on your taskbar, so that way, win+#  depending on their position on the taskbar will determine their number.
Have an icon on your desktop, right click it, properties and configure the short key combination there, but this ones If I'm not wrong only will work for ctrl+alt+# where # can be a letter, symbol or number. That way you don't have to get a script running.


=====

Also, can someone please share the scripts code to have a key combo set for the "stop" loading on the web browsers? I don't know which one that would be...

Offline Bear715

  • Posts: 7
AutoHotKey: Share your Scripts!
« Reply #25 on: Thu, 19 May 2011, 12:43:43 »
Do any of you have a good numpad replacement setup for a tenkeyless?  I realize that I do miss it sometimes.
I tried using
#i::Numpad7
#o::Numpad8
#p::Numpad9
#k::Numpad4
#l::Numpad5
#;::Numpad6
#,::Numpad1
#.::Numpad2
#/::Numpad3

but windows key and L will try to lock the computer and doesnt seem to want to override.  I am not in love with this replacement layout, either, so Im open to suggestions. Complete noob in autohotkey btw

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #26 on: Thu, 19 May 2011, 13:45:46 »
If you don't use the stock windows Win-key hotkeys (M is minimize all, D is desktop, L is lock, R is Run... and so on) then you can disable them...  google for it cuz I'm working and lazy at the same time.

Once they are disabled in windows AHK will work with those combos.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #27 on: Thu, 19 May 2011, 14:15:25 »
another option you have is to use a different modifier than the windows key :) try shift+alt, ctrl+alt, altgr....

Offline NimbleRabit

  • Posts: 137
AutoHotKey: Share your Scripts!
« Reply #28 on: Thu, 19 May 2011, 14:20:33 »
I think if you use the SEND command it works better with the windows keybinds, at least I've had that experience.

Like:

#l::SEND {Numpad5}

Give it a shot and see if that works.  I don't know why but that has fixed problems for me before.

Offline Bear715

  • Posts: 7
AutoHotKey: Share your Scripts!
« Reply #29 on: Thu, 19 May 2011, 14:48:16 »
Quote from: harrison;348573
I'm working on mashing a few scripts that create a new 'tenlock' function, which results in flashing both the scroll and caps LEDs when it's enabled.

I eagerly await your script.  Sounds interesting
I combined help from nimble and zet to make something work for now.  I don't know if ill like it or if somethign better will come up but it works for my purposes for now.  Thanks nimble and zet =)

^!i::SEND {Numpad7}
^!o::SEND {Numpad8}
^!p::SEND {Numpad9}
^!k::SEND {Numpad4}
^!l::SEND {Numpad5}
^!;::SEND {Numpad6}
^!,::SEND {Numpad1}
^!.::SEND {Numpad2}
^!/::SEND {Numpad3}
^!space::SEND {Numpad0}

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #30 on: Thu, 19 May 2011, 14:57:59 »
No problem bro, I'm glad that I was of help.
By the way, this lead me to think how this would work if the "keypad" keys were to be set on a different place than regular, i.e. 123, qwe, asd, zxc also it's interesting to have the option to have specific mods for the scripts, since I tend to use only the left side alt, ctrl, shift, perhaps using the right ones would be a improve to avoid errors...

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
AutoHotKey: Share your Scripts!
« Reply #31 on: Thu, 19 May 2011, 15:55:36 »
Quote from: alaricljs;345876
Also have a hack of a script available from the AHK forums that does volume on my mouse wheel (with Win-key) with an OSD.

 
alaricljs, where can I find your mouse wheel volume script with OSD?  Thanks.

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #32 on: Thu, 19 May 2011, 18:02:04 »
Quote from: NimbleRabit;346164
I'm using this script for volume in windows 7, I love having the little display.
Quote from: alaricljs;346182
That's the volume script I'm using modified to the Win+mousewheel and win+0/-/=  (mute/down/up)
Quote from: litster;348676
alaricljs, where can I find your mouse wheel volume script with OSD?  Thanks.

Ok, so that link above is to the original source at AHK, it requires this library.  And here's my hacked up version that includes win-mousewheel and some other mods.  Note also the Win-o/p/[/]/\ media controls.

Code: [Select]
#NoEnv
#SingleInstance force
SendMode Input

;SetFormat, float, 0.0
;SetBatchLines 10ms
SetBatchLines -1
SetTitleMatchMode 2
DetectHiddenWindows On
CoordMode Mouse, Screen

;COM_Init()
vol_Master := VA_GetMasterVolume()

; The percentage by which to raise or lower the volume each time
vol_Step = 3
; How long to display the volume level bar graphs (in milliseconds)
vol_DisplayTime = 1000
; Transparency of window (0-255)
vol_TransValue = 255
; Transparent background (1/0/true/false) (takes precedence over Window trans,
;   can have only 1 or other, not both)
vol_TransBack = 0
; Bar's background colour
vol_CW = Black  
vol_Width = 200  ; width of bar
vol_Thick = 20   ; thickness of bar
; Bar's screen position
;vol_PosX := A_ScreenWidth - vol_Width - 50
;vol_PosY := A_ScreenHeight - vol_Thick - 100
vol_PosX := 250
vol_PosY := A_ScreenHeight - vol_Thick - 100
; --------------------
; END OF CONFIGURATION
; --------------------
vol_BarOptionsMaster = 1:B ZH%vol_Thick% ZX8 ZY4 W%vol_Width% X%vol_PosX% Y%vol_PosY% CW%vol_CW%
vol_MuteChange = 0
return


;------------ End if initialization section ----------------

;Exit


$Volume_Down::
#WheelDown::
#-::
  If vol_Master > .01
    VA_SetMasterVolume(vol_Master-=vol_Step)
  Gosub, vol_ShowBars

return

$Volume_Up::
#WheelUp::
#=::
  If vol_Master <= 99
    VA_SetMasterVolume(vol_Master+=vol_Step)
  Gosub, vol_ShowBars

return

Volume_Mute::
#MButton::
#0::
  If ( VA_GetMasterMute() ) {
    VA_SetMasterMute(False)
    vol_MuteChange = 1
  } Else {
    VA_SetMasterMute(True)
    vol_MuteChange = 1
  }
  Gosub, vol_ShowBars

return


#o::
  Send {Media_Stop}
return

#p::
  Send {Media_Play_Pause}
return

#[::
  Send {Media_Prev}
return

#]::
  Send {Media_Next}
return


;  Start Winamp or Open Music Folder
;  Player Window
;  M:\

#\::
Launch_Media::
  IfWinExist Player Window
    IfWinExist M:\
      IfWinActive M:\
        WinClose
      else
        WinActivate
    else
      Run M:\
  else
    Run C:\Program Files (x86)\Winamp\winamp.exe

return

;------------------- Start Volume display ------------------------
vol_ShowBars:
; Get volumes in case the user or an external program changed them:
vol_Master := VA_GetMasterVolume()
vol_Mute := VA_GetMasterMute()
if (vol_Mute)
{
  vol_Colour = Red    
  vol_Text = Volume (muted)
}
else
{
  vol_Colour = Green  
  vol_Text = Volume
}
; To prevent the &quot;flashing&quot; effect, only create the bar window if it doesn't already exist:
NED := 0
IfWinNotExist, VolumeOSDxyz
  NED := 1
If (vol_MuteChange or NED)
{
    Progress, %vol_BarOptionsMaster% CB%vol_Colour% CT%vol_Colour%, , %vol_Text%, VolumeOSDxyz
    WinSet, Transparent, %vol_TransValue%, VolumeOSDxyz
    if (vol_TransBack)
      WinSet, TransColor, %vol_CW%, VolumeOSDxyz

  vol_MuteChange = 0
}
Progress, 1:%vol_Master%, , %vol_Text%
SetTimer, vol_BarOff, %vol_DisplayTime%
return


vol_BarOff:
SetTimer, vol_BarOff, off
Progress, 1:Off
return

;-------------------- End Volume display -------------------------

Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #33 on: Thu, 19 May 2011, 18:13:08 »
alaricljs I'm loving that idea, I'll use it I think, if somehow I can't get it to work, I'll contact you.
Thanks for the input on this!!!

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
AutoHotKey: Share your Scripts!
« Reply #34 on: Thu, 19 May 2011, 18:57:34 »
Thanks for the script.  It wouldn't run until also copied and pasted VA.ahk into the same script file.  But it works now.  Now I really want the Topre 87U with the right Windows key because sometimes I use my left hand for mouse.  Yes, I switch mouse left and right to share wrist pain across both hands.

Thanks!

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
AutoHotKey: Share your Scripts!
« Reply #35 on: Sun, 22 May 2011, 23:15:06 »
I figured it out.  The VA.ahk needs to go to C:\Program Files (x86)\AutoHotkey\Lib.  Thanks.

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #36 on: Sun, 22 May 2011, 23:43:42 »
Woah it took me long to get it to work, what really helped me was adding the VA code into the script that was posted. Then I left it on my desktop and ran it flawlessly :D

Also, I upgraded to AHK_L and added /lib folder with VA21 and COM_L libs, just for the record.

I'm really liking this scripts and stuff, I'll really look more into it, I love programing :)

An idea just came up to my head, for a script to block my keyboard and avoid in another way, people using it to unlock my session at work (other programers, really childish ones willing to bother); lets say you want to go lunch and you fear someone saw or knows your password... so they could unlock the session and get on your desktop...
but you could remap all your keys to, lets say 'a' and have the script terminate itself or remaps again properly only when a certain key combination is pressed down ;)

I don't know, there's so many other scripts that could be handy depending situations... ^_^

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #37 on: Wed, 01 June 2011, 23:12:50 »
Quote from: alaricljs;348717
Ok, so that link above is to the original source at AHK, it requires this library.  And here's my hacked up version that includes win-mousewheel and some other mods.  Note also the Win-o/p/[/]/\ media controls.

Code: [Select]

#NoEnv
#SingleInstance force
SendMode Input

;SetFormat, float, 0.0
;SetBatchLines 10ms
SetBatchLines -1
SetTitleMatchMode 2
DetectHiddenWindows On
CoordMode Mouse, Screen

;COM_Init()
vol_Master := VA_GetMasterVolume()

; The percentage by which to raise or lower the volume each time
vol_Step = 3
; How long to display the volume level bar graphs (in milliseconds)
vol_DisplayTime = 1000
; Transparency of window (0-255)
vol_TransValue = 255
; Transparent background (1/0/true/false) (takes precedence over Window trans,
;   can have only 1 or other, not both)
vol_TransBack = 0
; Bar's background colour
vol_CW = Black  
vol_Width = 200  ; width of bar
vol_Thick = 20   ; thickness of bar
; Bar's screen position
;vol_PosX := A_ScreenWidth - vol_Width - 50
;vol_PosY := A_ScreenHeight - vol_Thick - 100
vol_PosX := 250
vol_PosY := A_ScreenHeight - vol_Thick - 100
; --------------------
; END OF CONFIGURATION
; --------------------
vol_BarOptionsMaster = 1:B ZH%vol_Thick% ZX8 ZY4 W%vol_Width% X%vol_PosX% Y%vol_PosY% CW%vol_CW%
vol_MuteChange = 0
return


;------------ End if initialization section ----------------

;Exit


$Volume_Down::
#WheelDown::
#-::
  If vol_Master > .01
    VA_SetMasterVolume(vol_Master-=vol_Step)
  Gosub, vol_ShowBars

return

$Volume_Up::
#WheelUp::
#=::
  If vol_Master <= 99
    VA_SetMasterVolume(vol_Master+=vol_Step)
  Gosub, vol_ShowBars

return

Volume_Mute::
#MButton::
#0::
  If ( VA_GetMasterMute() ) {
    VA_SetMasterMute(False)
    vol_MuteChange = 1
  } Else {
    VA_SetMasterMute(True)
    vol_MuteChange = 1
  }
  Gosub, vol_ShowBars

return


#o::
  Send {Media_Stop}
return

#p::
  Send {Media_Play_Pause}
return

#[::
  Send {Media_Prev}
return

#]::
  Send {Media_Next}
return


;  Start Winamp or Open Music Folder
;  Player Window
;  M:\

#\::
Launch_Media::
  IfWinExist Player Window
    IfWinExist M:\
      IfWinActive M:\
        WinClose
      else
        WinActivate
    else
      Run M:\
  else
    Run C:\Program Files (x86)\Winamp\winamp.exe

return

;------------------- Start Volume display ------------------------
vol_ShowBars:
; Get volumes in case the user or an external program changed them:
vol_Master := VA_GetMasterVolume()
vol_Mute := VA_GetMasterMute()
if (vol_Mute)
{
  vol_Colour = Red    
  vol_Text = Volume (muted)
}
else
{
  vol_Colour = Green  
  vol_Text = Volume
}
; To prevent the &quot;flashing&quot; effect, only create the bar window if it doesn't already exist:
NED := 0
IfWinNotExist, VolumeOSDxyz
  NED := 1
If (vol_MuteChange or NED)
{
    Progress, %vol_BarOptionsMaster% CB%vol_Colour% CT%vol_Colour%, , %vol_Text%, VolumeOSDxyz
    WinSet, Transparent, %vol_TransValue%, VolumeOSDxyz
    if (vol_TransBack)
      WinSet, TransColor, %vol_CW%, VolumeOSDxyz

  vol_MuteChange = 0
}
Progress, 1:%vol_Master%, , %vol_Text%
SetTimer, vol_BarOff, %vol_DisplayTime%
return


vol_BarOff:
SetTimer, vol_BarOff, off
Progress, 1:Off
return

;-------------------- End Volume display -------------------------


 

Hey bro, I can't get the win=o,p,[,] to work, could this be due to the fact that I use vlc as media player? also I mod~ the address of winamp on the script to the one where the vlc is, for the win+\, but it's also not required for me since I have vlc on my taskbar and I usually win+number it, but would the script do, if I have a partition set to M: it would open it, instead of opening vlc, right? and I suppose that M:\ is where my music folder would be?

Thanks in advance for your help!

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #38 on: Thu, 02 June 2011, 12:05:42 »
I don't recall if it's required to disable the default Win7 win-key combos.  I disabled them quite a while before coming up with this media key layout.  Other than that you have to make sure that whatever media player you are using knows to latch onto the standard media key events.  Never used VLC.

Yes, the 'Launch_Media' is setup to start winamp (you'll have to dig the window details for VLC with Window Spy) if it's not running and to handle the Media Folder if it is running.  My M: drive is a mapping of my server's music storage.  You can change M: to anything you want really, it just needs to be what is in the window title.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #39 on: Thu, 02 June 2011, 15:12:52 »
Yes, thanks, I got it to lunch VLC instead winamp, which I don't use. Will now try to have it working for my music directory.
By the way I recommend you try VLC, is really good. The only thing I don't like that much is the library management it's easier with other programs.

I'll continue my journeys into the AutoHotKey forums, since I'm really into getting some nice scripts for my keyboard, if I find something awesome, I'll come to share it with you guys here.

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #40 on: Thu, 02 June 2011, 15:39:29 »
All my audio management is via the organization of my folders (artist\albums\tracks).  Winamp is just the pretty display and the transport.  I run it window shaded and tuck it down at the bottom, there's a pic in the 'desktop clutter' thread...

Here we go.
« Last Edit: Thu, 02 June 2011, 15:45:03 by alaricljs »
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline looserboy

  • Posts: 73
AutoHotKey: Share your Scripts!
« Reply #41 on: Thu, 02 June 2011, 16:05:37 »
very informative thread, thank you guys for this one, rly, now i could make { and } on my capslock :D
{ = only press capslock and alt gr + capslock = }

never heard about autohotkey^^ so i am very happy right now :)

Cherry: G80 MX11900blacks  - G80 MX1800 blacks - G80 MX1502 blacks all cards  - G81 MY 8005 ins. cards - G81 MY 3000 modded to 20g (HowTo)
NMB SPACEINVADER white
Noppo: Choc Pro browns  - Choc Mini reds
IBM: Model F IBM: Model M SSK IBM: Model M

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #42 on: Thu, 02 June 2011, 16:09:05 »
I'm glad this was of help. Perhaps I'll add this to the wiki, make a list of the scripts and such, for others to have a look, and try them in a easy way. We could even upload the compiled versions of the scripts for others to download and use, that way easy.

eh? how do that sounds now?

Offline litster

  • Posts: 2890
  • rare caps?! THAT'S A SMILIN
AutoHotKey: Share your Scripts!
« Reply #43 on: Thu, 02 June 2011, 16:49:51 »
That would be awesome!

Offline Tony

  • Posts: 1189
AutoHotKey: Share your Scripts!
« Reply #44 on: Fri, 03 June 2011, 09:32:51 »
I experienced that AHK keyboard scripts won't work if you type fast enough, around 50 wpm.
Keyboard: Filco MJ1 104 brown, Filco MJ2 87 brown, Compaq MX11800, Noppoo Choc Brown/Blue/Red, IBM Model M 1996, CMStorm Quickfire Rapid Black
Layout: Colemak experience, speed of 67wpm

Offline daerid

  • Posts: 4276
  • Location: Denver, CO
    • Rossipedia
AutoHotKey: Share your Scripts!
« Reply #45 on: Fri, 03 June 2011, 10:33:10 »
Quote from: Tony;355173
I experienced that AHK keyboard scripts won't work if you type fast enough, around 50 wpm.

Never had a problem with it, and I type regularly at around 80-90wpm

Offline Collective

  • Posts: 4
AutoHotKey: Share your Scripts!
« Reply #46 on: Sun, 05 June 2011, 01:50:15 »
my script #include(s) chord.ahk, located at http://www.autohotkey.com/forum/topic44399.html
I have it set so that LMB + XButton1 results in sending Alt Space M arrow right, grabbing the window and moving it without needing to hold down a mouse button, and so that LMB + XButton2 results in alt+space , S, down right, which results in grabbing the bottom right corner for resizing without holding down a button.

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #47 on: Thu, 05 January 2012, 11:33:04 »
Hey everyone,

I was enjoying the good life with the volume script that alaricljs posted earlier. I didn't want to update iTunes, but I had to format my computer. So I reinstalled Windows 7, on a new disk I have, and when tried to make the script work... BAM, the forward and backwards song, the win+p for play functions no longer work!

So I thought it was due the fact I installed the wrong version of AHK, or skipped adding the libs VA and COM to the AHK installation place. But I still can't manage to make it work :(

Can someone advice on this?

Thanks!

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
AutoHotKey: Share your Scripts!
« Reply #48 on: Thu, 05 January 2012, 13:09:03 »
You mention that you are using iTunes however your earlier post says you got it working with VLC.  So did you later get it working with iTunes prior to this re-install?

The thing to remember about this AHK script and forward/back/play/pause is that all the script does is send a different key press to the OS.  You have to make sure that the OS and/or your media software know that they are what needs to interpret the 'Media Keys', in Winamp this is done with 'Global Hotkeys'.  Just google Media Keys and your software of choice and you should get what you're looking for.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline Zet

  • Thread Starter
  • Posts: 304
AutoHotKey: Share your Scripts!
« Reply #49 on: Sat, 07 January 2012, 09:02:04 »
Yes, later on, I stopped using VLC and started using iTunes, as far as I remember, I had installed the last version and was working OK, then re-installed Windows-7 64bits, I took my script(compiled) and the only part working was the volume up, down, mute, and win+\ to open winamp

I'm thinking I did something wrong, when I installed AHK, perhaps the wrong AHK, not _L, maybe I have the wrong libraries installed on a wrong place, or something...

I would really really appreciate if you guide me through this, since I love the script so much I never felt the urge of getting a keyboard with media keys due this.

Thanks in advance alaricljs!