Jump to content

Recommended Posts

Posted (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 by billo
Posted

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.

:idea:

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
Posted

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

Posted

The error code is "6' which I assume means it is not writing to the text file.

See the help file under _FileWriteToLine():

Return Value

Success: 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 invalid

Check the value of $newcount.

I'm curious why you put parens around "($newcount)".

:idea:

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
Posted (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 by billo

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
×
×
  • Create New...