Is there anything in batch/powershell which cant be done in AHK? Topic is solved

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
JKnight_xbt33
Posts: 112
Joined: 18 Sep 2019, 02:06

Is there anything in batch/powershell which cant be done in AHK?

15 Apr 2020, 04:51

Is there anything in batch/powershell which cant be done in AHK?

The way I see things, AHK is like using a hammer for nailing stuff.
Batch/powershell is like using a frying pan, it does the job but requires a lot of "learning" before you can do anything useful.

Anyone with experience with experience in both care to comment?
User avatar
Cuadrix
Posts: 224
Joined: 07 May 2017, 08:26

Re: Is there anything in batch/powershell which cant be done in AHK?  Topic is solved

15 Apr 2020, 07:33

Everything batch scripts do, autohotkey can do one way or another.
----
User avatar
Delta Pythagorean
Posts: 567
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

Re: Is there anything in batch/powershell which cant be done in AHK?

05 May 2020, 10:51

Even if Batch/Powershell can do something AHK can't, AHK can simply execute that code and do something with it by using something like this:

Code: Select all

ExecBatch(Commands, ByRef StdeRR := "") {
	Static Shell := ComObjCreate("WScript.Shell")

	; Open cmd.exe with echoing of commands disabled.
	; This line could be modified if needing to execute Powershell.
	Exec := Shell.Exec(A_ComSpec " /Q /K echo off")

	; Send the commands to execute, separated by newline.
	Exec.StdIn.WriteLine(Commands "`​nexit /b")					; Always exit at the end!

	; Return error output to the byref parameter to clean up the output.
	StdeRR := Exec.StdeRR.ReadAll()

	; Read and return the output of the standard output.
	Return, (Exec.StdOut.ReadAll())
}
I would assume a pipe could work as well.

- [AHK].......: 1.1.33.02 Unicode 64-bit
- [OS].........: Windows 10.0.18362
- [GITHUB]...: github.com/DeltaPyth
- [PAYPAL]....: paypal.me/DelPyth
- [DISCORD]..: Delta#3324

Remember to use [code]CODE[/code] for your multi-line scripts.
Stay safe, stay inside, and remember to wash your hands for 20 seconds!
Kobaltauge
Posts: 260
Joined: 09 Mar 2019, 01:52
GitHub: MassimoCastell
Location: Germany
Contact:

Re: Is there anything in batch/powershell which cant be done in AHK?

05 May 2020, 11:35

PowerShell has PSExec. So it can run the script on another computer when you have the access rights. AHK script can only run where the interpreters exist.

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests