Sign in to follow this  
Followers 0
MariusN

Stdout not working...any alternitive?

8 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Share this post


Link to post
Share on other sites

Maybe do not use SetACL.exe altogether and give this a try?

Eish man, what a bargain...didnt even know Permissions.au3 exists...lol

...thx KaFu :D

Share this post


Link to post
Share on other sites

$ret2 = _SetObjectOwner(@HomeDrive&'junk',$SE_FILE_OBJECT, "System")

The above code works 100%, but is there a way to make it Recurse? ( I'ts a Directory with Subs )

...tia

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

thx kylomas....i did the above, but forgot the "*.*"....lol

Share this post


Link to post
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
Sign in to follow this  
Followers 0