Jump to content

stdoutread freezing


Recommended Posts

so i know that stdoutread will freeze the script, and wait until something new is written to the child window.

but in the help file, it has something like

while 1

$line = stdoutread($foo)

if @error = -1 then exitloop

wend

this works fine when you run comspec. but im running another program that opens its own command prompt. and when i get to that command it just freezes.

and its reading nothing, and i cant see any text in the child window (prompt)

i put a messagebox after this to debug....

and i use task manager to close the prompt, (end process) and the messagebox contains no data.

but interestingly enough, if i make a second script and run that program that makes the prompt, from that second script, and then winclose the prompt from my first script, i get data.

i dont see any data in the prompt window like if i was to run the program by hand and not call it by using "run" in the script, but when the window closes the variable has the data in it. its olmost like the program im running from the second script is pausing for some reason in direct relation to it being called from a script and not being ran manually. then its writing to the window in the split second that it closes...

just speculation.

anyways, this sucks, because i would like to detect the text instead of hoping that its there, and adding a sleep timer hoping it will be long enough before i close the prompt from the first script.

plus i though it would be fine as a crappy workaround to just use 2 scripts, but for some reason now, my firewall (zonealarm) is blocking the other script that my main script calls (says its been blocked) but i dont know what the hell is going on with that cause i dont have the antivirus part installed in that and im not accessing the internet. plus the damn thing STILL runs even though it says it was blocked. but it doesnt finish, although it does start and do a few things before its cut off.

but either way in any case, its not really the point. the point is i need a way to do this from one script instead of two.

i was thinking maybe adlib.. and have the function close the window, but i dunno if that would work, according to the helpfile i dont think it would... everything freezes, gui.. hotkeys... etc.etc.etc..

and another thing, in my script (the workaround using 2 scripts) i dont use the while loop.

i just use this

$line = stdoutread($foo)

and it reads all 15 lines from the prompt.

i have to do it like that because for somereason its not exitingloop ( @error nust not be -1) which makes NO F>^<ing sense!

(then of course i have to close the window from the main script, for the second script to write the variable to a .txt file, then have the main script read that sort of like a transfer of a variable between scripts. pshwew!)

its the only way i have gotten this thing to work, then i have been messing with some registry stuff from the second script, i think that may be what set zonealarm off, but it didnt block it the first 50 times i tested the program! and i dont even see any option to UNBLOCK the damn script. and it seems silly that the only workaround i can find is to use 2 scripts.

like i said, when i call comspec its flawless, but this command prompt i am having trouble with is coming from another application that is ran, and the title of the prompt window is the name of the directory the program is in + the program name... its not c:\windows\system32 so.... i dunno if that could be influencing the issue or not.

so i have been frustrated trying to figure this out. any ideas?

p.s. i am also having trouble with soundplay. i can play 2 sounds at the same time (usually the same time, depending on how busy my RAM is, sucks when you want to have exact timing.) but i have to call them from 2 seperate scripts.

i want to play a sound over and over, and play another sound while that first sound is playing without making the first sound get cut off.

i dunno if there is any other way besides using 2 scripts, or somehow (brainfart!) combining the seperate .wav files using sometype of recording software....??? (anyone know of anything like that for free?)

but ill look back at this post when i can. im busy busy busy!!!!

SORRY SUCH A LOOOOOONG POST!!!!!

thanks guys!

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

combining the seperate .wav files using sometype of recording software....??? (anyone know of anything like that for free?)

Audacity from soundforge is free and has a quickmix feature that works very nicely. I use the program to record my old vinyl... :)

Edited by jefhal
...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Link to comment
Share on other sites

First, posting your script and naming the child program you're running might give someone the clue they need.

im running another program that opens its own command prompt. and when i get to that command it just freezes.

and its reading nothing, and i cant see any text in the child window (prompt)

Right, you've told AutoIt to capture any output from your program that would go to standard output (the console window) so you wouldn't see anything there.

i put a messagebox after this to debug....

and i use task manager to close the prompt, (end process) and the messagebox contains no data.

but interestingly enough, if i make a second script and run that program that makes the prompt, from that second script, and then winclose the prompt from my first script, i get data.

Does the child program expect any kind of input from you? Also, if in your call to Run for the child program if you told AutoIt to provide STDIN then the child program may be halting waiting for input from AutoIt because the STDIN pipe is open, even though it wouldn't expect input otherwise.

and another thing, in my script (the workaround using 2 scripts) i dont use the while loop.

i just use this

$line = stdoutread($foo)

and it reads all 15 lines from the prompt.

i have to do it like that because for somereason its not exitingloop ( @error nust not be -1) which makes NO F>^<ing sense!

I noted that you said earlier that you had put a MsgBox in for debugging, which is cool, we all do it, but if you put it in between the StdoutRead and the @error test, then @error is in the state that the call to MsgBox left it, which is never going to be -1, and your loop won't ever exit.

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

First, posting your script and naming the child program you're running might give someone the clue they need.

the problem im having is not with the script, but just the code i already typed earlier.

and its not important what the program im running is, but if your curious i can tell you.

its a program that shows the cd key you have installed for a popular online game. so you put this program in the games directory and run it, and it instantly shows you your key in the console window.

Right, you've told AutoIt to capture any output from your program that would go to standard output (the console window) so you wouldn't see anything there.

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

the problem im having is not with the script, but just the code i already typed earlier.

and its not important what the program im running is, but if your curious i can tell you.

The way that code you typed earlier (the While loop) behaves depends on the way that the Run function was called, and with the way the child program is made to work. I couldn't divine either of those things from what you posted, and this is the only reason I asked for information about those things.

Sorry I wasn't more helpful or informative, and I wish you the best of luck.

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

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...