Jump to content
Sign in to follow this  
RogerRabbitsClone

i think i want a multidimensional array. not sure how.

Recommended Posts

RogerRabbitsClone

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.

im having trouble getting the quantity ($quantity) and the folders ($folders) to become column 1 & 2 in my 3rd array ($printoutput).

so when i run my second FOR loop, i want it to open the folder then reference the quantity (either $quantity or $printoutput) and send it to the # of copies box in the acrobat print window. but thats not what its doing. does this even look remotely close to what i need to do that?

#Include <File.au3>
#Include <Array.au3>
local $folders = _FileListToArray (@desktopdir & "\haasprint")
local $printinput[$folders[0] + 1]
local $printout[2][3]=[[$folders[0] + 1], [$printinput[0] + 1]]
local $quantity
;2nd local declarations
;local $folders = _FileListToArray (@desktopdir & "\haasprint", "*", 2)
;local $printnumber[$folders[0] + 1] =  [$folders[0]]
for $I = 1 to $folders[0]
$quantity = InputBox ("Quantity Check", "How many cards for " & $folders[$I])
_ArrayAdd ($printinput, $quantity)
next
for $s = 1 to $folders[0]
  ShellExecute (@desktopdir & "\haasprint\" & $folders[$s] & "\BC - HAAS.pdf")
  WinWaitActive ("[CLASS:AcrobatSDIWindow]")
  send ("{ctrldown}")
  send ("p")
  send ("{ctrlup}")
  WinWaitActive ("Print")
  send ("{altdown}")
  send ("c")
  send ("{altup}")
 
next
_ArrayDisplay ($folders, "Class List of Active Window FOLDERS")
_ArrayDisplay ($printinput, "Class List of Active Window PRINTINPUT")
_ArrayDisplay ($printout, "Class List of Active Window PRINT")
_ArrayDisplay ($quantity, "Class List of Active Window QUANTITY")
Edited by RogerRabbitsClone

<--a good way to start you day

Share this post


Link to post
Share on other sites
martin

Maybe a bit like this

; Author: RogerRabbitsClone
; Topic Title: i think i want a multidimensional array. not sure how. - AutoIt Forums. Don't see why - martin
; Post URL: http://www.autoitscript.com/forum/topic/133277-i-think-i-want-a-multidimensional-array-not-sure-how/page__view__findpost__p__928800

#include <File.au3>
#include <Array.au3>
ConsoleWrite(@DesktopDir & @CRLF)
Local $folders = _FileListToArray(@DesktopDir & "\VAT recovery", "*", 2);haasprint
Local $printinput[$folders[0] + 1]
;local $printout[2][3]=[[$folders[0] + 1], [$printinput[0] + 1]]
;local $quantity
;2nd local declarations
;local $folders = _FileListToArray (@desktopdir & "\haasprint", "*", 2)
;local $printnumber[$folders[0] + 1] =  [$folders[0]]
For $I = 1 To $folders[0]
    $printinput[$I] = InputBox("Quantity Check", "How many cards for" & @CRLF & '"' & $folders[$I] & '"')
Next

For $s = 1 To $folders[0]
    ShellExecute(@DesktopDir & "\haasprint\" & $folders[$s] & "\BC - HAAS.pdf")
    WinWaitActive("[CLASS:AcrobatSDIWindow]")
    Send("^p")
    WinWaitActive("Print")
    Sleep(500);I usualy find a delay is needed in certain places like this ....
    Send("!c")
    Sleep(500);  ....... and this
    Send($printinput[$s])
    Send("{ENTER}")
Next

_ArrayDisplay($folders, "Class List of Active Window FOLDERS")
_ArrayDisplay($printinput, "Class List of Active Window PRINTINPUT")

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
RogerRabbitsClone

.......martin......thank you!!!!!!!!!!!!!!!!!!!!!!!!!

we have to print 100-200 of these business cards a day. all different quantities. ive automated most of the process for creation already, but the actual printing had been a pain.

also, if you (or anybody) have an extra minute, im still trying to wrap my head around reading this. ive added some comments. again THANK YOU for your help.

#include <File.au3>
#include <Array.au3>
ConsoleWrite(@DesktopDir & @CRLF)
Local $folders = _FileListToArray(@DesktopDir & "\haasprint\", "*", 2);$folders is equal to all the folders in "haasprint"
Local $printinput[$folders[0] + 1] ;not quite sure what this does
For $I = 1 To $folders[0] ;create variable $I, its value will be 1 to the end of $folders array
    $printinput[$I] = InputBox("Quantity Check", "How many cards for" & @CRLF & '"' & $folders[$I] & '"')
;ABOVE /\ associate the elements in $folders with the elements in $printinput
Next
For $s = 1 To $folders[0];create variable $s, its value will be 1 to the end of $folders array
;are these single letter variables ($s and $I) only good in the loop in which they are used?
    ShellExecute(@DesktopDir & "\haasprint\" & $folders[$s] & "\BC - HAAS.pdf");open all the folders in the array $folders
    WinWaitActive("[CLASS:AcrobatSDIWindow]")
    Send("^p")
    WinWaitActive("Print")
    Sleep(200);I usualy find a delay is needed in certain places like this ....
    Send("!c")
    Send($printinput[$s]); send the values from $printinput, in the same order you are opening the values from $folders
    ;add haas print V1.3 here
Next
;add haasprint V1.5 here

<--a good way to start you day

Share this post


Link to post
Share on other sites
martin

Local $printinput[$folders[0] + 1]; create an array with enough elements to hold the print quantities for each pdf.

Loop variables should only be used in the loop. If you need the value of the loop variable outside of the loop then use another variable to hold that value like this.

Local $lastloop = 0
 
for $n = 1 to 6
 if disaster() then
   $lastloop = $n
   exitloop
 endif
next
 
if $lastloop <> 0 then ConsoleWrite("Disaster at count " & $lastloop & @CRLF)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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  

×