Sign in to follow this  
Followers 0
Guest cbreaker

Capturing output from a textmode command

6 posts in this topic

#1 ·  Posted (edited)

I've tried a few different ways before posting, and having no ideas left i figure'd i'd ask here- what's the proper way to have a textmode application put it's output into a file? I've been trying:

$catchAll = RunWait(@COMSPEC & " /c" & " ..\..\au3\sed.exe s:CHANGEME:" & $answer & ":g " & $randomFolder & "\" & $file & " >" & $file & $file, "")

($file$file gets created but has a zero size)

Believe me, it wasn't that ugly when I started :ph34r:

I'm doing this because I need to modify some config files with sed.. anyone have any advice for what I'm missing? thanks

crap, is it because of not having quotes around the path for the incoming file? hmm.

i'm an idiot then, exscuse this post.

Edited by cbreaker

Share this post


Link to post
Share on other sites



When you do this command from the Commandprompt, does it then work and create a capture file ?... if so , how does it look ?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

When you do this command from the Commandprompt, does it then work and create a capture file ?... if so  , how does it look ?

I knew it was going to be something stupid :ph34r:

Know of any way to retrieve AutoIt's process ID easily? i don't see a macro

(wanted something cleaner for tmp files than the filename twice)

Share this post


Link to post
Share on other sites

If you just need a temp file you can use something like this:

$temp1 = @TempDir & "\temp" & Int(Random(1,1000)) & ".tmp"

That will generate a random filename between temp1.tmp and temp999.tmp. It also uses the user's temp directory so that if a script is executed from a read-only directory it will still succeed. If I need more than 2 or 3 tempfiles, I'll use a for loop at the top to create an array of temp file locations and just referance by array index.


[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Share this post


Link to post
Share on other sites

compiled scripts use their name as the process name, as does any app, I think that the Process* functions are only in unstable, but check your helpfile for ProcessExists which should be able to give you the PID for any given running process...

if @compiled = 1 then 
   $PID = ProcessExists(@Scriptname)
else 
   $PID = ProcessExists("autoit3.exe")
endif

"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

nice, thanks for the input guys!

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