I am so glad I found hammerspoon. I am having issues coming from windows to mac os. I have been using autohotkey in the past and have this script that I cannot live without while playing world of warcraft. I suffered a hand injury and can't play without the following script:
{
$r::
Loop
{
if not GetKeyState("r", "P")
break
Send r
Sleep 40
}
return
}
All it does is key repeat the letter r while holding it down. I use an addon in world of warcraft called gnomesequenceenhanced to put my abilities in to play. and the scritp uses the same button over and over until released to cast my abilities.
I would be forever greatful if you would be able to get this so I can upload and use this in the config and save the init.lua
Related
I have a PowerShell script that opens a file when you press a hotkey like: ctrl + alt + f so that the app automatically runs every time the user presses those key combinations.
Now, the problem is that it indeed opens the application/file, but it takes 4-5 second to process it. I want the process to be fast enough so that the script opens the desired files the moment the user presses the key combinations and not seconds after it. I don't know what caused this slowdown...
Here's the script:
# Get the Desktop dir. path.
$desktopDir = [Environment]::GetFolderPath('Desktop')
# Create the shortcut object, initially in-memory only.
$shc =
(New-Object -ComObject 'Wscript.Shell').CreateShortcut("$desktopDir\linkthis.lnk")
# Set the target executable (name will do if in $env:PATH).
$shc.TargetPath = 'C:\Users\abhay\Downloads\Test\script.py'
# Assign the hotkey.
$shc.Hotkey = 'Ctrl+Alt+F'
$shc.Save()
(Code originally taken from this question asked by me earlier)
Edit1:
It isn't just the case with my .py script. It's the same when opening even notepad too! And the script indeed runs fast when I boot up my PC but after some time (2-3min) it causes the delay in opening again. I Just can't figure it out why...
I don't know why it runs fast at the first 1-2 min and then slows down
(Also, running the files manually is quick. It's just slow with the script)
Edit 2
Hey guys, I just discovered that it's just the case with my computer. It's working fine on my dad's PC with pentium processor 🥲 but I still appreciate any fix for my system if possible. Thanks. May god bless you and my father. Things are really wrong with me these days...
So I have to scan and manually enter 1200 scanner number every week for inventory. The process goes in this order:
Open Website < Click text box < Enter numbers < hit submit < wait 20 seconds < hit submit again (it makes me confirm i entered right) < Wait another 20 seconds.
At this point, the page refreshes, and IO start over at the Click text box part.
I already converted the numbers to barcodes and scan them instead of typing, I also use 2 screens with 8 open windows to make it a bit faster.
But I was wondering if there was a batch file or another way to automate the process?
Even with the scanner, and 8 open windows, it takes 4 hours roughly to do them all.
I have been searching on google for a few days, and decided to ask here since most the pages i read go back to this site.
http://www.autohotkey.com/
Awesome macro software. Very flexible for a macro and easy language to learn.
Try searching for automated keyboard/mouse macro software. Never used it, just a tip.
This question appears to be similar on SuperUser: Redirecting input from file to command-line program
It appears to be effective for telnet sessions - not sure about http sessions. You might look into TCL and Expect as options though.
Thanks for reading and any comments you may have.
Context:
I've been a UI/R&D dev (prototyping, etc.) for over 20 years and just started server/backend development.
I'm very new to Go - less than 2 months - and have 1) run through much of GoByExample and 2) set up a primitive, working web server on an Amazon EC2 instance.
I created a UI in another language which serves a HUD (Heads Up Display) for another 3rd party application - a game which spawns multiple windows. (Think multiple poker tables running in multiple windows.)
I connected the HUD to a Go client I created.
I use Go to grab OS information because of limitations in the first language.
I want to continue to use Go because I really enjoy it.
I'm on a Windows 7 machine.
Goal(s):
Big picture: When a User moves a window, I want the HUD to move with it.
To do this I need information about the main windows whos WindowText starts with "Game".
The ideal would be something like this:
windows: [ { windowHwnd:hwnd, windowText:windowText, windowX:x, windowY:y, windowWidth:width, windowHeight:height },
.
.
.
{ windowHwnd:hwnd, windowText:windowText, windowX:x, windowY:y, windowWidth:width, windowHeight:height } ]
Steps I've taken:
I've grabbed and modified github.com/AllenDang/w32 which I think formats syscall for Go.
When I need an unlisted function from user32.go, I add it.
Tried using GetForegroundWindow and GetWindowText with result, then GetWindow( hwnd, previous ) to just walkthrough everything
Read through:
syscall docs (http://golang.org/pkg/syscall/)
syscall/dll_windows.go
syscall/env_windows.go
syscall/exec_windows.go
syscall/syscall.go
syscall/syscall_windows.go
syscall/syscall_windows_386.go
syscall/syscall_windows_amd86.go
syscall/syscall_windows_test.go
syscall/zsyscall_windows_386.go
syscall/zsyscall_windows_amd86.go
syscall/ztypes_windows.go
syscall/ztypes_windows_386.go
syscall/ztypes_windows_amd86.go
Every potential Window Function at Windows Dev Center
Searched StackExchange, Google, DuckDuckGo
I can see there's something (TestEnumWindows)
line 125 in runtime/syscall_windows_test.go (http://golang.org/src/pkg/runtime/syscall_windows_test.go)
Though this function doesn't exist in syscall_windows_test.go
Questions:
Better solution? In my ignorance I could easily be overlooking some method like: GiveGeoffreyExactlyWhatHeWants()
Am I in the right ballpark?
Is this doable in Go?
What's the right direction to head?
Is this something anybody else needs?
It is not clear what you want , but perhaps http://play.golang.org/p/YfGDtIuuBw will help. It uses EnumWindows to find window with a particular title.
Alex
I have Zebra LP2824 printer. It is working properly on Windows XP, but It is not working properly on Windows 7. On windows 7 it prints the Test page on printer properties, but it is not printing in my application. It seems, that it can't find the port, the printer is using. On the same application, but on Windows XP it is printing. I am connecting the printer with USB.
Does anyone knows what seems to be the problem?
Thanks for help in advance. :)
I usually have to share the printer in order to get it to accept a print job. Sharing in Win 7 is a little different I think - there might more than one step. Open the printer queue and pause it, then send a print job to it - see if it shows up (then un-pause) If it doesn't show up in the queue, there might be a share/permissions problem.
I just managed it today to print on another zebra USB printer.
use this article : http://support.microsoft.com/kb/322091/nl
Notice dough that the sample has a small error, so go to this function
public static bool SendFileToPrinter( string szPrinterName, string szFileName )
...
..
overthere go to then end of that function and add the line i mention below
Marshal.FreeCoTaskMem(pBytes);
fs.close(); // <-- add that or it will crash with locked files errors.
return true;
How Zebra printers behave depends a lot on what you try to print, and how the program works
For example notepad and edlin and wordpad and dos PRINT can all work different.
Some programs print RAW directly (as the url code does), others pay some respect to the printer preferences > still dough a TXT file raw printed containing ZPL commands will overrule printer settings..
ZPL is a little nightmare in itself
If you need paper to be cut
You will need
^MMC
you wont find it explained like that in their manuals.
(because they sell their own label printing design software i think..)
I'm trying to add sound to a Perl script to alert the user that the transaction was OK (user may not be looking at the screen all the time while working). I'd like to stay as portable as possible, as the script runs on Windows and Linux stations.
I can
use Win32::Sound;
Win32::Sound::Play('SystemDefault',SND_ASYNC);
for Windows. But I'm not sure how to call a generic sound on Linux (Gnome). So far, I've come up with
system('paplay /usr/share/sounds/gnome/default/alert/sonar.ogg');
But I'm not sure if I can count on that path being available.
So, three questions:
Is there a better way to call a default sound in Gnome
Is that path pretty universal (at least among Debain/Ubuntu flavors)
paplay takes a while to exit after playing a sound, is there a better way to call it?
I'd rather stay away from beeping the system speaker, it sounds awful (this is going to get played a lot) and Ubuntu blacklists the PC Speaker anyway.
Thanks!
A more portable way to get the path to paplay (assuming it's there) might be to use File::Which. Then you could get the path like:
use File::Which;
my $paplay_path = which 'paplay';
And to play the sound asynchronously, you can fork a subprocess:
my $pid = fork;
if ( !$pid ) {
# in the child process
system $paplay_path, '/usr/share/sounds/gnome/default/alert/sonar.ogg';
}
# parent proc continues here
Notice also that I've used the multi-argument form of system; doing so avoids the shell and runs the requested program directly. This avoids dangerous bugs (and is more efficient.)