l3ill Posted April 20, 2010 Share Posted April 20, 2010 (edited) Hi All, I am having trouble getting my counter to function on my work PC, works fine at home...both XP pro machines. any tips are welcome. already (un) checked (read only attributes) in properties. $oldcount = FileReadLine("tllcount.txt", 1) $result = StringCompare($oldcount, "999") If $result = 0 Then $newcount = 0 Else $newcount = $oldcount + 1 ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $newcount = ' & $newcount & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console EndIf $rc = _FileWriteToLine("tllcount.txt", 1, ($newcount), 1) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $rc = ' & $rc & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console MsgBox(0, "TLL", "+" & $rc, 1) Edited April 21, 2010 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 20, 2010 Share Posted April 20, 2010 What does "getting my counter to function" mean? What did it do? What were all the failure symptoms? Psychic debugging is only provided with a paid-up subscription to the AutoIt Pro site. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
l3ill Posted April 20, 2010 Author Share Posted April 20, 2010 Ah... sorry for the unclear-ness. It is not counting (adding one), and then writing the new number to the txt file. The error code is "6' which I assume means it is not writing to the text file. I purposely avoided using the phraseology "not working at work to avoid redundancy;-) Thanks My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
OctopusCO Posted April 20, 2010 Share Posted April 20, 2010 Error code 6 for the _FileWriteToLine means that the text you're inputting into the file is invalid. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 20, 2010 Share Posted April 20, 2010 The error code is "6' which I assume means it is not writing to the text file.See the help file under _FileWriteToLine(): Return ValueSuccess: 1 Failure: 0 and set @error @Error: 1 = File has less lines than $iLine 2 = File does not exist 3 = Error when opening file 4 = $iLine is invalid 5 = $fOverWrite is invalid 6 = $sText is invalidCheck the value of $newcount.I'm curious why you put parens around "($newcount)". Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
l3ill Posted April 20, 2010 Author Share Posted April 20, 2010 (edited) yeah, I thought so too.. doesn't make any since though. The exact same code works on one pc and not another... that's why I came up with the idea that some sort of write privileges must be the problem.Edit:Okay I think I found the problem;I had borrowed the code from this post.And at some point lost the "String" part of ($newcount).So I guess it should look like this:$rc = _FileWriteToLine("tllcount.txt", 1, String($newcount), 1)I will test it tomorrow at work and post the solution...would still like to know why it works on this pc w/out it though:blink: Edited April 20, 2010 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted April 21, 2010 Author Share Posted April 21, 2010 Strange... The missing (String) may have been a problem but not "The" problem.Turns out @Scriptdir was missing in the ("tllcount.txt") path....interesting that it works here and not there with and or w/out.Thanks again for the input. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example 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