Jump to content

killgore

Members
  • Posts

    8
  • Joined

  • Last visited

killgore's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Sorry for reviving so old thread, but does someone know why this piece of code doesn't work properly on Windows 8 / 8.1? You have to press ENTER twice and only second string is returned. The same compiled program run on Windows 7 works great.
  2. Hi, I've been using solution described in topic '?do=embed' frameborder='0' data-embedContent>> with success up to Windows 7 (x64). But lately I've moved my program to Windows 8 (x64). And every time I try to read user input from command prompt I have to press ENTER two times and returned string is empty. I've tried compiling again on Windows 8 but result is the same
  3. @FireFox Thank you very much, seems to be what I need. I'll report back if I can make it work the way I want. @JLogan3o13 Well, it's not the same subject anymore. I started previous thread thinking that I have problems with timerdiff in while loop, and it turned out to be something completely different.
  4. Hi, I've tried to achieve above-mentioned with code from but stumbled upon problems that I mentioned here '?do=embed' frameborder='0' data-embedContent>> So, has anyone done this? I mean, prompt user for input (like "Please enter your name:"), wait for some time, and move along when there is no input. And yes, it's a console application. BTW, it seems very strange that AutoIt has so many advanced functions, but it lacks simple way to read user input from command prompt.
  5. Look, "con" file is a special file. Just take a look at . This code works. I was trying to modify it to set time limit for a user. It seems that I misunderstood how it works. I thought that while loop is running all the time capturing keystrokes. But using _WinAPI_ReadFile without while also waits for ENTER, so it seems I can't achieve what I want with this code. So, I will rephrase my question: Is there a way in autoit to read user input from command prompt with some kind if time limit?
  6. No, and I think it's not the point. It looks like condition is not evaluated. I've made an experiment and removed while loop completely, so only these 2 lines left. _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 1, $nRead) If $nRead > 0 Then $sRet &= DllStructGetData($tBuffer, 1) Even without While command prompt waits for user input. So it seems that _WinAPI_ReadFile stops execution.
  7. I've tried. If I remove _WinAPI_ReadFile related code timer works, but with this three lines even if I insert some ConsoleWrite or FileWrite (eg. ConsoleWrite(Int(TimerDiff($start))) ) in this loop it looks like this piece of code is omitted. I don't know exactly what's going on in these three lines so maybe the problem is it's working completely different than I think it is.
  8. Hi! I'm trying to adapt piece of code found here to set time limit for user to enter something in command prompt. I wrote something like this: Local $tBuffer = DllStructCreate("char"), $nRead, $sRet = "" Local $hFile = _WinAPI_CreateFile("CON", 2, 2) $start = TimerInit() While TimerDiff($start) < 10000 _WinAPI_ReadFile($hFile, DllStructGetPtr($tBuffer), 1, $nRead) If DllStructGetData($tBuffer, 1) = @CR Then ExitLoop If $nRead > 0 Then $sRet &= DllStructGetData($tBuffer, 1) WEnd But it doesn't work. Command prompt waits endlessly for input. I've tried changing "TimerDiff($start) < 10000 " to "if TimerDiff($start) > 10000 Then ExitLoop " but it seems like condition is not even evaluated. Am I missing something?
×
×
  • Create New...