Jump to content

Stdout not working...any alternitive?


MariusN
 Share

Recommended Posts

RunWait(@TempDir & 'SetACL.exe -on ' & '"' & $Select0 & '"' & ' -ot file -actn ace -ace "n:Everyone;p:full" -actn ace -ace "n:Administrators;p:full"' _
        & ' -actn setowner -ownr "n:SYSTEM" -actn ace -ace "n:SYSTEM;p:full" -rec cont_obj', "", @SW_SHOW)

As you can see, the above command is using a file caled SetAcl to change permishions...It works 100%, but i'm trying to make it show the output WITHIN my script...I have tried Stdout , but to no avail. Is there any alternitive? Maybe something like a console read or somethin, as i do believe that certain applications cant work with Stdout. Reason for asking this, is i want to make my code more "decent", and not showing that a 2nd app is actually running. Here is one i did checking the network wich works 100%, but no go with SetACL

Func Status()
Local $h_gui, $i_edit, $h_edit
Local $s_stdout, $i_pid, $i_timer
Local $s_ip = @IPAddress1
Local $i_sec = 1
$h_gui = GUICreate("Current Connections on  IP: " & $s_ip, 540, 400, -1, 20)
$i_edit = GUICtrlCreateEdit("", 10, 10, 520, 380)
GUISetState()
$h_edit = GUICtrlGetHandle($i_edit)
$i_timer = TimerInit()
While 1
  Switch GUIGetMsg()
   Case $GUI_EVENT_CLOSE
    ExitLoop
  EndSwitch
  If TimerDiff($i_timer) / 1000 >= $i_sec Then
   $i_pid = Run(@ComSpec & " /c netstat -p TCP", @SystemDir, @SW_HIDE, 6)
   While 1
    $s_stdout &= StdoutRead($i_pid)
    If @error Then ExitLoop
   WEnd
   If $s_stdout Then
    WinSetState($h_edit, "", @SW_LOCK)
    GUICtrlSetData($i_edit, "")
    GUICtrlSetData($i_edit, $s_stdout)
    WinSetState($h_edit, "", @SW_UNLOCK)
   EndIf
   $s_stdout = ""
   $i_timer = TimerInit()
  EndIf
WEnd
GUIDelete()
EndFunc   ;==>Status
Edited by MariusN
Link to comment
Share on other sites

It can and has been done before. Please search the forum for "setacl stdout" and you will find something like

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

MariusN,

Recursion is no more complicated than the following...

func spin_files($folder)
local $hfldr= FileFindFirstFile($folder & "*.*")
if $hfldr = -1 then msgbox(0,'Error from filefindfirst','@error = ' & @error)
While 1
  $file = FileFindNextFile($hfldr)
  if @error then exitloop
  if @extended  then
    spin_files($folder & '' & $file)
  else
   $s_fls &= $folder & '' & $file & @crlf
  endif
WEnd
fileclose($hfldr)
return $s_fls
endfunc

or use Melba's UDF....

or search for file recursion, there are many threads on this topic...

kylomas

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...