Jump to content

Recommended Posts

Posted

Hey there!.
 

I'm trying to make two scripts to automate security card generator.

Script one creates the cards. For this script I need $User, $Barcode and $Cardnumber. There will always be atleast 1 card but if its more than 1 card I need to do another script that repeats the first one before it goes to the account setup progress (Script 2)

I'm guessing this is some kind of IF function i need to setup but how do i set that up so if the $Cardnumber is more than 1, it will repeat a Script B for each number above 1 with an increasing $Cardnumber value

The machine will create $User, $Barcode, and then Card 1 ($Cardnumber) as a new user. 
Then if $Cardnumber is more than 1, lets say 3, the script will create Card 2 with same $User and $Barcode and after that create Card 3 and end the script.

Posted

Hi.

welcome to  the forum!

dim $aPrintThis[4][3]=[[3], _ ; number of users in this array (data rows). Names = Collumn 0, Barcode = Collumn 1, Number of Cards requred = Collumn 2
    ["Bob","123456",1], _ ; one card for bob
    ["Jim","999999",2], _ ; two cards for jim
    ["Jane","98765",7]]   ; 7 cards for jane



$CardNr=123 ; some value to be initialiezed with the "next card number", I use 123

for $i = 1 to $aPrintThis[0][0]
    for $k = 1 to $aPrintThis[$i][2]
        PrintCard($aPrintThis[$i][0],$aPrintThis[$i][1],$CardNr)
        $CardNr+=1
    Next
Next

Func PrintCard($user,$barcode,$CardNr)
    ; do your printing
    ConsoleWrite($user & " | " & $barcode & " | " & $CardNr & @LF)
EndFunc

 

regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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