Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/22/2022 in all areas

  1. New version in first post Version: 2022.07.22 - Support scripts with the same name but different content in different directories.
    2 points
  2. As mine was marked as the solution, I've passed the thanks onto Resiak1811.
    1 point
  3. No. You only have to copy the interpreter AutoIt3.exe (or AutoIt3_x64.exe) to the respective computer. With that, you can start .au3 (or .a3x) files. @dersiniar Edit : The call can be made e.g. via a .cmd or a desktop shortcut. You can even pass command line parameters. Example (.cmd) : @echo off CLS cd %~dp0 Start "Info" /wait "AutoIt3.exe" "myscript.au3" -s -q
    1 point
  4. Search the forum for _RunAU3.
    1 point
  5. try that : #include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> $Computer = @ComputerName Local $timestamp $GUI = GUICreate($Computer & " time", 150, 80, "", "", BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD)) WinSetOnTop($GUI, "", 1) $Cmd_out = _GetDOSOutput("net time \\" & $Computer) $timestamp = StringRegExp($Cmd_out, "\d{2}:\d{2}:\d{2}", 1) GUICtrlCreateLabel($timestamp[0], 20, 10, 120, 350) GUICtrlSetFont(-1, "18", "800", "", "Consolas") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch $aTime = TimeCalc($Computer) WEnd Func TimeCalc($Computer) $Cmd_out = _GetDOSOutput("net time \\" & $Computer) If $Cmd_out <> "" Then $timestamp = StringRegExp($Cmd_out, "\d{2}:\d{2}:\d{2}", 1) GUICtrlSetData(-1, $timestamp[0]) EndIf EndFunc ;==>TimeCalc Func _GetDOSOutput($sCommand) Local $iPID, $sOutput = "" $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput &= StdoutRead($iPID, False, False) If @error Then ExitLoop Sleep(10) WEnd Return $sOutput EndFunc ;==>_GetDOSOutput
    1 point
  6. Sorry that doesn't make sense. If you ran the script above it would just start the other script and exit, it doesn't pass anything on to the other script, the two scripts run independently of each other. If you want to close the current script you would just use @AutoItPid basic example: HotKeySet("{ESC}", "_ExitScript") ;~ Press Escape to exit $iPID = Run(@ComSpec & " /k ") ;~ Start Command Prompt While 1 Sleep(100) WEnd Func _ExitScript() ProcessClose($iPID) ;~ Closes Command Prompt ProcessClose(@AutoItPID) ;~ Closes the current script ;~ Or Exit ;~ Closes the current script EndFunc
    1 point
  7. Trong

    read cmd output

    Function for CMD: ;~ #RequireAdmin #include <File.au3> If @OSArch = "X64" And Not @AutoItX64 Then _Wow64FsRedirection(0) Local $output= _RunCmd_GetOutput("qwinsta") ;~ Local $output=_StreamCMD("ping 8.8.8.8") Local $username=StringStripWS(StringMid($output,StringinStr($output,"console")+18,20),3) MsgBox(0, "", $username) Func _RunCmd_GetOutput($sCommand) ConsoleWrite("+Execute: " & $sCommand & @CRLF) Local $sOutput = '', $iPID = Run('"' & @ComSpec & '" /c ' & $sCommand, '', @SW_HIDE, 0x6) Do $sOutput &= StdoutRead($iPID) Until @error Do $sOutput &= StderrRead($iPID) Until @error ConsoleWrite($sOutput&@CRLF) Return $sOutput EndFunc ;==>_RunCmd Func _StreamCMD($sCMD, $sCallBackFunction = Default, $WorkingDir = Default, $iStreamType = Default, $iShowFlag = Default, $iDelay = Default) If StringStripWS($sCMD, 8) = "" Then Return "" If $sCallBackFunction = Default Then $sCallBackFunction = "ConsoleWrite" ;~ If $WorkingDir = Default Then $WorkingDir = @SystemDir ;@WindowsDir & '\System32' If $WorkingDir = Default Then $WorkingDir = @WindowsDir & '\System32' If $iStreamType = Default Then $iStreamType = $STDERR_CHILD + $STDOUT_CHILD If $iShowFlag = Default Then $iShowFlag = False If $iDelay = Default Then $iDelay = 250 ConsoleWrite("! Execute: " & $sCMD & @CRLF) Local $sTMP = '', $sSTD = '', $sCOM = '"' & @WindowsDir & '\System32\cmd.exe"' & ' /c ' & $sCMD ;~ Local $sTMP = '', $sSTD = '', $sCOM = @ComSpec & ' /c ' & $sCMD Local $iWin = $iShowFlag ? @SW_SHOW : @SW_HIDE Local $iPID = Run($sCOM, $WorkingDir, $iWin, $iStreamType) While 1 $sTMP = StdoutRead($iPID, False, False) If @error Then ExitLoop If $sTMP <> "" Then $sTMP = StringReplace($sTMP, @CR & @CR, '') $sSTD &= $sTMP Call($sCallBackFunction,$sTMP) ;~ ConsoleWrite($sTMP) Sleep($iDelay) EndIf WEnd While 1 $sTMP = StderrRead($iPID, False, False) If @error Then ExitLoop If $sTMP <> "" Then $sTMP = StringReplace($sTMP, @CR & @CR, '') $sSTD &= $sTMP Call($sCallBackFunction,$sTMP) ;~ ConsoleWrite($sTMP) Sleep($iDelay) EndIf WEnd ;~ If $sSTD <> "" Then ConsoleWrite(@CRLF) Return SetError(@error, @extended, $sSTD) EndFunc ;==>_StreamCMD ; * -----:| Dao Van Trong - TRONG.WIN Func _Wow64FsRedirection($state) If @OSArch = "X64" Then If $state Then ;DllCall("kernel32.dll", "int", "Wow64EnableWow64FsRedirection", "int", 1) DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "int", 0) Else ;DllCall('kernel32.dll', 'boolean', 'Wow64EnableWow64FsRedirection', 'boolean', False) DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0) EndIf If @error Then Return SetError(1, 0, 0) Return 1 EndIf EndFunc ;==>_Wow64FsRedirection
    1 point
×
×
  • Create New...