Sign in to follow this  
Followers 0
jrowens27

While loop not going to the next value

2 posts in this topic

I have a while loop that is checking that is going through a text file for data entery. There are certain lines that need to be entered manually but it is a usually only a few out of the hundreds of lines. I am looping through each line and doing some validation. When I have one that needs to be skipped it seems to skip it then the next entry it tries to enter does not work correctly. It seems it pulls in null for the SSN and then a wrong number for the Ammount variable which throws everything off and we have to stop everything. Is there a problem with my logic or is this a bug in the autoit?

While $i < $num
$userInfo = StringSplit($userArray[$i], " ")
$SSN = $userInfo[$User]
$SSN = StringStripWS($SSN, 3)
$Deduct = $userInfo[0]
$Ammount = $userInfo[$Deduct]
$Ammount = StringStripWS($Ammount, 3)
; Format Ammount to include decimal
$Ammount = StringFormat("%02d", $Ammount)
$Cents = StringRight($Ammount, 2)
$Dollars = StringTrimRight($Ammount, 2)
$Ammount = $Dollars & "." & $Cents
If $SSN <> "111222" Or $SSN <> "222111" Then
Send($SSN)
Send("{Enter}Y{Enter}")
Send($Ammount)
Send("{Enter}")
Send($Ammount)
Send("{F12}")
Sleep(1000)
If WinActive("Warning") Then
Send("{Enter}")
EndIf
Sleep(2000)
EndIf
$i = $i + 1
wend

Share this post


Link to post
Share on other sites



If you want people to help you you need to provide a reproducer script. This means a self contained, stripped down version of your script that still shows your problem.

The variables you use in your example aren't set so it's impossible to test your script.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  
Followers 0