Jump to content

Recommended Posts

Posted

What does this mean when I get this error?

I run it in autoit and it works but gives the error in the console. I run it compiled it works but gives the -1 error at the end.

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Posted

hi

then the array is setup wrong

probably you try to access element eg. 20 where the array is setup to hold space for only 19 elements (for example)

Posted

Func _EMAILCONTACTWO() ;==>_Send Emails with WO and USER NAME // Manually hit send for each
    global $Address 
    $EMAILBODY = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILBODY", "INI FILE MISSING EMAILBODY")
    $EMAILSIGLN1 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN1", "INI FILE MISSING EMAILSIGLN1")
    $EMAILSIGLN2 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN2", "INI FILE MISSING EMAILSIGLN2")
    $EMAILSIGLN3 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN3", "INI FILE MISSING EMAILSIGLN3")
    $EMAILSIGLN4 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN4", "INI FILE MISSING EMAILSIGLN4")
    $EMAILSIGLN5 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN5", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN6 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN6", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN7 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN7", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN8 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN8", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN9 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN9", "INI FILE MISSING EMAILSIGLN5")
                
    $var = IniReadSection(@ScriptDir & "\" & "data.ini", "NEW-CONTACT")
    $var2 = IniReadSection(@ScriptDir & "\" & "data.ini", "NEW-WO")
 
;~ Dim $Address($var[$i][1])
;~      msgbox(4096, "", $var[$i][1])

    If @error Then
        MsgBox(4096, "", "Error occurred, probably no INI file.")
    Else
        For $i = 1 To $var[0][0] & $var2[0][0]
            _INetMail($var[$i][1], "NIS W.O. #" & $var2[$i][1], $EMAILBODY & @CRLF & @CRLF & $EMAILSIGLN1 & @CRLF & $EMAILSIGLN2 & @CRLF & $EMAILSIGLN3 & @CRLF & $EMAILSIGLN4 & @CRLF & $EMAILSIGLN5 & @CRLF & $EMAILSIGLN6 & @CRLF & $EMAILSIGLN7 & @CRLF & $EMAILSIGLN8 & @CRLF & $EMAILSIGLN9)
        Next
    EndIf

EndFunc

Thats my code my data.ini looks like this

[Setup]
LASTWO=106155
NOTESWO=This is what will be put on each work order. 
EMAILBODY=What the email will have for each one.
EMAILSIGLN1=MY-NAME-HERE
EMAILSIGLN2=MY-TITLE-HERE
EMAILSIGLN3=MY-DEPT-HERE
EMAILSIGLN4=MY-NUMBER-HERE
EMAILSIGLN5=MY-EMAIL-HERE
EMAILSIGLN6=EXTRA
EMAILSIGLN7=EXTRA
EMAILSIGLN8=EXTRA
EMAILSIGLN9=EXTRA
[NEW-WO]
WO1=122308
WO2=106330
[NEW-CONTACT]
NAME1=JIM JONES 
NAME2=JAYZ

So I am not sure why I get that error. Please help

Posted

mbkowns - this worked fine for me to open two Outlook-Word emails and write to them using your data.ini file:

#include <INet.au3>

_EMAILCONTACTWO()

Func _EMAILCONTACTWO();==>_Send Emails with WO and USER NAME // Manually hit send for each
    Global $Address
    $EMAILBODY = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILBODY", "INI FILE MISSING EMAILBODY")
    $EMAILSIGLN1 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN1", "INI FILE MISSING EMAILSIGLN1")
    $EMAILSIGLN2 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN2", "INI FILE MISSING EMAILSIGLN2")
    $EMAILSIGLN3 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN3", "INI FILE MISSING EMAILSIGLN3")
    $EMAILSIGLN4 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN4", "INI FILE MISSING EMAILSIGLN4")
    $EMAILSIGLN5 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN5", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN6 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN6", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN7 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN7", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN8 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN8", "INI FILE MISSING EMAILSIGLN5")
    $EMAILSIGLN9 = IniRead(@ScriptDir & "\" & "data.ini", "Setup", "EMAILSIGLN9", "INI FILE MISSING EMAILSIGLN5")

    $var = IniReadSection(@ScriptDir & "\" & "data.ini", "NEW-CONTACT")
    $var2 = IniReadSection(@ScriptDir & "\" & "data.ini", "NEW-WO")

; UBound($var) should equal UBound($var2) given your data.ini
    For $i = 1 To UBound($var) - 1; subtract 1 because ubound returns the number of elements
    ; in an array where the first element has a subscirpt of 0
        _INetMail($var[$i][1], "NIS W.O. #" & $var2[$i][1], $EMAILBODY & @CRLF & @CRLF _
            & $EMAILSIGLN1 & @CRLF & $EMAILSIGLN2 & @CRLF & $EMAILSIGLN3 & @CRLF _
            & $EMAILSIGLN4 & @CRLF & $EMAILSIGLN5 & @CRLF & $EMAILSIGLN6 & @CRLF _
            & $EMAILSIGLN7 & @CRLF & $EMAILSIGLN8 & @CRLF & $EMAILSIGLN9)
    Next
EndFunc  ;==>_EMAILCONTACTWO

Das Häschen benutzt Radar

Posted (edited)

mbkowns - this worked fine for me to open two Outlook-Word emails and write to them using your data.ini file:

And, :) here is a more efficient way of doing the same:

#include <INet.au3>

_EMAILCONTACTWO()

Func _EMAILCONTACTWO();==>_Send Emails with WO and USER NAME // Manually hit send for each
Const $INI_Section = "Section"
Const $INI_SigKeys = "EMAILSIGLN"
Const $INI_MaxKeys = 9
Local $i, $INI_Filename
Global $Address

  $INI_Filename = @ScriptDir & "\" & "data.ini"
  $EMAILBODY = IniRead($INI_Filename, $INI_Section, "EMAILBODY", "INI FILE MISSING EMAILBODY") & @CRLF
  For $i = 1 to $INI_MaxKeys
    $EMAILBODY = $EMAILBODY & @CRLF & IniRead($INI_Filename, $INI_Section, $INI_SigKeys & $i, "INI FILE MISSING EMAILSIGLN" & $i)
  Next $i
  $var = IniReadSection($INI_Filename, "NEW-CONTACT")
  $var2 = IniReadSection($INI_Filename, "NEW-WO")

  _INetMail($var[$i][1], "NIS W.O. #" & $var2[$i][1], $EMAILBODY)
EndFunc;==>_EMAILCONTACTWO
Edited by DaRam

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