Page 2 of 2 <12
Topic Options
#37475 - 2003-03-07 03:02 AM Re: template files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
First off, please use code tags.

Take a look at line 3. ==>>$templates=enumdir($'directory')
You have a stray quote. This has been pointed out to you before. In fact you dont need any quotes on that line. Should be:
$templates=enumdir($directory)

Also, you are missing the dependent WshPipe() UDF. This too has already been pointed out to you.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#37476 - 2003-03-07 03:32 AM Re: template files
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Until you have the time or willingness to learn how to use UDFs it may be easier for you to do something like what Jens suggested above. Just change the below code to match your server and share. Can add any other files by adding them to the $a list. This should work for you aslong as you dont have more than one source or destination.

code:
 
If Ingroup ("CINEVERYONE")
$source='\\server\share\TEMPLATES\'
$destination='%appdata%\MICROSOFT\TEMPLATES\'

$a='1CN_ENVBLANK.DOT','1CN_ENVELOPE.DOT'

for each $file in $a
if not exist($destination+$file)
? "Copying "+$file
copy $source+$file $destination
else
? $file+" already exists"
endif
next
Endif



[ 07. March 2003, 03:33: Message edited by: CitrixMan ]

Top
#37477 - 2003-03-07 03:38 AM Re: template files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
or just use xcopy /d /q /y
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#37478 - 2003-03-07 04:12 AM Re: template files
howyadoing Offline
Getting the hang of it

Registered: 2002-06-01
Posts: 86
Loc: Cincinnati
I cant believe I had the typo twice. Thanks again for you help. I am new to this and want to learn. So far I us kixtart for simple but long login script but I need to learn udf stuff. Any suggestions on some detailed docs to read?
Top
#37479 - 2003-03-07 04:16 AM Re: template files
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yes, read the FAQ Forum and the KiXtart Manual. Then learn to search the Kixtart BBS as it contains a lot of valuable info.
_________________________
There are two types of vessels, submarines and targets.

Top
#37480 - 2003-03-07 04:18 AM Re: template files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I'd suggest going through the manual and the FAQ forum. The FAQ was developed by a number of the long term members of this board specifically to answer questions that are posted here repeatedly.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#37481 - 2003-03-07 05:05 AM Re: template files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
hmmm

Speaking of FAQ... Jens did mention something about an FAQ on writing UDFs. So did someone else... now who was it? Howard perhaps?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#37482 - 2003-03-07 04:07 PM Re: template files
howyadoing Offline
Getting the hang of it

Registered: 2002-06-01
Posts: 86
Loc: Cincinnati
Thanks to everyones help I got it working. I wanted to post it so that maybe it can help someone else.
code:
 $directory='\\NAS1\DFS\SOFTWARE\APPLICATIONS\TEMPLATES'
$destination='%appdata%\MICROSOFT\TEMPLATES'
$templates=enumdir($directory)
FOR EACH $file IN $templates
IF NOT Exist('$destination\$file')
COPY '$directory\$file' '$destination'
ENDIF
NEXT
FUNCTION enumdir($directory, OPTIONAL $mask, OPTIONAL $subdir)
IF $subdir $subdir='/s'
ENDIF
IF Exist("$directory")
$e=wshpipe('%comspec% /c dir "$directory\$mask" /b $subdir',1)
FOR $element = 0 TO UBound($e)
$e[$element]=Left($e[$element],Len($e[$element])-1)
NEXT
$enumdir=$e
ELSE
EXIT 1
ENDIF
ENDFUNCTION
Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $WshShell, $oExec, $AllOutput, $Exit, $WshExitCode
$WshErrorMsg=""
$WshShell=CreateObject("WScript.Shell")
$oExec=$WshShell.Exec($ShellCMD)
While $Exit<>1
Dim $Output
Select
Case Not $oExec.StdOut.AtEndOfStream
$Output=$oExec.StdOut.ReadAll
Case Not $oExec.StdErr.AtEndOfStream
$Output=$oExec.StdErr.ReadAll
$WshErrorMsg = $Output
Case 1
$Output=-1
EndSelect
If $Output=-1
If $oExec.Status=1
$Exit=1
Endif
Else
If $NoEcho<>1
? $Output
Endif
$AllOutput = $AllOutput + $Output
Endif
Loop
$WshExitCode=$oExec.ExitCode
$WshPipe=split($AllOutput,chr(10))
Exit($WshExitCode)
EndFunction


Top
Page 2 of 2 <12


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.056 seconds in which 0.025 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