willwatters Posted August 2, 2005 Posted August 2, 2005 I run my autoit executable 2 times - 1st for a pre package drop test and 2nd for a post package drop test. I have a variable called 'post' which I want to be able to store the value 0 for the first time it is run and 1 for the second time it is run so I can use it in an error log to state what errors occurred in pre (0) and post (1) package drop tests. What is the code for this please?
Moderators SmOke_N Posted August 2, 2005 Moderators Posted August 2, 2005 (edited) Func Post() While 1 Local $post_count = 0 ; script If $post_count = 0 Then $post_count = $post_count + 1 ; script if need be ElseIf $post = 1 Then $post_count = $post_count + 1 ; script if need be ElseIf $post_count = 2 Then $pos_count = 0 ; script if need be ;maybe you want to repeat script Endif Sleep(100) Wend Using 2 to represent your "1". Hope this is what you meant. Edit: Had EndIf in wrong place Edit2: Changed Variable name, and added sleep. Edited August 2, 2005 by ronsrules 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.
Valuater Posted August 2, 2005 Posted August 2, 2005 (edited) there are many ways to accomplish this. I believe you want to "store" the info 0 or 1. here is one way to accomplish this. #include <file.au3> Dim $post Call("Drop_test") ; main program here Func Drop_test() If Not FileExists(@TempDir & "\drop.txt") Then $post = 0 _FileWriteLog(@TempDir & "\drop.txt","Pre Post") Return EndIf If FileExists(@TempDir & "\drop.txt") Then $post = 1 FileDelete(@TempDir & "\drop.txt") EndIf EndFunc I think this will do what you want 8) Edited August 2, 2005 by Valuater
willwatters Posted August 2, 2005 Author Posted August 2, 2005 there are many ways to accomplish this. I believe you want to "store" the info 0 or 1. here is one way to accomplish this.#include <file.au3> Call("Drop_test") ; main program here Func Drop_test() If Not FileExists(@TempDir & "\drop.txt") Then $post = 0 _FileWriteLog(@TempDir & "\drop.txt","Pre Post") Return EndIf If FileExists(@TempDir & "\drop.txt") Then $post = 1 FileDelete(@TempDir & "\drop.txt") EndIf EndFuncI think this will do what you want8)<{POST_SNAPBACK}>Thanks! Does #include <file.au3> have to be entered and if so why?
willwatters Posted August 2, 2005 Author Posted August 2, 2005 Thanks! Does #include <file.au3> have to be entered and if so why?
Valuater Posted August 2, 2005 Posted August 2, 2005 Thanks! Does #include <file.au3> have to be entered and if so why?<{POST_SNAPBACK}>Yes, #include <file.au3> is required to use_FileWriteLogotherwise you would need file open, write file, and file close to accomplish the same thingper help, "The text file must be opened in write mode or the FileWrite command will fail"8)
BigDaddyO Posted August 3, 2005 Posted August 3, 2005 For storing such information I always use regwrite and regread. easy, always seems to work, and no extra files accidentlly left on the system.
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