Jump to content

club

Members
  • Posts

    6
  • Joined

  • Last visited

club's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I had just done something very similar right before I refreshed this thread. Does the trick. You're right also, I guess just a personal preference in the end. Thanks again!
  2. I see now when I force the script the exit it doesnt just drop everything and die. It must do some housekeeping, such as close any opened files. This must be while my output file suddenly gets filled out as it should when I exit the script. It wasnt that the script was "freezing", just failing to exit the loop. Well definitely I appreciate your input. But I'm so OCD and my college instructors hammered into my brain that forcing a break out of a loop instead of using the loop's specified exit conditions being satisfied is a no-no. Or at least, I wouldve gotten dinged for such, gradewise.
  3. Ok, maybe not as expected. Seems the script freezes consistantly at some point. I thought it was hitting some character that was freaking it out but that doesn't seem to be the case. For example, if I open the output txt file it seems the script froze in mid-write. It partially wrote a line it found a hyphen in, but the line abruptly ends when there was more to that line in the input file. But then it gets even weirder. If I right click the script's icon and force it to exit, the output file instantly becomes complete. So it was working, but like stuck somehow. All those FileWriteLine's were like stuck in memory or something. And why would they suddenly work when I force the script to stop. Doesnt that just end the script immediately and dump whatever it was working on in memory? I mean, I guess it's working in a roundabout way... I wait till it seems to be frozen and then manually stop it and the output is as desired. But what is going on here? I've added a Sleep in my loop to see if that would help, but it seems to make no difference.
  4. Ah nevermind. Im dumb. My actual variables are named different from the example I posted and I typo'd one of them. All works as expected now.
  5. My goal is to parse a source text file and if any lines contain a hyphen then write that line to a new txt file. So the resulting product file will be a subset of the first file, but only lines that contain a hyphen. Here's what I got: $input = FileOpen("C:tempsource.txt", 0) $output = FileOpen("C:tempdone.txt", 2) Do $line = FileReadLine($input) If StringInStr($line, "-") Then FileWriteLine($output, $line) Until @error = -1 FileClose($input) FileClose($output) Problem is, my resulting file only contains the first instance of a line with a hypen, which is repeated over and over again. It's as if the script isnt moving to the next line the 2nd time it executes FileReadLine. The documentation says FileReadLine should automatically increment and read the next line in an opened file, so there shouldn't be any need to set up a counter to guide it. Any ideas why I'm getting this problem then? What simple thing am I missing? Much TiA.
  6. Before I get flamed for not searching on this.. I did. And those people were told to check the read-only bit on the parent folder. I did. The parent folder, as well as the script I'm trying to compile are: -not read-only -have me as the Owner -Have full-control permissions set Yet I get this error every time I try to compile a script. I was able to just 2 days ago. I still have a script and it's corresponding exe in this same directory. If I rename the exe and try to re-compile the script, I get the error. Incidentally this is happening everywhere on my C: drive that I try to compile a script. But like I said , this directory in particular I can confirm allowed this action just 2 days ago. What gives? FYI this is Windows 7 Ultimate, 32-bit Anyone come across this problem as well?
×
×
  • Create New...