forked from TaranVH/2nd-keyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
still needs the actaul razer profile
- Loading branch information
Showing
101 changed files
with
610 additions
and
225 deletions.
There are no files selected for viewing
110 changes: 110 additions & 0 deletions
110
INFO_and_PROFILES/ignore me/2nd_keyboard_if_using_Razer--BAD IDEA.ahk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#NoEnv | ||
SendMode Input | ||
#InstallKeybdHook | ||
#InstallMouseHook | ||
#UseHook On | ||
|
||
#SingleInstance force ;only one instance may run at a time! | ||
#MaxHotkeysPerInterval 2000 | ||
#WinActivateForce ;https://autohotkey.com/docs/commands/_WinActivateForce.htm ;this may prevent taskbar flashing. | ||
detecthiddenwindows, on | ||
|
||
;;-------------------------------------------------------------------- | ||
;;;;;;SCRIPT THAT RECIEVES MESSAGES AND TURNS THEM INTO FUNCTIONS:;;;; | ||
;;-------------------------------------------------------------------- | ||
|
||
;;Discussion:https://autohotkey.com/board/topic/18361-anyway-to-pass-params-to-script-while-running/ | ||
|
||
;;Where I got the script from: | ||
; https://autohotkey.com/docs/commands/OnMessage.htm | ||
|
||
#ifwinactive | ||
OnMessage(0x4a, "Receive_WM_COPYDATA") ; 0x4a is WM_COPYDATA | ||
return | ||
|
||
Receive_WM_COPYDATA(wParam, lParam) | ||
{ | ||
StringAddress := NumGet(lParam + 2*A_PtrSize) ; Retrieves the CopyDataStruct's lpData member. | ||
CopyOfData := StrGet(StringAddress) ; Copy the string out of the structure. | ||
|
||
;msgbox, %A_ScriptName%`nReceived the following string:`n`n%CopyOfData% | ||
|
||
; So at this point, %CopyOfData% contains the following string: | ||
; coolFunction("from Q",0) | ||
|
||
; If only there was an easy way to use that string in such a way that the function is called... I believe this is known as dynamic code execution: https://www.autohotkey.com/docs/Functions.htm#dynamic or https://autohotkey.com/board/topic/51532-execute-string-in-ahk/ | ||
; But IDK how to get that working. | ||
|
||
;#(%CopyOfData%) ;<--this doesn't work, but i guess it would if I used a mile of code from that thread I linked to. That ain't happening. | ||
|
||
;callIt := CopyOfData ;<--unfortunately, this also doesn't work, even if we start off with `%coolFunction`%("from Q",0) ... which means that I need to do it the hard way, which you will see below. | ||
;callIt = %CopyOfData% ;<- this don't work neither, dang it. | ||
|
||
;/* | ||
string = %CopyOfData% | ||
theFunctionName := SubStr(String, 1, InStr(string, "(") - 1) ;<-- This assumes that your function name is to the left of a "(" and I think that's a pretty fair assumption. | ||
|
||
parameter1 := SubStr(String, InStr(string, "(") + 1) | ||
parameter1 := SubStr(parameter1, 1, InStr(parameter1, ",") - 1) ;this and the preceeding line will extract the parameters, assuming you properly put them inside of ( ) parentheses! | ||
|
||
|
||
;Func.Call() | ||
|
||
return true ; Returning 1 (true) is the traditional way to acknowledge this message. | ||
} | ||
|
||
;;DEFINE YOUR FUNCTIONS BELOW HERE | ||
|
||
coolFunction(param1,param2 := 2) ;<--Just in case you forgot a 2nd parameter, this means that it'll be a 2. | ||
{ | ||
msgbox, congrats! you made it to coolFunction`, with the parameters`n%param1%`nand`n%param2% | ||
bueno = "bueno" | ||
return bueno | ||
} | ||
|
||
anotherFunction(yeah,whatever) | ||
{ | ||
msgbox, %yeah%`n%whatever% | ||
sleep 10 | ||
|
||
} | ||
|
||
^+s:: | ||
send ^s | ||
reload | ||
|
||
return | ||
|
||
; Keyshower(f_path,"InstExplor") | ||
; if IsFunc("Keyshower") { | ||
; Func := Func("Keyshower") | ||
; RetVal := Func.Call(f_path,"InstExplor") | ||
; } | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
StringToSend = fakeFunction("from E",0) | ||
;; The above line is the only thing you should change. Write out the function you wish to call in exactly the same way you would with any function! Otherwise it won't work!! Note that it must have two parameters. (Unless you modify the code yourself.) If you don't want to use the 2nd parameters, just put a 0. | ||
|
||
result := Send_WM_COPYDATA(StringToSend) | ||
;The above line is what actaully calls the Send_WM_COPYDATA function, which is defined in the REDIRECTOR_RAZER.ahk script, which has been #include-d below. Yeah. You can define functions even below an "Exitapp" command. | ||
|
||
;At this point, we are hoping to recieve "true" as our result. If it fails, we will recieve "fail". | ||
|
||
if (result = 0) | ||
wasIgnored() | ||
|
||
if (result = "fail"){ | ||
failtastic(stringtosend,result) ;I want to have as little code in these small scripts as possible. failtastic(,) is therefore defined inside of the REDIRECTOR_RAZER.ahk script. | ||
} | ||
|
||
Exitapp | ||
|
||
|
||
SetWorkingDir %A_ScriptDir% ;<--This is superior to the alternative on the following line: | ||
;SetWorkingDir C:\AHK\2nd-keyboard\Razer\razer_direct_launch | ||
;Because even though they both achieve the same result, the way I've done it means that you can move the entire folder wherever you want. The downside is that you'd still have to redefine all the script locations inside of razer synapse. yikes! | ||
#Include %A_ScriptDir%/REDIRECTOR_RAZER.ahk ;<-- REDIRECTOR_RAZER.ahk must always be in the same folder as all the smaller scripts (like this one) that it is servicing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.