Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Followed the Steps, but Doesn't Work #21

Open
FrancyCakes opened this issue Apr 20, 2016 · 12 comments
Open

Followed the Steps, but Doesn't Work #21

FrancyCakes opened this issue Apr 20, 2016 · 12 comments

Comments

@FrancyCakes
Copy link

Followed each step in the guide, but when it came to running the script I found that none of the keys on the second keyboard did anything, not even regular keystrokes. LuaMacros recognizes each keystroke but none of the given scripts worked for me.

I'm not entirely sure what the problem is.

@Codingale
Copy link

Have you tried changing your writing directory to something other than

local file = io.open("C:\\Users\\TaranVanHemert\\Documents\\keypressed.txt", "w")
on line 10 of taranLUAmacros.lua?

Or running LuaMacros as an administrator on windows?

@FrancyCakes
Copy link
Author

I did change the writing directory under my username, and made a txt file named keypressed, but what does "w" mean in that line?

@Codingale
Copy link

The w in this case means you're opening it to be wrote to, rw means read and write. We only need writing so we open it with only write permissions.

Does the key get wrote to the file? (You may need to manually create the file by the way)

Can you try placing at `C:\keypressed.txt" and then modifying the autohotkey file?

Does the auto hot key register you pressing F24?

Open the right click the tray icon, then open, see if it says something like:
FileRead,key,C:\Users\TaranVanHemert\Documents\keypressed.txt

@FrancyCakes
Copy link
Author

There are a few things I would like some clarification, bare with me i'm pretty stupid when it comes to stuff like this. When should I be pressing f24? after I've loaded in the lua file into luamacros and registered the second keyboard? and which keyboard should I be pressing f24?

I'm also not entirely sure what pressing f24 would do. Regardless I've pressed f24 after I've registered my second keyboard into luamacros and opened up the 2nd keyboard script with each keyboard, and nothing has happened.

Lastly when you say to click on the tray icon do you mean the auto hotkeys tray that opens up after the 2nd keyboard script runs?

I've also did as you suggested and placed the text file into C:\ and rewrote the writing directory to C:\keypressed.txt, but it hasn't fixed the problem.

@Codingale
Copy link

Do.. Do.. you actually have an F24 key?

Here look at Tom Scotts video and maybe it'll help since he explains it better than Taran did:
https://www.youtube.com/watch?v=lIFE7h3m40U

That being said, you need two keyboards. One to be your macro keyboard. Plug it in, load up Lua Macros and it'll ask you to assign keyboard named Macros. Press any key on the keyboard you want for your macros.

Run the AHK included or your own if you know how to script it.

The script will start running and should write the key into the file. After that it sends a key press autohotkey should see but you'll never press normally (F24) and then AHK will see what that should do and send that macro / key combo.

@FrancyCakes
Copy link
Author

Yeah I did all that :/

I did assign a second keyboard to LuaMacros, but the script for AHK doesn't work, or something else is amiss, since this process worked for a majority of people it seems.

also no I don't have a f24 just shift f12

@Codingale
Copy link

#IfWinActive ahk_exe Adobe Premiere Pro.exe

Do you have Adobe Premiere Pro.exe running? As it'll only work inside of that window.

@FrancyCakes
Copy link
Author

yeah I do :/

@Codingale
Copy link

Try removing that line, also see if AHK is seeing you press F24 or not. I think it'd be someone on AHK's side not LuaMacros right now.

@TaranVH
Copy link
Owner

TaranVH commented Aug 31, 2016

There could be a LOT of things wrong here!

Basically you have to just go one small step at a time.

You got luamacros working.
now you need to see if it is properly saving into keypressed.txt!

Now, you need to learn a little about autohotkey... try writing a VERY simple script that will READ keypressed.txt and put the result in a text box!

Here, I did it for you!

F12::
FileRead, key, C:\Users\TaranVanHemert\Documents\GitHub\2nd-keyboard\2nd keyboard support files\keypressed.txt
msgbox, your key is %key%
Return

change the file path first, of course. Note that this uses F12 so that you can press it on your keyboard!

Then try even more complicated code like this!
F12::
FileRead, key, C:\Users\TaranVanHemert\Documents\GitHub\2nd-keyboard\2nd keyboard support files\keypressed.txt
msgbox, your key is %key%
If(key = "r")
msgbox, You typed the R key on your second keyboard! Probably!
else if(key <> "r")
msgbox, You did not type the R key!
Return

I didn't test this code but it SHOULD work...

And then OH LOOK you got the code working already! Now you can swap out those message boxes for any function you desire! And you can just add more lines! YEAAAAH

@Matesaktesak
Copy link

I had that problem with a PS-2 keyboard. When swapped to USB, everything started to work.

@3dcinetv
Copy link

3dcinetv commented Sep 27, 2021

I tried this code on my second USB numpad, and it "echoes" whatever I do on this second numpad to my main typing keyboard.
I identified the secondary USB numpad device (2B85bB30). Lua picks it up. The keypress.txt gets written. AHK fires the command, but yet, whatever I do on my secondary USB numpad, it's reflected to my main typing keyboard (if I press Numpad 1 on the USB keyboard, it also writes 1 from my main typing keyboard), it fires the command, but also echoes the numpad 1 typing.
Is there a way to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants