blublub Posted August 17, 2007 Share Posted August 17, 2007 (edited) Global $li Global $z Global $cc HotKeySet("1","go") $li=FileOpen("D:\s\c.au3",0) $z=Number(FileReadLine($li,1)) FileClose($li) $li=FileOpen("d:\s\c.au3",2) Func go() [..] $z=$z+1 FileWrite($li,$z) Endfunc Do sleep(100) Until 0 im guessing from the help file that setting in FileOpen mode 2 = Write mode (erase previous contents) will erase my number and set the new one +1 but it doesnt its same like in mode 1 when im changing it i dont see the difference help tell me what im doing wrong :/ edit: nvm... sry for post im stupid its just deleting when opening not when writing constatly... Edited August 17, 2007 by blublub Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 17, 2007 Share Posted August 17, 2007 This worked for me: Global $sFile = "C:\Temp\Test.txt" Global $li Global $z Global $cc HotKeySet("1","go") HotKeySet("{ESC}", "_Quit") $li=FileOpen($sFile,0) $z=Number(FileReadLine($li,1)) FileClose($li) $li=FileOpen($sFile,2) If $li = -1 Then MsgBox(16, "Error", "Failed to open file: " & $sFile) Exit EndIf Do sleep(20) Until 0 Func go() $z=$z+1 FileWrite($li,$z) Endfunc Func _Quit() FileClose($li) Exit EndFunc 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...
blublub Posted August 17, 2007 Author Share Posted August 17, 2007 (edited) This worked for me: expandcollapse popupGlobal $sFile = "C:\Temp\Test.txt" Global $li Global $z Global $cc HotKeySet("1","go") HotKeySet("{ESC}", "_Quit") $li=FileOpen($sFile,0) $z=Number(FileReadLine($li,1)) FileClose($li) $li=FileOpen($sFile,2) If $li = -1 Then MsgBox(16, "Error", "Failed to open file: " & $sFile) Exit EndIf Do sleep(20) Until 0 Func go() $z=$z+1 FileWrite($li,$z) Endfunc Func _Quit() FileClose($li) Exit EndFuncoÝ÷ Ûú®¢×+"²z-§µçbÁ©íjÇ+m«pYky§gºfÞ§]ûV§vÞ¯ âµèÞ²)©ç±¦V§jبØ^ë!¢çemê'-gºfÞ®)Üæ¬x½êò¶)Þ²Ír¢êìËæ¬)ÞÛ#ºËZuÛ5Û~9ë¿-¢Ø^~)^²keG+ºÚ"µÍÛØ[ ÌÍÛBÛØ[ ÌÍÞÝÙ^TÙ] ][ÝÞÑLI][ÝË ][ÝÜ]Z] ][ÝÊB[È]Z] BQ^][[ÂÝÙ^TÙ] ][ÝÌI][ÝË ][ÝÙÛÉ][ÝÊB[ÈÛÊ BIÌÍÛOQ[SÜ[ ][ÝÑÌLÜÚÜIÌLÛXÞZÌK]LÉ][ÝË BIÌÍÞS[X[TXY[J ÌÍÛKJJBQ[PÛÜÙJ ÌÍÛJB ÌÍÞIÌÍÞÌB ÌÍÛOQ[SÜ[ ][ÝÑÌLÜÚÜIÌLÛXÞZÌK]LÉ][ÝËB[UÜ]J ÌÍÛK ÌÍÞB[PÛÜÙJ ÌÍÛJB[[ÂÂÛY L B[[ but thx for ur help anyway Edited August 17, 2007 by blublub Link to comment Share on other sites More sharing options...
martin Posted August 17, 2007 Share Posted August 17, 2007 Are you saying the code you just posted does what you want or that it doesn't do what you want? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 17, 2007 Moderators Share Posted August 17, 2007 (edited) Func _go() Local $z = Number(StringStripWS(FileReadLine("file.txt", 1), 8)) Local $add = $z + 1 FileClose(FileOpen("file.txt", 2)) FileWrite("file.txt", $add) Return 1 EndFunc Edit: Oops, forgot to erase previous content Edited August 17, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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