Jump to content
Sign in to follow this  
willwatters

Pre and Post Package drop tests

Recommended Posts

willwatters

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?

Share this post


Link to post
Share on other sites
SmOke_N

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 :whistle:

Edit2: Changed Variable name, and added sleep.

Edited 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.

Share this post


Link to post
Share on other sites
Valuater

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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
willwatters

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
EndFunc

I think this will do what you want

8)

<{POST_SNAPBACK}>

Thanks! Does #include <file.au3> have to be entered and if so why?

Share this post


Link to post
Share on other sites
willwatters

Thanks! Does #include <file.au3> have to be entered and if so why?

Share this post


Link to post
Share on other sites
Valuater

Thanks! Does #include <file.au3> have to be entered and if so why?

<{POST_SNAPBACK}>

Yes,

#include <file.au3> is required to use

_FileWriteLog

otherwise you would need file open, write file, and file close to accomplish the same thing

per help,

"The text file must be opened in write mode or the FileWrite command will fail"

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
BigDaddyO

For storing such information I always use regwrite and regread. easy, always seems to work, and no extra files accidentlly left on the system.


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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.