TBH I don't really think that's possible, because if it were it would be a huge security hole,because it would allow user mode applications to interact with
COM.Objects of privileged processes.
https://docs.microsoft.com/en-us/window ... ellexecute
https://ss64.com/vb/exec.html
VB scripts use
https://ss64.com/vb/shellexecute.html to elevate,but
Shell.Execute() in that link doesn't return an object,meaning it's more like a RunAs command,which simply won't do as piping to a file'less' script as in
ExecScript() interacts with the created process instead of simply running it.
I.e:
Code: Select all
/*
https://docs.microsoft.com/en-us/windows/desktop/shell/shell-shellexecute
Shell.ShellExecute method
Performs a specified operation on a specified file.
https://ss64.com/vb/shellexecute.html
ShellExecute method
Run a script or application in the Windows Shell.
Syntax
.ShellExecute "application", "parameters", "dir", "verb", window
.ShellExecute 'some program.exe', '"some parameters with spaces"', , "runas", 1
Key
application The file to execute (required)
parameters Arguments for the executable
dir Working directory
verb The operation to execute (runas/open/edit/print)
window View mode application window (normal=1, hide=0, 2=Min, 3=max, 4=restore, 5=current, 7=min/inactive, 10=default)
The runas verb is undocumented but can be used to elevate permissions.
*/
ExecScript("MsgBox")
; ExecScript: Executes the given code as a new AutoHotkey process.
ExecScript(Script, Wait:=true)
{
shell := ComObjCreate("Shell.Application")
exec := shell.ShellExecute("C:\Program Files\AutoHotkey\AutoHotkey.exe", "/ErrorStdOut *",,"runas")
;you can't interact with created process so,no point from here on...
exec.StdIn.Write(script)
exec.StdIn.Close()
if Wait
return exec.StdOut.ReadAll()
}