AutoHotkey | AutoHotkey - macro-creation | Automation library
kandi X-RAY | AutoHotkey Summary
kandi X-RAY | AutoHotkey Summary
AutoHotkey is a powerful and easy to use scripting language for desktop automation on Windows.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of AutoHotkey
AutoHotkey Key Features
AutoHotkey Examples and Code Snippets
Community Discussions
Trending Discussions on AutoHotkey
QUESTION
Using AutoHotkey, I am trying to create a window which is semi transparent.
Here is the code I have so far:
...ANSWER
Answered 2021-Jun-10 at 07:30The window doesn't exist before you show it.
So, you have to set the transparency after you show the window.
QUESTION
I'm fairly new to autohotkey and ran into a problem recently when trying to pass variables as parameters for the "run" command in autohotkey. Can anyone show me what I'm missing or is this a bug?
...ANSWER
Answered 2021-Jun-04 at 20:44First things first, while
QUESTION
Good Day, I here a batch script that uses a function to operate
...ANSWER
Answered 2021-May-27 at 05:17use a function to define the array. In doing so, new values only need to be added to the list of parameter values the function is called with.
Edit: I'm not sure whats unclear given the usage example provided and the description of the argument structure of the function, so heres a desciption of the functionality of the function:
In your opening question, you manually define an array with the prefix n
followed by numeric indexes one at a time:
QUESTION
Good day, I have here a batch file (I call Installer.bat because it installs softwares)
...ANSWER
Answered 2021-May-23 at 12:53All these actions are essentially the same steps with different data. Use a function.
A function is a label that is call
ed with parameters to act upon.
After your input prompt, validate your input, then assess which path to pass to the function as the second parameter.
Call :InstallPrompt "Installee Descriptor" "Installees Filename.ext"
An example of all your labels reduced to a single function.
QUESTION
- How can you access the parameters sent to PowerShell script (.ps1 file)?
- Can you access parameters A: by name, B: by position, C: a mix of either?
I recently tried to write a PowerShell script (.ps1) that would be called from a Windows batch file (.bat) (or potentially cmd shell, or AutoHotKey script) - which would pass parameters into the .ps1 script for it to use (to display a toast notification). Thanks to the instructions on ss64.com, I have used $args
to do this kind of thing in the past, however for some reason I could access the parameters this way (despite passing parameters, $args[0] = ''
(empty string) and $args.Count = 0
) so eventually had to remove all the $args
code, and replace it with Param()
script instead.
I'm still not quite sure why, but thought this is something I should get to the bottom of before I try to write my next script...
Code Example 1: Args (un-named parameters)
...ANSWER
Answered 2021-May-23 at 02:58The automatic
$args
variable is only available in simple (non-advanced) functions / scripts. A script automatically becomes an advanced one by using the[CmdletBinding()]
attribute and/or at least one per-parameter[Parameter()]
attribute.Using
$args
allows a function/script to accept an open-ended number of positional arguments, usually instead of, but also in addition to using explicitly declared parameters.But it doesn't allow passing named arguments (arguments prefixed by a predeclared target parameter name, e.g.,
-Title
)
For robustness, using an advanced (cmdlet-like) function or script is preferable; such functions / scripts:
- They require declaring parameters explicitly.
- They accept no arguments other than ones that bind to declared parameters.
- However, you can define a single catch-all parameter that collects all positional arguments that don't bind to any of the other predeclared parameters, using
[Parameter(ValueFromRemainingArguments)]
.
- However, you can define a single catch-all parameter that collects all positional arguments that don't bind to any of the other predeclared parameters, using
Explicitly defined parameters are positional by default, in the order in which they are declared inside the
param(...)
block.- You can turn off this default with
[CmdletBinding(PositionalBinding=$false)]
, - which then allows you to selectively enable positional binding, using the
Position
property of the individual[Parameter()]
attributes.
- You can turn off this default with
When you call a PowerShell script via the PowerShell's CLI's
-File
parameter, the invocation syntax is fundamentally the same as when calling script from inside PowerShell; that is, you can pass named arguments and/or - if supported - positional arguments.- Constraints:
- The arguments are treated as literals.
- Passing array arguments (
,
-separated elements) is not supported.
- If you do need your arguments to be interpreted as they would be from inside PowerShell, use the
-Command
/-c
CLI parameter instead - See this answer for guidance on when to use
-File
vs. `-Command.
- Constraints:
To put it all together:
ToastNotificationMix.ps1
:
QUESTION
I'm trying to use AutoHotKey to control my media. I have the following set which does not work:
...ANSWER
Answered 2021-May-20 at 16:14You can do something like
QUESTION
I've recently started creating some simple scripts with autoHotKey, and I'd like to know if it is possible to close Spotify, which changes window title for every song.
I've tried with
Process, Close, Spotify
but it doesn't work unfortunately.
ANSWER
Answered 2021-May-19 at 14:17The following code snippet works for me:
QUESTION
global AssocArray := {}
Array := []
Loop, Read, links.txt
Array.Push(StrSplit(A_LoopReadLine, ";"))
for index, element in Array {
Browser := Func("Launch").Bind("chrome.exe --options ", "firefox.exe -options ")
Menu, MyMenu, Add, % element.2, % Browser
AssocArray[element.2] := element.3
}
Menu, MyMenu, Show
Launch(BrowserPC1, BrowserPC2, ItemName, ItemPos) {
Browser := A_ComputerName = PC1 ? %BrowserPC1% : %BrowserPC2%
Run, % Browser AssocArray[ItemName]
return
}
Format of links.txt:
;Arrays;https://autohotkey.com/docs/Arrays
...ANSWER
Answered 2021-May-14 at 19:36The mistake is here:
QUESTION
I need an AHK script which will check/compare an MD5 checksum value for a specified file.
Something like this:
'Does file "%userprofile%\appsettings\app.ini
" have an MD5 checksum value A465564D654E56464025456F
?
if YES
Msgbox "not changed"
if NO
filedelete, "%userprofile%\appsettings\app.ini"
- Then:
filecopy, "%userprofile%\appsettings\app.kackup", "%userprofile%\appsettings\app.ini"
- Then:
Exit script
I need this to be run manually - on demand, not a persistent script.
I prefer it to be an Autohotkey script, but if it is too complicated, powershell or batch script is fine too.
Thank you
...ANSWER
Answered 2021-May-06 at 15:27One solution:
QUESTION
I have a 2 batch file here that behaves like a timer
1st batch file
...ANSWER
Answered 2021-May-10 at 11:30a Scheduled task will help you time everything properly, but seeing as you have written the code, I might as well try and help.
I am not going to do all the code for you, but I will show you the idea and you can complete it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AutoHotkey
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page