How to run a AUTOHOTKEY file/script and save it for ever? - keyboard

I created a AutoHotkey file for few modifacations to my keyboard, if i double click the file the modificatoins are working. ex. '1' becomes 'a'
When I restart the comptuer the modifications are not remembered and I need to run again the file to save the modification. How to save the file forever and make it work without run the script every time I turn off the computer ?

Use Task Scheduler (taskschd.msc in system32) to make your script autorun at startup, even silently with elevated privileges, if that's a requirement.

Related

How to identify when a process is triggered?

I have a script in Linux (read-only partition that I cannot change or edit the file) that I want to know when this file is triggered by an external command (button connected to the device). This device is not a pc, so there is no keyboard, but I have telnet access as root.
I know what is and where is the file I want to monitor, but as I said in the beginning the partition is read-only and I cannot change it. Read-only partition is squashfs and would be easier if I could change the file, but as I said, I cannot change it.
So What I want is to find a way to "be informed" when this script is called, My aim is to identify who/how the script is called.
I've tried ps and top but the script runs to quickly to be identified for those and when I can find it using ps I do not know who triggered this script.
My idea is to monitor this script and when it is triggered I can run another command.
Script is located on /usr/bin/command
I do have access (read-write) to other partitions where I can put a script to run the second call.
Thanks in Advance.

How to run a bat file in windows from linux systm

I recorded a certain process by autohotkey and saved as auto.ahk in Windows system. I need to run that from Linux system, so I created a bat file with content start 'd:\auto.ahk' and saved as test.bat. But when I use the following code in terminal, it doesn't work
ssh user#192.00.00.00 'd:/test'
Because of the fact that you .ahk script requires the actual autohotkey program on windows to run (it's the interpreter between raw text and binary commands to windows), what you're likely running into is that the bat file is trying to just "run" your .ahk script, but can't run a raw text file like a program. What you may be able to do to fix this is compiling your .ahk script, making it an executable. Then, you could call the executable directly, just like you would any other .exe on the computer. (you might also want to try starting any other .exe this way like notepad to make sure your method of running the program is correct)
Another solution would be, as #Matthew Strawbridge suggested, to have a script running quietly in the background of the computer, periodically checking the contents of a file that the .bat can write to. This has the added bonus of you being able to customize what the script does by what is written in the check up file.

Temporarily quitting Gvim starts over the shell

I am on windows machine, when I temporarily change to console using :sh then back to vim with exit command and then again back to console and it starts over. this causes me to lose my previous directory. Is there other way returning back to vim won't start the shell over?
Not really
https://stackoverflow.com/a/12089631/1427295
GVIM does not retain a "handle" to the shell that launched it in a way
that allows it to send commands back to it. Because of they
synchronous execution, you also cannot launch a shell from GVIM, keep
feeding it commands while also continue working in GVIM.
I'm afraid you have to use the functionality of your window manager to
launch (and then later re-activate) a shell window, and send the
commands as keystrokes to it. On Windows, this can be done (e.g. in
VBScript) via WshShell's Run(), AppActivate() and SendKeys() methods;
there are probably similar mechanisms for window control on Linux,
too.
If you don't mind having that shell inside your GVIM (emulated, with
all its drawbacks), though, there are plugins that enable that.
https://serverfault.com/a/95405
The Windows command interpreter ("cmd.exe") doesn't provide any
support for saving/exporting/keeping history, of, if it does,
Microsoft didn't document it and nobody was ever able to find it. You
can of course try to work around that, like Sean suggested, but
there's (or does appear to be) no built-in support for this
You may be able to output your command history using echo %cd% > prev_dir.txt then create a script that cds to the directory in prev_dir.txt, but you'd still have to remember to save your directory to the file before you exit the shell each time.

Trying to append the Excel file through unix via command prompt

What needs to be done?
I need to make a connection to the remote machine through UNIX, go to the shared drive, open an excel file, save it and close it. This needs to written in an script.
The file contains macros so they needs to be opened manually on daily basis, save it and close it. We plan to write a script that would run on daily basis and refresh this file automatically.
Where am i facing the issue?
Making a connection to the remote machine is done, after that i run certains commands:
1. Open the command prompt
2. cd the file path
3. Open the File
Now this is where the issue starts
How to save the file automatically?
How to close that file?
I tried using the taskill option and it almost worked but it gives out the popup of Do you want to save the file and i dont know how to provide output to that popup through command prompt.
Let me know if you have any idea on how to move ahead on this.
A bit hackish, but xdotool, a program which simulates mouse clicks and keyboard presses could be used. If Windows is being used, then see this question for tools which simulate mouse clicks and keyboard presses.
Have you tried SendKeys?
That may help.

how to add session start-up program

Edited: How do I programmatically add programs to launch on user session startup on Ubuntu?
I know how to perform this operation through Nautilus but I'd like to know how do this through a script.
Here ya go: The Freedesktop Autostart specification. It's just a matter of writing a .desktop file to the appropriate place.
If you want some program to start with X you could try appending entries to the .xinitrc file, where each entry is something you want to execute with an ampersand (&) attached to it. That's user specific. You can also do something that's specific to your window manager. I use fluxbox so that would be in the ~/.fluxbox/startup file, which is also user specific. I don't know how it works with Gnome, but hopefully the .xinitrc idea will.
If it's just for your purposes you can also make a script called "startup" in your home directory and then add it to the startup programs via the menu, and then have your other script write to this script.

Resources