Jump to content

creating a 'smart' array (basics i think)


Recommended Posts

i have a folder on my desktop (haasprint) inside that folder is a random number of folders with peoples names. and each person has a PDF in their folder. all the PDFs are the same name (BC-haas.pdf) im trying to make a script that will ask me a quantity for each name, and after it has a quantity for all the names, open the PDF in their folder, print the quantity ive specified, close the card and move to the next.

i can write code for the open, print, close. but i cant get it to add the quantity for the name to an array. _arraydisplay wont display the quantities i enter. did i format something wrong here?

#Include <File.au3>
#Include <Array.au3>
 
local $folders = _FileListToArray (@desktopdir & "\haasprint")
local $printnumber
 
;_ArrayDisplay ($folders, "Class List of Active Window")
 
for $I = 1 to $folders[0]
$quantity = InputBox ("Quantity Check", "How many cards for " & $folders[$I])
_ArrayAdd ($printnumber, $quantity)
next
 
_ArrayDisplay ($printnumber, "Class list of Active Window")
msgbox (1, "none", $printnumber)
<--a good way to start you day
Link to comment
Share on other sites

$Printnumber was not declared as an array.

Try this:

#Include <File.au3>
#Include <Array.au3>
 
local $folders = _FileListToArray (@desktopdir & "\haasprint")
local $printnumber[$folders[0] + 1]
 
;_ArrayDisplay ($folders, "Class List of Active Window")
 
for $I = 1 to $folders[0]
$printnumber[$I] = InputBox ("Quantity Check", "How many cards for " & $folders[$I])
next
 
_ArrayDisplay ($printnumber, "Class list of Active Window")

Edit: These lines might make it a bit cleaner, by ensuring that FileListTo Array only returns folders, and by populating the 0 element of the PrintNumber array:

local $folders = _FileListToArray (@desktopdir & "\haasprint", "*", 2)
local $printnumber[$folders[0] + 1] =  [$folders[0]]
Edited by Spiff59
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...