Jump to content

Recommended Posts

Posted

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
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
×
×
  • Create New...