I would like to be able to write a script to send commands to the console for creation of Gstreamer pipelines. I was thinking of something similar to this:
Local $iPID = Run("C:\Windows\System32\cmd", "", @SW_MAXIMIZE) ;THIS OPENS THE CONSOLE...!!! if $iPID == 0 Then ConsoleWrite(@CRLF & "I DID NOT OPEN CMD...error: " & @error & @CRLF) if $iPID <> 0 Then ConsoleWrite(@CRLF & "I OPENED CMD...!!!" & @CRLF) $hCmd = WinGetHandle("C:\WINDOWS\system32\cmd.exe") if $hCmd <> 0 Then WinActivate($hCmd) ;ensure command console is active... $sOutput = Send("cd C:\gstreamer\1.0\x86_64\bin" & @CRLF, $SEND_RAW) $sOutput = Send("gst-launch-1.0 videotestsrc ! autovideosink" & @CRLF, $SEND_RAW) Sleep(3000) ControlSend($hCmd, "", "", "exit" & @CR) EndIf ;$hCmd NOT "0"... I don't really know if this is the best way to open the console and send commands into it. I'm also not sure about how to best catch any errors that may occur...likely this needs to be accomplished with the STDOUTREAD command however I've not had experience using it before and therefore would appreciate some advice that anybody may offer.
Basically I'm seeking guidance on how to best automate the opening of the console, sending lines of commands to be executed, and handling any potential errors in the execution of those commands...I thank you in advance. Regards.
Script to get input from user ,check in csv file and read corresponding values and pass that value to cmdBy MadhaN
I have a csv file as below, I wand to find srno from csv and send corresponding ip and pass to commend cmd prompt.
Please guide me to create script .
So I just got a new computer, and instantly went and installed Autoit onto it. I selected run script as default action when clicking on an au3 file, however every time I do this it opens the script in the editor. I can from there run the script no problem.
I've tried reinstalling and checking the settings by hitting "Ctrl+1" and have confirmed it is set to run, but yet it just continues to open in the editor.
Any ideas why this is happening or how to solve?
New system is windows 10, old was windows 7
Im trying to launch a .exe file that is nested within the program files (x86) folder structure. i have already used the standard RunAs Syntax and found that it fails to launch the application. I have switched to Run and that seems to work. My issue is I have to use RunAs as the applicaton would need to run under a completely different account. The Current logged in user is a Local User on the machine, however, the application must be run as a domain user. The Machine is domain connected.
have tried the following:
RunAs("username","logonpassword", $RUN_LOGON_PROFILE, "D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") The above fails to launch, there are no errors or syntax issues, it just does nothing when the variables are replaced for the correct values.
I did the same using the Run command
Run("D:\Program Files (x86)\Vendor\Application Name\Exe Location\Executable.exe") That seems to work fine, but runs in local user context. Any thoughts? Could it be a local Machine rights issue? Or have i missed something glaring in my script
i have searched a lot about how to run external programs with the administrator privileges without the script running with administrator privileges using autoit
But all my attempts failed
Finally, today I found the VBS function doing this task
I immediately transferred it to our beloved language (autoit) and i decided to share it with you
i hope you like it
This is a simple example about how to use the function
runAsAdmin("cmd.exe", "/c @echo off & cls & echo test & pause", "c:\", @sw_show)
this is the function
func runAsAdmin($program, $parameters = "", $workingDir = @workingDir, $show = "") local $oShell = OBJCreate("Shell.Application") if isOBJ($oShell) then local $result = $oShell.ShellExecute($program, $parameters, $workingDir, "runas", $show) else $result = false endIf return $result endFunc