Jump to content

Recommended Posts

Posted

I need to create simple software. It copies data from one programm, analyze it and inserts numbers to specified cells.      I know how to copy. 

 

Find data >= 1000 and < 5 000 000

Analyze and place data:

if value < 10 000, then place data  “1”,

if value => 10 000 and < 15 000, then place data  “2”,

if value => 15 000 and < 22 000, then place data  “3”,

if value => 22 000 and < 33 000, then place data  “4”,

 

Values “” should not be less than previous. For example, if previous value was 11 000, current value 8000, place “2” not  “1”.

Posted

Hi.

What have you scripted so far? The comparing part could be something like this:

#include <Array.au3>

; generate some test values
Local $aInputArray[20]
For $i = 0 To UBound($aInputArray) -1
    $aInputArray[$i] = Random(1, 35000, 1) ; smaller and bigger then searched for
Next
; show inputs
_ArrayDisplay($aInputArray, "Inputs", "", 0, Default, "Inputs")

Local $aOutputArray = $aInputArray ; first column should show inputs
_ArrayColInsert($aOutputArray, 1) ; add a second column to include the output values

Local $iPreviousOutput, $iOutput
For $iInput = 0 To UBound($aInputArray) -1
    Switch $aInputArray[$iInput]
        Case 1000 To 9999
            $iOutput = 1
        Case 10000 To 14999
            $iOutput = 2
        Case 15000 To 21999
            $iOutput = 3
        Case 22000 To 32999
            $iOutput = 4
        Case Else
            $iOutput = ""
    EndSwitch
    If IsNumber($iPreviousOutput) And $iPreviousOutput > $iOutput Then $iOutput = $iPreviousOutput
    If $iOutput > 0 And $iOutput < 5 Then $iPreviousOutput = $iOutput
    If $aInputArray[$iInput] > 9999 And $aInputArray[$iInput] < 33000 Then $aOutputArray[$iInput][1] = $iOutput
Next

; show outputs
_ArrayDisplay($aOutputArray, "In- and Outputs", "", 0, Default, "Inputs|Outputs")

Simpel

SciTE4AutoIt = 3.7.3.0   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win_10   Build = 19044   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE     H:\...\AutoIt3      H:\...\AutoIt3\Include     (H:\ = Network Drive)

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

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
  • Recently Browsing   0 members

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