Jump to content
Sign in to follow this  
lgnihlman

Increase variable trouble

Recommended Posts

lgnihlman

I need a little help with this code:

CODE

;read counterfile

$cntfile="c:\program\quick\chpsw\pswcnt.txt"

$pswcnt=FileRead($cntfile)

;read pwdfile

$pswfile=FileOpen("c:\program\quick\chpsw\psw.txt",0)

$psw=FileReadLine($pswfile,$pswcnt)

FileClose($pswfile)

;Run application

;Run(@ComSpec & " /c " & 'c:\program\quick\quick password User=.gruiweb.adm.kommun' & $psw, "", @SW_HIDE)

;Increase counter

$pswcnt = $pswcnt + 1

FileOpen($cntfile,2)

FileWriteLine($cntfile,$pswcnt)

FileClose($cntfile)

Exit

The idea is to read the counter file, run the application and then increase the the value in the counter file and save the file.

I can't get the $pswcnt = $pswcnt + 1 to work.

Share this post


Link to post
Share on other sites
weaponx

Use: $pswcnt += 1

Also you should be writing to an ini file, not plain text.

;read counterfile
$cntfile = "c:\program\quick\chpsw\pswcnt.ini"
$pswcnt = IniRead($cntfile, "Password", "Count", 0)

;read pwdfile
$pswfile = FileOpen("c:\program\quick\chpsw\psw.txt", 0)
$psw = FileReadLine($pswfile, $pswcnt)
FileClose($pswfile)

;Run application
;Run(@ComSpec & " /c " & 'c:\program\quick\quick password User=.gruiweb.adm.kommun' & $psw, "", @SW_HIDE)

;Increase counter
IniWrite($cntfile, "Password", "Count", $pswcnt + 1)
Edited by weaponx

Share this post


Link to post
Share on other sites
lgnihlman

Use: $pswcnt += 1

Also you should be writing to an ini file, not plain text.

;read counterfile
$cntfile = "c:\program\quick\chpsw\pswcnt.ini"
$pswcnt = IniRead($cntfile, "Password", "Count", 0)

;read pwdfile
$pswfile = FileOpen("c:\program\quick\chpsw\psw.txt", 0)
$psw = FileReadLine($pswfile, $pswcnt)
FileClose($pswfile)

;Run application
;Run(@ComSpec & " /c " & 'c:\program\quick\quick password User=.gruiweb.adm.kommun' & $psw, "", @SW_HIDE)

;Increase counter
IniWrite($cntfile, "Password", "Count", $pswcnt + 1)
Thanx !

Share this post


Link to post
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
Sign in to follow this  

×