NEOhidra Posted January 23, 2016 Posted January 23, 2016 Looks like i am missing something. Why Quote Run(@ComSpec & " /c tasklist >> processes.txt", "") from this example #include <MsgBoxConstants.au3> #include <Date.au3> #include <File.au3> $data = @YEAR &'.'& @MON &'.'& @MDAY &' '& @HOUR &':'& @MIN &':'& @SEC FileOpen ( "processes.txt", $FO_OVERWRITE ) FileWriteLine ( 'processes.txt', '-=-=-=-=-=- ' & $data & ' -=-=-=-=-=-' ) FileClose ( "processes.txt" ) Run(@ComSpec & " /c dir >> output.txt", "") Run(@ComSpec & " /c tasklist >> processes.txt", "") Run(@ComSpec & " /c tasklist >> processes1.txt", "") MsgBox(0, "Message", "Done") doesnt work, while Quote Run(@ComSpec & " /c dir >> output.txt", "") and Quote Run(@ComSpec & " /c tasklist >> processes1.txt", "") function just fine?
Developers Jos Posted January 23, 2016 Developers Posted January 23, 2016 The fileclose() is wrong and doesn't do anything! You need to save the Filehandle from FileOpen in a variable and use that with FileClose(). Check the Helpfile for the details. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
NEOhidra Posted January 23, 2016 Author Posted January 23, 2016 (edited) @Jos Thank you for the hint! I was wondering why this: #include <MsgBoxConstants.au3> #include <Date.au3> #include <File.au3> $data = @YEAR &'.'& @MON &'.'& @MDAY &' '& @HOUR &':'& @MIN &':'& @SEC FileOpen ( "processes.txt", $FO_OVERWRITE ) FileWriteLine ( 'processes.txt', '-=-=-=-=-=- ' & $data & ' -=-=-=-=-=-' ) FileClose ( "processes.txt" ) Run(@ComSpec & " /c tasklist >> processes.txt", "") works? Edited January 23, 2016 by NEOhidra
Gianni Posted January 23, 2016 Posted January 23, 2016 try this: #include <MsgBoxConstants.au3> #include <Date.au3> #include <File.au3> $data = @YEAR & '.' & @MON & '.' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC $hMyFileHandle = FileOpen(@ScriptDir & "\processes.txt", $FO_OVERWRITE) FileWriteLine($hMyFileHandle, '-=-=-=-=-=- ' & $data & ' -=-=-=-=-=-') FileClose($hMyFileHandle) RunWait(@ComSpec & " /c dir >> " & @ScriptDir & "\processes.txt", "", @SW_HIDE) RunWait(@ComSpec & " /c tasklist >> " & @ScriptDir & "\processes.txt", "", @SW_HIDE) ; Run(@ComSpec & " /c tasklist >> processes1.txt", "") ; <--- do you want write to a new file ?? ShellExecute(@ScriptDir & "\processes.txt") MsgBox(0, "Message", "Done") ..... as Jos already sayd ..... Check the Helpfile for the details... Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now