Page 1 of 1 1
Topic Options
#153465 - 2005-12-15 12:03 PM Using arrays in the Copy function
J4zen Offline
Fresh Scripter

Registered: 2005-12-09
Posts: 12
Im trying to create a script to copy heaps of files at once to different directories.
I came up with the following script ( im a newb when it comes to KIX )

Code:

for $i=0 to $Amount_of_Files

$Current = $i
$Current = ReadProfileString("Config.ini","Bestanden",$i)
$File_Array = Split($Current,",")

if Copy($File_Array(0),$File_Array(1)) = 0
? "Bestand gekopieerd:"+$File_Array(0)+" naar "+$File_Array(1)+"."
else
? "Fout opgetreden bij het kopieren van "+$File_Array(0)+" naar "+$File_Array(1)+"."
$Error_Count = $Error_Count+1
if Open( 3 , @LDRIVE + "\LOG.TXT" , 5 ) = 0
? "Logbestand gecreërd op:" +@LDRIVE+ "\Log.txt"
$x = WriteLine( 3 , "Script gestart op " +@DATE+ "om " + @TIME + @CRLF )
$x = WriteLine( 3 , "----------------------------" + @CRLF)
$x = WriteLine( 3 , "Fout bij kopieren van bestand: " + $File_Array(0) + " naar "+ $File_Array(1)+"."+ @CRLF
$NoErr = 0
Close(3)
else
BEEP
? "Er kon geen logbestand aangemaakt worden."
$NoErr = 1
endif
endif

$i=$i+1

next $i



The part that errors for me ( so far. theres more, without a doubt ) is the copy function.

Code:

if Copy($File_Array(0),$File_Array(1)) = 0



does kixscript support using arrays in this function or is there something else going on with this script?

Thanks!
-Jeroen

Top
#153466 - 2005-12-15 12:33 PM Re: Using arrays in the Copy function
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
try
Copy $File_Array[0] $File_Array[1]
if @error
....
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153467 - 2005-12-15 01:08 PM Re: Using arrays in the Copy function
J4zen Offline
Fresh Scripter

Registered: 2005-12-09
Posts: 12
Will do, thanks!
Top
#153468 - 2005-12-16 09:40 AM Re: Using arrays in the Copy function
J4zen Offline
Fresh Scripter

Registered: 2005-12-09
Posts: 12
Found the problem, i assumed Kix would search for the ini script automaticly in its own directory when simply passing the parameter "ReadProfileString("config.ini","bla","bla").

Wasn't aware that you would have to specify the full path to the ini file using @Scriptdir.

Thanks for the reply!

Top
#153469 - 2005-12-16 02:18 PM Re: Using arrays in the Copy function
PaulG Offline
Lurker

Registered: 2005-12-02
Posts: 3
Use of ReadProfileString with an INI-file without an path the function will look in %SYSTEMROOT% (eg. C:\WINDOWS)
Top
#153470 - 2005-12-20 03:47 AM Re: Using arrays in the Copy function
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And that is even documented in the KiXtart Manual.
_________________________
There are two types of vessels, submarines and targets.

Top
#153471 - 2005-12-21 09:26 AM Re: Using arrays in the Copy function
J4zen Offline
Fresh Scripter

Registered: 2005-12-09
Posts: 12
Quote:

And that is even documented in the KiXtart Manual.




which is why i discovered the problem myself

Top
#153472 - 2005-12-31 03:45 PM Re: Using arrays in the Copy function
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You created a problem.

Hope you discovered the solution yourself
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 987 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.059 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org