Jump to content

Search the Community

Showing results for tags 'pipe'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 3 results

  1. I'm trying to drive a command prompt by sending instructions via a NamedPipe. This way you can (should) be able to send commands to the command prompt and at the same time "view" the result in the same window. This is not allowed if you run a command prompt with "opt_flag" parameters (redirected streams) because this will disable StdOut on the cmd itself. This small (trivial) snippet works for the first command sent to the cmd, but further submissions will fail. Maybe the problem is in how I use the run () command to start a new cmd with the StdIn redirect from the NamedPipe. It seems that the generated cmd will close automatically after the first reception of the command via NamedPipe. suggestions on how to make it work are welcome thanks #include <NamedPipes.au3> #include <WinAPI.au3> ; Creates an instance of a named pipe Global $sPipeName = "\\.\pipe\pipename" Global $hPipe = _NamedPipes_CreateNamedPipe($sPipeName, 1, 1) MsgBox(0, "Debug", "Pipe created. Now open a CMD") ; run a cmd with only StdIn redirected (StdIn data incoming from a pipe) Global $hCMD = Run(@ComSpec & " /K cmd < " & $sPipeName & @CRLF, "c:\") ; ok? MsgBox(0, "Debug", "now Send a command to the cmd via a NamedPipe") _StdInPipeWrite("dir" & @CRLF) MsgBox(0, 'Debug', "further commands will fail" & @CRLF & "now send command 'dir c:\windows'") $sMessage = "Dir c:\windows" & @CRLF _StdInPipeWrite($sMessage) MsgBox(0, 'Debug', "send another command (will also fail)" & @CRLF & "now send command 'echo Hello'") _StdInPipeWrite("echo Hello" & @CRLF) MsgBox(0, "Debug", "end of test") ProcessClose($hCMD) Func _StdInPipeWrite($sMessage) ; =============================================================================================================================== ; This function writes a message to the pipe ; =============================================================================================================================== Local $iWritten, $iBuffer, $pBuffer, $tBuffer $iBuffer = StringLen($sMessage) + 1 $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]") $pBuffer = DllStructGetPtr($tBuffer) DllStructSetData($tBuffer, "Text", $sMessage) If Not _WinAPI_WriteFile( _ $hPipe, _ ; ...... Handle to the file to be written $pBuffer, _ ; .... Pointer to the buffer containing the data to be written $iBuffer, _ ; .... Number of bytes to be written to the file $iWritten, _ ; ... The number of bytes written 0 _ ; ............ [optional] A $tagOVERLAPPED structure or a pointer to it ) Then ConsoleWrite("WriteMsg: _WinAPI_WriteFile failed" & @CRLF & _WinAPI_GetLastErrorMessage()) Else ConsoleWrite("WriteMsg: write OK" & @CRLF & _WinAPI_GetLastErrorMessage() & @CRLF) EndIf EndFunc ;==>_StdInPipeWrite
  2. Hello, I have a console application that works with command line arguments which I don't have its source code, & I want to create a GUI for it to make it easier. My problem is how to make the GUI application calls the console application & handle its output results to display it in the GUI application with a progressbar or somthing ? Please look at the "X265 Command Line Options" https://x265.readthedocs.org/en/default/cli.html MeGUI is only a GUI app for the cli apps : http://sourceforge.net/p/meguimodproj/code/HEAD/tree/MeGUI Mod/ Help me please
  3. I am making an app that will allow the migration of users from one server to another (while changing permissions) easier for anyone and everyone. Below is my code, what I can't seem to figure out is what I am missing in my code so that the _uArray() reads the folder names in the destination folder and then uses them to set some of the permissions settings. Right now the array pulls the data just fine, but either puts a "|" between the names (which I understand is "normal") or it removes the "|" and puts the folder names together in one long string, which is why I used StringSplit() only now it does not display anything at all. If anyone has time, would it be possible for someone to look at this and help me solve this issue. I think it would a great app that anyone can use that, like me, needs to migrate users across domains or servers. Thank you in advance. #include <GUIConstantsEx.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <Constants.au3> #include <FileConstants.au3> #include <ButtonConstants.au3> #include <File.au3> #include <Array.au3> #include <StringConstants.au3> Global $set = 3 ;==========================Main GUI=========================== $hGUI = GUICreate("Complex-Permissions", 250, 350) ;============================================================= ;==========================Inputs============================= $hOld = GUICtrlCreateInput("", 95, 25, 130) $hNew = GUICtrlCreateInput("", 95, 50, 130) $hOldSvr1 = GUICtrlCreateInput("", 95, 75, 25) GUICtrlSetLimit(-1, $set) $hOldSvr2 = GUICtrlCreateInput("", 130, 75, 25) GUICtrlSetLimit(-1, $set) $hOldSvr3 = GUICtrlCreateInput("", 165, 75, 25) GUICtrlSetLimit(-1, $set) $hOldSvr4 = GUICtrlCreateInput("", 200, 75, 25) GUICtrlSetLimit(-1, $set) $hNewSvr1 = GUICtrlCreateInput("", 95, 100, 25) GUICtrlSetLimit(-1, $set) $hNewSvr2 = GUICtrlCreateInput("", 130, 100, 25) GUICtrlSetLimit(-1, $set) $hNewSvr3 = GUICtrlCreateInput("", 165, 100, 25) GUICtrlSetLimit(-1, $set) $hNewSvr4 = GUICtrlCreateInput("", 200, 100, 25) GUICtrlSetLimit(-1, $set) $hLetter = GUICtrlCreateInput("", 95, 125, 130) $hShare = GUICtrlCreateInput("", 95, 150, 130) $hLocal = GUICtrlCreateInput("", 95, 175, 130) $hFolder = GUICtrlCreateInput("", 95, 200, 130) $hUID = GUICtrlCreateInput("", 95, 225, 130) $hExclude = GUICtrlCreateInput("", 95, 250, 130) ;============================================================= ;==========================Buttons============================ $hButton1 = GUICtrlCreateButton("Test", 25, 285, 50) ;~ GUICtrlSetState(-1, $GUI_HIDE) $hButton2 = GUICtrlCreateButton("Migrate Data / " & @CRLF & "Change Permissions", 100, 285, 120, 50, $BS_MULTILINE) ;============================================================= ;==========================Labels============================= $hLabel1 = GUICtrlCreateLabel("Old Domain", 10, 28) $hLabel2 = GUICtrlCreateLabel("New Domain", 10, 53) $hLabel3 = GUICtrlCreateLabel("Old Server (IP)", 10, 78) $hLabel4 = GUICtrlCreateLabel("New Server (IP)", 10, 103) $hLabel5 = GUICtrlCreateLabel("Drive Letter", 10, 128) $hLabel5 = GUICtrlCreateLabel("Share Folder", 10, 153) $hLabel6 = GUICtrlCreateLabel("Local Folder", 10, 178) $hLabel7 = GUICtrlCreateLabel("Folder Name", 10, 203) $hLabel8 = GUICtrlCreateLabel("User Name", 10, 228) $hLabel9 = GUICtrlCreateLabel("Exclusions", 10, 253) ;============================================================= GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMSG() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 _uArray() Case $hButton2 ;~ _NetUse() ;~ _RoboCopy() _Perm() EndSwitch WEnd ;============================================================= ;~ Functions ;============================================================= Func _NetUse() RunWait(@ComSpec & " /c " & "net use \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\c$ /user:" & GUICtrlRead($hOld) & "\axeontech", "", @SW_HIDE) RunWait(@ComSpec & " /c " & "net use \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\Admin$ /user:" & GUICtrlRead($hOld) & "\axeontech", "", @SW_HIDE) Sleep(2000) EndFunc ;= _NetUse Func _RoboCopy() If GUICtrlRead($hExclude) <> "" then RunWait(@ComSpec & " /k " & "robocopy /B \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " \\" & GUICtrlRead($hNewSvr1) & "." & GUICtrlRead($hNewSvr2) & "." & GUICtrlRead($hNewSvr3) & "." & GUICtrlRead($hNewSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " /E /mir /XD " & GUICtrlRead($hFolder) & "\" & GUICtrlRead($hExclude) & "/w:0 /r:0 /log:c:\users\" & @UserName & "\desktop\migrate_profiles.txt", "", @SW_SHOW) MsgBox(0, "", "RoboCopy w/ Exceptions: Complete") Else RunWait(@ComSpec & " /k " & "robocopy /B \\" & GUICtrlRead($hOldSvr1) & "." & GUICtrlRead($hOldSvr2) & "." & GUICtrlRead($hOldSvr3) & "." & GUICtrlRead($hOldSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " \\" & GUICtrlRead($hNewSvr1) & "." & GUICtrlRead($hNewSvr2) & "." & GUICtrlRead($hNewSvr3) & "." & GUICtrlRead($hNewSvr4) & "\" & GUICtrlRead($hShare) & "\" & GUICtrlRead($hFolder) & " /E /mir /w:0 /r:0 /log:c:\users\" & @UserName & "\desktop\migrate_profiles.txt", "", @SW_SHOW) MsgBox(0, "", "RoboCopy w/o Exceptions: Complete") EndIf ;~ Sleep(2000) EndFunc ;= _RoboCopy Func _Perm() ;~ If GUICtrlRead($hLocal) = "" then ;~ GUICtrlSetData($hLocal, GUICtrlRead($hShare)) ;~ EndIf Local $hFileOpen = FileOpen("c:\users\" & @UserName & "\desktop\log.txt", $FO_APPEND) Local $iPID = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&TAKEOWN /f " & GUICtrlRead($hFolder) & " /r /d y", "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID) Local $sOutput = StdoutRead($iPID) FileWrite($hFileOpen, $sOutput) ;~ Sleep(1000) Local $iPID1 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /reset /T", "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID1) Local $sOutput = StdoutRead($iPID1) FileWrite($hFileOpen, $sOutput) Local $iPID2 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /inheritance:d /c /t", "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID2) Local $sOutput = StdoutRead($iPID2) FileWrite($hFileOpen, $sOutput) Local $iPID3 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & 'system":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID3) Local $sOutput = StdoutRead($iPID3) FileWrite($hFileOpen, $sOutput) Local $iPID4 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & @ComputerName & '\administrator":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID4) Local $sOutput = StdoutRead($iPID4) FileWrite($hFileOpen, $sOutput) Local $iPID5 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & @ComputerName & '\administrators":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID5) Local $sOutput = StdoutRead($iPID5) FileWrite($hFileOpen, $sOutput) Local $iPID6 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & GUICtrlRead($hNew) & '\domain admins":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID6) Local $sOutput = StdoutRead($iPID6) FileWrite($hFileOpen, $sOutput) Local $iPID7 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /grant " & '"' & GUICtrlRead($hNew) & '\' & GUICtrlRead($hUID) & '":(OI)(CI)F /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID7) Local $sOutput = StdoutRead($iPID7) FileWrite($hFileOpen, $sOutput) Local $iPID8 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & " /setowner " & '"' & GUICtrlRead($hNew) & '\' & GUICtrlRead($hUID) & '" /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID8) Local $sOutput = StdoutRead($iPID8) FileWrite($hFileOpen, $sOutput) Local $iPID9 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /remove:g " & '"' & 'everyone" /c /t', "", @SW_HIDE, $STDERR_MERGED) ProcessWaitClose($iPID9) Local $sOutput = StdoutRead($iPID9) FileWrite($hFileOpen, $sOutput) Local $iPID10 = Run(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hLocal) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /remove:g " & '"' & GUICtrlRead($hNew) & '\axeontech" /c /t', "", @SW_HIDE, $STDERR_MERGED) ; ProcessWaitClose($iPID10) Local $sOutput = StdoutRead($iPID10) FileWrite($hFileOpen, $sOutput) FileClose($hFileOpen) MsgBox(0, "", "Permissions Change: Complete") EndFunc ;= _Perm Func _uArray() $fFileList = _FileListToArray(GUICtrlRead($hLetter) & ":\" & GUICtrlRead($hLocal), "*", 2) ;~ _ArrayDisplay($fFileList, "$fFileList") $fFolder = _ArrayToString($fFileList, "|") $fSplit = StringSplit($fFolder, "|", $STR_ENTIRESPLIT) Run("Notepad") Sleep(1000) For $i = 1 To $fSplit[0] Send($fSplit[$i]) Next EndFunc
×
×
  • Create New...