Jump to content

Pre and Post Package drop tests


Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...