gcue Posted March 5, 2009 Share Posted March 5, 2009 (edited) hello i cant for the live of me figure out whats wrong with this: $asset = "192.168.12.12" $output_dir = "c:\documents and settings\all users\desktop\script" $file = ($output_dir & "\Active_Processes\active-processes_" & $asset & ".txt") FileWrite($file, '"' & @ScriptDir & '\pslist.exe" \\' & $asset & " > " & '"' & $file & '"') RunWait(@ComSpec & ' /c "' & @ScriptDir & '\pslist.exe" \\' & $asset & " > " & '"' & $file & '"', "", @SW_HIDE) ShellExecute($file) i even copy and paste teh filewrite results into a cmd window which works.. but the runwait doesnt - arrrrggg!!! Edited March 5, 2009 by gcue Link to comment Share on other sites More sharing options...
SpookMeister Posted March 5, 2009 Share Posted March 5, 2009 first look at your paths... for testing you might try to put everything in a folder like C:\Testing\ Next, sometimes I've found that the run command needs to have $STDIN_CHILD flagged on it to run some things properly (requires #include<Constants.au3>) [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 no dice.. i tried a output dir with no space and i also tried the $stdin_child Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 5, 2009 Moderators Share Posted March 5, 2009 gcue,I realise it probably just a typo, but you define $outputdir and then use $output_dir to define $file.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 (edited) ya that was me doing a typo on my post not int eh script =/ i have no idea what the prob is!!! usually the filewrite helps me figure this out but not in this case.. Edited March 5, 2009 by gcue Link to comment Share on other sites More sharing options...
SpookMeister Posted March 5, 2009 Share Posted March 5, 2009 This works for me to grab the output: #include <Constants.au3> ; Example Usage $result= _CMDreturn('c:\pslist.exe \\192.168.1.55') msgbox(0,"Version",$result) Func _CMDreturn($sCommand) ; This function returns the output of a DOS command as a string $cmdreturn = "" $stream = Run(@ComSpec & " /c " & $sCommand, @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDIN_CHILD) While 1 ; loop through the return from the command until there is no more $line = StdoutRead($stream) If @error Then ExitLoop $cmdreturn &= $line WEnd Return $cmdreturn EndFunc ;==>_CMDreturn [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 ok it looks like you cant have quotes in teh output file... Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 so it works without the quotes if the filepath doesnt have spaces.. but if the filepath has spaces it doesnt work i tried setting the quotes in the run command and in the $file declaration - neither worked =/ $file = '"' & $output_dir & '\Checkers\Active_Processes\active-processes_' & $asset & '.txt"'oÝ÷ Ú)¬ç[£7éø¥y©ÝÙh¢K(»(¶§ÚâyÖ®¶se'VåvB6öÕ7V2fײb33²ö2gV÷C²b33²fײ67&DF"fײb33²b3#·6Æ7BæWRgV÷C²b3#²b3#²b33²fײb33c¶76WBfײgV÷C²fwC²gV÷C²fײb33²gV÷C²b33²fײb33c¶fÆRfײb33²gV÷C²b33²ÂgV÷C²gV÷C²Â5uôDR still no go help! Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 ok even this doesnt work Run(@ComSpec & ' /c "' & @ScriptDir & '\pslist.exe" \\' & $asset & " > c:\documents and settings\eh.txt", "", @SW_HIDE) BUT again if i manually type out the whole command and path in a cmd window, it works (with spaces and quotes) Link to comment Share on other sites More sharing options...
SpookMeister Posted March 5, 2009 Share Posted March 5, 2009 maybe: Run(@ComSpec & ' /c "' & @ScriptDir & '\pslist.exe" \\' & $asset & ' > "c:\documents and settings\eh.txt"', "", @SW_HIDE) for testing though, I usually do something like stick the entire convoluted command line into a variable and then show it in a msgbox just to make sure all the parts extrapolate properly and that it has the right 'quoting' [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 ya that didnt work for me either.. did it work for you? Link to comment Share on other sites More sharing options...
weaponx Posted March 5, 2009 Share Posted March 5, 2009 Why don't you just use ProcessListProperties with the remote parameter?http://www.autoitscript.com/forum/index.ph...slistproperties Link to comment Share on other sites More sharing options...
weaponx Posted March 5, 2009 Share Posted March 5, 2009 $asset = "192.168.12.12" $output_dir = @ScriptDir $file_path = $output_dir & "\active-processes_" & $asset & ".txt" $command = StringFormat('pslist.exe \\\\%s > "%s"',$asset,$file_path) ConsoleWrite($command & @CRLF) ;RunWait(@ComSpec & ' /K ' & $command, @ScriptDir, @SW_SHOW);Laave command window open after completion RunWait(@ComSpec & ' /C ' & $command, @ScriptDir, @SW_HIDE);Close command window immediately ShellExecute($file_path) Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 brilliant!!!!!!!!!!!!!!!! thank you weapon!!!!!!! Link to comment Share on other sites More sharing options...
SpookMeister Posted March 5, 2009 Share Posted March 5, 2009 (edited) I think the key to WeaponX's solution was using @ScriptDir as the workingdir in the command (as that is where your executable was located) $asset = "192.168.12.12" $output = '"c:\documents and settings\eh.txt"' $command='pslist.exe \\' & $asset & ' > ' & $output RunWait(@ComSpec & ' /c ' & $command, @ScriptDir, @SW_HIDE) [edit] clarification Edited March 5, 2009 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 nah i tried scriptdir it was the stripping of the spaces i think Link to comment Share on other sites More sharing options...
weaponx Posted March 5, 2009 Share Posted March 5, 2009 You need to specify the working directory when using Run and RunWait. Also I used StringFormat to relieve the quote usage confusion but then I had to escape the hell out of the backslashes. Link to comment Share on other sites More sharing options...
gcue Posted March 5, 2009 Author Share Posted March 5, 2009 cool thanks for the explanation! Link to comment Share on other sites More sharing options...
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