|
You last visited: Today at 11:50
Advertisement
[HELP] _FTP_ListToArrayEx Subscript used with non Array variable
Discussion on [HELP] _FTP_ListToArrayEx Subscript used with non Array variable within the AutoIt forum part of the Coders Den category.
02/29/2012, 18:09
|
#1
|
elite*gold: 35
Join Date: Apr 2011
Posts: 800
Received Thanks: 214
|
[HELP] _FTP_ListToArrayEx Subscript used with non Array variable
Ich habe das problem das bei meinem Script der Fehler : "Subscript used with non Array variable" auftaucht. Der Fehler ist angeblich auf Linie 25 aber _FTP_ListToArrayEx müsste eigentlich ein Array zurückgeben sogar bei einem Fehler und ich bin mir sicher das die Connection Stimmt.
Ich hoffe ihr könnt mir Helfen
Ja ich weis ich könnte das auch kürzer machen aber für`n Momment is es so okey also bitte unterlasst diesbezügliche Kommentare
Script:
Code:
#include-once
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.0
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <File.au3>
#include <Array.au3>
#include <FTPEx.au3>
Func _FTPDir_ListToArrayEx ($FTPSession, $Path, $Flag = 0)
Local $Dir_Paths[1], $File_Paths[1], $c = 0
$SetDir = _FTP_DirSetCurrent ($FTPSession, $Path)
$Main_DirFile_List = _FTP_ListToArrayEx ($FTPSession)
For $i = 1 To $Main_DirFile_List[0][0] Step 1
If StringInStr ($Main_DirFile_List[$i][2], "D") Then
$Dir_Paths[0] = $Dir_Paths[0]+1
_ArrayAdd ($Dir_Paths, $Path&"\"&$Main_DirFile_List[$i][0])
Else
$File_Paths[0] = $File_Paths[0]+1
_ArrayAdd ($File_Paths, $Path&"\"&$Main_DirFile_List[$i][0])
EndIf
Next
$nofDirs = DirGetSize ($Path, 1)
For $i2 = 1 To $nofDirs[2] Step 1
_FTP_DirSetCurrent ($FTPSession, $Dir_Paths[$i2])
$Temp_DirFile_List =_FTP_ListToArrayEx ($FTPSession)
If $Temp_DirFile_List <> 0 Then
For $i3 = 1 To $Temp_DirFile_List[0] Step 1
If StringInStr ($Temp_DirFile_List[$i3][2], "D") Then
$Dir_Paths[0] = $Dir_Paths[0]+1
_ArrayAdd ($Dir_Paths, $Dir_Paths[$i2]&"\"&$Temp_DirFile_List[$i3][0])
Else
$File_Paths[0] = $File_Paths[0]+1
_ArrayAdd ($File_Paths, $Dir_Paths[$i2]&"\"&$Temp_DirFile_List[$i3][0])
EndIf
Next
EndIf
Next
If $Flag = 0 Then
Return $File_Paths
ElseIf $Flag = 1 Then
Return $Dir_Paths
EndIf
EndFunc
|
|
|
02/29/2012, 21:07
|
#2
|
elite*gold: 0
Join Date: Nov 2009
Posts: 221
Received Thanks: 71
|
Schau dir mal die rückgabewerte der Funktionen an und frag auf Fehler ab
z.B. so
Code:
#include-once
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.0
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <File.au3>
#include <Array.au3>
#include <FTPEx.au3>
Func _FTPDir_ListToArrayEx ($FTPSession, $Path, $Flag = 0)
Local $Dir_Paths[1], $File_Paths[1], $c = 0
$SetDir = _FTP_DirSetCurrent ($FTPSession, $Path)
If $SetDir=0 Then Return @error
$Main_DirFile_List = _FTP_ListToArrayEx ($FTPSession)
If $Main_DirFile_List[0][0]=0 Then Return 0
For $i = 1 To $Main_DirFile_List[0][0] Step 1
If StringInStr ($Main_DirFile_List[$i][2], "D") Then
$Dir_Paths[0] = $Dir_Paths[0]+1
_ArrayAdd ($Dir_Paths, $Path&"\"&$Main_DirFile_List[$i][0])
Else
$File_Paths[0] = $File_Paths[0]+1
_ArrayAdd ($File_Paths, $Path&"\"&$Main_DirFile_List[$i][0])
EndIf
Next
$nofDirs = DirGetSize ($Path, 1)
For $i2 = 1 To $nofDirs[2] Step 1
_FTP_DirSetCurrent ($FTPSession, $Dir_Paths[$i2])
$Temp_DirFile_List =_FTP_ListToArrayEx ($FTPSession)
If $Temp_DirFile_List[0][0]=0 Then Return 0
If $Temp_DirFile_List <> 0 Then
For $i3 = 1 To $Temp_DirFile_List[0] Step 1
If StringInStr ($Temp_DirFile_List[$i3][2], "D") Then
$Dir_Paths[0] = $Dir_Paths[0]+1
_ArrayAdd ($Dir_Paths, $Dir_Paths[$i2]&"\"&$Temp_DirFile_List[$i3][0])
Else
$File_Paths[0] = $File_Paths[0]+1
_ArrayAdd ($File_Paths, $Dir_Paths[$i2]&"\"&$Temp_DirFile_List[$i3][0])
EndIf
Next
EndIf
Next
If $Flag = 0 Then
Return $File_Paths
ElseIf $Flag = 1 Then
Return $Dir_Paths
EndIf
EndFunc
denn ohne Beispiel seh ich kein Fehler
|
|
|
02/29/2012, 22:06
|
#3
|
elite*gold: 35
Join Date: Apr 2011
Posts: 800
Received Thanks: 214
|
Das prblem ist das ich wenn ich vor den fehler (For $i = 1 To $Main_DirFile_List[0][0] Step 1)
zb ne msgbox oder so mache, dann wird das übersprungen und nie eine msg box angezeigt... wenn jemand eine idee hat woran sowas liegt währe ich froh, aber wenigstens bin ich nicht der enzige ders für korrekt hält... ach ja wenn ich dem ganzen admin rechte gebe kmmt kein fehler aber das prog beendet sich selbst grrr
|
|
|
 |
Similar Threads
|
VB6 Subscript out of Range
05/20/2011 - .NET Languages - 1 Replies
Hey Leute,
fange gerade an mich bisschen mit Coden via VB6 zu beschäftigen hab auf Youtube erstmal zum anfang ein Hangman Tutorial angeguckt und bin grad dabei aber jetzt bekomm ich sobald ich Start drücke was zum debuggen:
Dim Ratewords(9) As String
Dim Rateword As String
Dim Keyword As String
Dim Letter As String
Dim lifelost As Boolean
Dim life As Integer
Dim gr As Integer
|
Cost of accessing a casted variable vs. assigning the casted variable? (C#)
01/05/2011 - CO2 Programming - 5 Replies
I know that in unmanaged C++, casting is at compile-time, so it's better to avoid the assignment and simply access it for all instances. However, in C#, I have no idea since I'm pretty new to it.
|
Überprüfen ob Variable Eine Variable ist
10/16/2010 - AutoIt - 26 Replies
Hey leute ich wollte fragen ob/wie man überprüfen kann
ob eine Variable eine Variable ist z.b. so
$k = 1
$i = $k
if $i = VARIABLE Then
msgbox(0,'$i ist eine variable!!','')
endif
PS:Wp releast man nochma TuT (z.b. für metin2??)
|
Problem error: Subscript used whit non-Array variable "
08/26/2010 - Last Chaos - 1 Replies
hey leute,
seitdem mein laptop ein windows update gemacht hat funktioniert der ultra bot nicht.
es dann kommt immer die fehlermeldung " error: Subscript used whit non-Array variable "
vor diesem update ging der bot noch.
|
beliebiege variable aus array
04/21/2010 - AutoIt - 3 Replies
hallo zusammen.
ich arbeite zur zeit an einem kleinen programm und dafür ist es nötig, dass autoit vergleicht, ob eine bestimmte variable innerhalb eines array vorhanden ist.
das array enthält zum bsp variabeln mit den werten: 1, 2 und 3.
jetzt soll überprüft werden, ob die variable a im array ist (a=1, z.B.).
das array hab ich natürlich schon erstellt (1dimensional), nur der abgleich ist knifflig. ich habs mit
if $a= $array_items Then
$score= $score+1
EndIf
|
All times are GMT +1. The time now is 11:50.
|
|