Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cowboy
Last active May 16, 2017 02:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cowboy/f9e7e8e13e937a01bd92 to your computer and use it in GitHub Desktop.
Save cowboy/f9e7e8e13e937a01bd92 to your computer and use it in GitHub Desktop.
AutoHotkey: Press quickly to send <key1>, hold for <delay> ms to send <key2>. Also, matching Logitech G700s profile.
; Press quickly to send <key1>, hold for <delay> ms to send <key2>
; Examples:
; Joy8::dualPress("[", "]")
; Joy10::dualPress("N", "{RShift Down}{N}{RShift Up}")
; MButton::dualPress("F12", "F11", 0.5)
dualPress(key1, key2, delay = 0.2) {
IfNotInString, key1, {
key1 = {%key1%}
IfNotInString, key2, {
key2 = {%key2%}
KeyWait, %A_ThisHotkey%, T%delay%
If ErrorLevel
SendInput %key2%
Else
SendInput %key1%
KeyWait, %A_ThisHotkey%
}
; Debugging (Active when editing this file)
; Shows Logitech G700s buttons from logitech-g700s-f17-f24-profile.xml
#IfWinActive C:\Users\cowboy\Documents\AutoHotkey.ahk
; == Mouse Wheel Buttons ==
F17::dualPress("{raw}W+", "{raw}[W+]")
F18::dualPress("{raw}W<", "{raw}[W<]")
F19::dualPress("{raw}W>", "{raw}[W>]")
F23::dualPress("{raw}W_", "{raw}[W_]")
; == Mouse Index Finger Buttons ==
F20::dualPress("{raw}G^", "{raw}[G^]")
F21::dualPress("{raw}G+", "{raw}[G+]")
F22::dualPress("{raw}Gv", "{raw}[Gv]")
; == Mouse Thumb Buttons ==
XButton2::dualPress("{raw}T1", "{raw}[T1]")
XButton1::dualPress("{raw}T2", "{raw}[T2]")
MButton:: dualPress("{raw}T3", "{raw}[T3]")
F24::dualPress("{raw}T4", "{raw}[T4]")
#IfWinActive
<?xml version="1.0" encoding="utf-8"?>
<profiles xmlns="http://www.logitech.com/Cassandra/2010.7/Profile">
<profile lock="0" gkeysdk="0" launchable="1" name="DEFAULT" inactivecmdkeycolor="#000000" gpasupported="0" activecmdkeycolor="#0064ff" guid="{04E8B1AD-E05E-47F2-B0A1-150BFCB995C4}" lastplayeddate="2014-12-03T07:04:21">
<description></description>
<target path="C:\Program Files\Internet Explorer\iexplore.exe"/>
<signature key="" value="" name="" executable=""/>
<macros>
<macro name="Left Click" color="4278215935" hidden="false" guid="{9DCA4FE6-4E72-4A06-A65E-811669547244}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="leftclick"/>
</mousefunction>
</macro>
<macro name="Right Click" color="4278215935" hidden="false" guid="{6F7F2BEA-63B5-4FC2-9F50-38AEEF235306}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="rightclick"/>
</mousefunction>
</macro>
<macro name="Middle Click" color="4278215935" hidden="false" guid="{8B615B23-6FDC-4430-9E57-E5CCBCAC4575}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="middleclick"/>
</mousefunction>
</macro>
<macro name="Back" color="4278215935" hidden="false" guid="{D2CB324A-536C-46B0-9117-138B576393C5}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="back"/>
</mousefunction>
</macro>
<macro name="Forward" color="4278215935" hidden="false" guid="{AB10FFE9-F91C-4F80-9638-0B6553DD37FC}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="forward"/>
</mousefunction>
</macro>
<macro name="Left Click" color="4278215935" hidden="true" guid="{C757E94F-B967-45D9-8D88-69415EC315E5}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="leftclick"/>
</mousefunction>
</macro>
<macro name="Right Click" color="4278215935" hidden="true" guid="{3BBB9839-47C6-4642-A671-A38B339236B7}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="rightclick"/>
</mousefunction>
</macro>
<macro name="Middle Click" color="4278215935" hidden="true" guid="{6259137E-4E12-4279-8473-A7E91BB7F149}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="middleclick"/>
</mousefunction>
</macro>
<macro name="Back" color="4278215935" hidden="true" guid="{D60D0166-E929-4393-94D3-E03CA53612F5}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="back"/>
</mousefunction>
</macro>
<macro name="Forward" color="4278215935" hidden="true" guid="{EF4DD467-ECB7-4CF0-8626-87A81EBD3B23}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="forward"/>
</mousefunction>
</macro>
<macro name="Scroll Left" color="4278215935" hidden="true" guid="{61A6E887-EDF5-453F-8C27-7E1763739795}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="scrollleft"/>
</mousefunction>
</macro>
<macro name="Scroll Right" color="4278215935" hidden="true" guid="{8B85ED53-8C14-4EC4-8FEA-91C491DD611A}" original="true">
<mousefunction xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/MouseFunction">
<do task="scrollright"/>
</mousefunction>
</macro>
<macro name="F17" color="4278215935" hidden="false" guid="{2C3D8707-4D6E-47CC-9EEA-A106E64651A6}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F17"/>
</keystroke>
</macro>
<macro name="F18" color="4278215935" hidden="false" guid="{01F1D2C8-2191-4EFA-A7B9-8EF58367500A}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F18"/>
</keystroke>
</macro>
<macro name="F19" color="4278215935" hidden="false" guid="{1EEF639C-BB97-4DC6-858C-A95E5A6721A1}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F19"/>
</keystroke>
</macro>
<macro name="F20" color="4278215935" hidden="false" guid="{2263A4CA-7190-4816-B6DD-5A64FCFE9E5D}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F20"/>
</keystroke>
</macro>
<macro name="F21" color="4278215935" hidden="false" guid="{1807F1AF-B650-449F-923C-B2441916AC26}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F21"/>
</keystroke>
</macro>
<macro name="F22" color="4278215935" hidden="false" guid="{424A75CA-ED3F-448F-911B-5FBEF36823F1}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F22"/>
</keystroke>
</macro>
<macro name="F23" color="4278215935" hidden="false" guid="{6F5F1371-6D95-4B94-BF5C-B7EBA95E79E0}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F23"/>
</keystroke>
</macro>
<macro name="F24" color="4278215935" hidden="false" guid="{449BCBC7-FC6D-4A66-8799-5196B0CE0E50}" original="true">
<keystroke xmlns="http://www.logitech.com/Cassandra/2010.1/Macros/Keystroke">
<key value="F24"/>
</keystroke>
</macro>
</macros>
<assignments devicecategory="Logitech.Gaming.Mouse.G700">
<assignment shiftstate="1" contextid="Button1" macroguid="{9DCA4FE6-4E72-4A06-A65E-811669547244}" backup="false" original="true"/>
<assignment shiftstate="1" contextid="Button2" macroguid="{6F7F2BEA-63B5-4FC2-9F50-38AEEF235306}" backup="false" original="true"/>
<assignment shiftstate="1" contextid="Button5" macroguid="{AB10FFE9-F91C-4F80-9638-0B6553DD37FC}" backup="true" original="false"/>
<assignment shiftstate="1" contextid="Button5" macroguid="{8B615B23-6FDC-4430-9E57-E5CCBCAC4575}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button3" macroguid="{8B615B23-6FDC-4430-9E57-E5CCBCAC4575}" backup="true" original="false"/>
<assignment shiftstate="1" contextid="Button13" macroguid="{1EEF639C-BB97-4DC6-858C-A95E5A6721A1}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button10" macroguid="{2263A4CA-7190-4816-B6DD-5A64FCFE9E5D}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button9" macroguid="{1807F1AF-B650-449F-923C-B2441916AC26}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button8" macroguid="{424A75CA-ED3F-448F-911B-5FBEF36823F1}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button11" macroguid="{6F5F1371-6D95-4B94-BF5C-B7EBA95E79E0}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button4" macroguid="{D2CB324A-536C-46B0-9117-138B576393C5}" backup="true" original="false"/>
<assignment shiftstate="1" contextid="Button4" macroguid="{449BCBC7-FC6D-4A66-8799-5196B0CE0E50}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button7" macroguid="{AB10FFE9-F91C-4F80-9638-0B6553DD37FC}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button6" macroguid="{D2CB324A-536C-46B0-9117-138B576393C5}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button3" macroguid="{2C3D8707-4D6E-47CC-9EEA-A106E64651A6}" backup="false" original="false"/>
<assignment shiftstate="1" contextid="Button12" macroguid="{01F1D2C8-2191-4EFA-A7B9-8EF58367500A}" backup="false" original="false"/>
</assignments>
<pointers>
<pointer devicemodel="Logitech.Gaming.Mouse.G700s">
<mode shiftstate="1">
<reportrate rate="500"/>
<powermode value="2"/>
<dpitable shiftindex="1" syncxy="1" defaultindex="1">
<dpi x="400" y="400" enabled="1"/>
<dpi x="1200" y="1200" enabled="1"/>
<dpi x="2000" y="2000" enabled="1"/>
<dpi x="3200" y="3200" enabled="1"/>
<dpi x="6500" y="6500" enabled="1"/>
</dpitable>
<movement speed="-1" acceleration="1"/>
</mode>
</pointer>
</pointers>
<backlight devicemodel="Logitech.Gaming.Mouse.G700s">
<mode shiftstate="1" color="#000000"/>
<mode shiftstate="2" color="#000000"/>
<mode shiftstate="3" color="#000000"/>
</backlight>
<script>function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %s\n", event, arg)
end</script>
</profile>
</profiles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment