Page 1 of 1 1
Topic Options
#205830 - 2012-09-27 11:26 AM Opening multiple .kix files in multiple subdirectories
LSSJPDude Offline
Just in Town

Registered: 2012-04-19
Posts: 4
Loc: Netherlands
Hey there,

We have been trying to call or open multiple .kix files in multiple subdirectories.
we got a main file in our netlogon folder.
what we'd like to do is open .kix files (which will install the program depending on the directorie, for example, a .kix file in ccleaner) from the netlogon/apps/program folder.

but we can't seem to work it out
this the code we are using per program to install them
note, this all the code in that file

IF not exist ("C:\Program Files\kixinstall\CCleaner Installed.dum")
$NewsTextBox.Text="Bezig met het installeren van Ccleaner."
Shell ("\\$srvnaam\NETLOGON\apps\ccleaner\ccsetupSlim.exe /S /D=C:\Program files\CCleaner /L=1031")
COPY "\\$srvnaam\NETLOGON\apps\ccleaner\CCleaner Installed.dum" "C:\Program Files\kixinstall\*.*" /r /c
Endif

as for the code to call the .kix files
we have been experimenting with call and shell in the following code

call ("\\svrnaam\netlogon\apps\*\*.kix")

but all this doesn't want to work unfortunatly
so any help is appreciated


edit:
maybe a bit of a better explanation of what we are trying to do.
we want the main .kix file to look and open other .kix files in the /apps folders


Edited by LSSJPDude (2012-09-27 11:29 AM)

Top
#205832 - 2012-09-27 12:16 PM Re: Opening multiple .kix files in multiple subdirectories [Re: LSSJPDude]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
 Originally Posted By: LSSJPDude

....
as for the code to call the .kix files
we have been experimenting with call and shell in the following code

call ("\\svrnaam\netlogon\apps\*\*.kix")

but all this doesn't want to work unfortunatly
so any help is appreciated
....


The Call command ode snot work like that. It does not requires brackets and does not not take wildcards.

One way to call all .kix files from a specific folder is like this:
 Code:
$file = Dir("\\server\share\somefolder\*.kix")
While $file <> "" And @ERROR = 0
	Call "\\server\share\somefolder\" + $file
 	;Get next *.kix filename.
	$file = Dir()
Loop
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#205833 - 2012-09-27 01:52 PM Re: Opening multiple .kix files in multiple subdirectories [Re: Mart]
LSSJPDude Offline
Just in Town

Registered: 2012-04-19
Posts: 4
Loc: Netherlands
But if i get it right, that's just opening the kix files from 1 folder
i want it to look through the folders in the subdirectory to see if there is a .kix file there and then run it

for example a few paths that we use
netlogon\apps\ccleaner
netlogon\apps\notepad++
netlogon\apps\office2010

so, is that possible with that piece of code then?

Top
#205836 - 2012-09-27 03:37 PM Re: Opening multiple .kix files in multiple subdirectories [Re: LSSJPDude]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Something like this

 Code:
$folders = "folder1", "folder2", "folder3"

For Each $folder in $folders
	$file = Dir("\\server\share\" + $folder + "\*.kix")
	While $file <> "" And @ERROR = 0
		Call "\\server\share\" + $folder + "\" + $file
	 	;Get next *.kix filename.
		$file = Dir()
	Loop
Next


I would recommend to remove the ++ from notepad++ because the + is an operator in kixtart.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#205842 - 2012-09-27 08:21 PM Re: Opening multiple .kix files in multiple subdirectories [Re: Mart]
LSSJPDude Offline
Just in Town

Registered: 2012-04-19
Posts: 4
Loc: Netherlands
well removing the + shouldn't be a problem
but i'm still on about 1 thing
is it possible to let the main .kix file, find other .kix files (in the subdirectories mind you) by it's own?

for example
we don't have skype installed (just naming a program here)
and we make a new folder with the program installer, a check file and the .kix to install it.
if we place that folder in the "apps" subdirectory, we want the main .kix file pick that new installation up

Top
#205843 - 2012-09-27 08:54 PM Re: Opening multiple .kix files in multiple subdirectories [Re: LSSJPDude]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Sure it's possible, but why would you?

I hope you manage a small number of users - I would not want to be in your shoes when multiple application installs run during login for multiple users!

This also assumes that your users are local admins.. bad design.

You could create a self-service web portal pretty easily with some ASP code.. when a user clicks on "Install Skype", the back-end process drops the request into a folder where a kix script pushes the install command to the user. A bit more complex, but much more controlled and secure.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#205844 - 2012-09-27 09:32 PM Re: Opening multiple .kix files in multiple subdirectories [Re: Glenn Barnas]
Shanee Offline
Fresh Scripter

Registered: 2006-10-13
Posts: 39
Loc: Tulsa, OK
I usually use Jens DirList() UDF to enumerate files into an array. It can be found here...

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Board=7&Number=82581

Below is an example that might work for you.

 Code:
$installfiles = DirList("\\svrname\netlogon\apps\*.kix",6)

for each $installfile in $installfiles
   call ($installfile)
next

Function dirlist($dirname, optional $options)
  dim $filename, $counter, $filepath, $mask
  dim $list, $sublist, $subcounter
  $counter=-1
  $dirname=trim($dirname)
  if $dirname=''
    $dirname=@CURDIR
  endif
  if right($dirname,1)='\'
    $dirname=left($dirname,len($dirname)-1)
  endif
  if getfileattr($dirname) & 16
    $mask='*.*'
  else
    $mask=substr($dirname,instrrev($dirname,'\')+1)
    $dirname=left($dirname,len($dirname)-len($mask)-1)
  endif
  redim $list[10]
  $filename=dir($dirname+'\'+$mask)
  while $filename<>'' and @ERROR=0
    if $filename<>'.' and $filename<>'..'
      select
      case (getfileattr($dirname+'\'+$filename) & 16)
        if $options & 1
          $counter=$counter+1
          if $options & 2
            $list[$counter]=$dirname+'\'+$filename+'\'
          else
            $list[$counter]=$filename+'\'
          endif
        endif
        if ($options & 4)
          $sublist=dirlist($dirname+'\'+$filename+'\'+$mask,$options)
          if ubound($sublist)+1
            redim preserve $list[ubound($list)+ubound($sublist)+1]
            for $subcounter=0 to ubound($sublist)
              $counter=$counter+1
              if $options & 2
                $list[$counter]=$dirname+'\'+$filename+'\'+$sublist[$subcounter]
              else
                $list[$counter]=$filename+'\'+$sublist[$subcounter]
              endif
            next
          endif
        endif
      case ($options & 2)
        $counter=$counter+1
        $list[$counter]=$dirname+'\'+$filename
      case 1
        $counter=$counter+1
        $list[$counter]=$filename
      endselect
      if $counter mod 10
        redim preserve $list[$counter+10]
      endif
    endif
    $filename = dir('')
  loop
  if $counter+1
    redim preserve $list[$counter]
  else
    $list=''
  endif
  if $mask<>'*.*' and ($options & 4)
    $filename=dir($dirname+'\*.*')
    while $filename<>'' and @ERROR=0
      if $filename<>'.' and $filename<>'..'
        if (getfileattr($dirname+'\'+$filename) & 16)
          $sublist=dirlist($dirname+'\'+$filename+'\'+$mask,4)
          if ubound($sublist)+1
            redim preserve $list[ubound($list)+ubound($sublist)+1]
            for $subcounter=0 to ubound($sublist)
              $counter=$counter+1
              if $options & 2
                $list[$counter]=$dirname+'\'+$filename+'\'+$sublist[$subcounter]
              else
                $list[$counter]=$filename+'\'+$sublist[$subcounter]
              endif
            next
          endif
        endif
      endif
      $filename = dir('')
    loop
  endif
  if $counter+1
    redim preserve $list[$counter]
  else
    $list=''
  endif
  $dirlist=$list
endfunction

Top
#205845 - 2012-09-27 10:37 PM Re: Opening multiple .kix files in multiple subdirectories [Re: Shanee]
LSSJPDude Offline
Just in Town

Registered: 2012-04-19
Posts: 4
Loc: Netherlands
Well, we generally use kixtart to install all the programs needed etc. etc.
that gets done by us (only 3 of us)
so we add the clients to the domain and login (at which point the script will start running)
occasionally, not every often though, we just add the client to the domain
the script itself gets run every time a user logs in, no matter what user
that's done because sometimes we add a program, or give something an update
all in all, i think we handle about 40-50 clients per server (1 server each client)

As for the code Shanee posted
I can try that code on monday
see how it works (to be honest, i'm not that much of a kixtart proffesional)

but i kinda have the feeling that the point i'm trying to make is getting missed
i'll explain the current situation and then the situation as we would like to have it.

at the moment, we got 1 .kix file doing everything
setting up printers, installing programs etc, etc
the .kix file is in the folder Netlogon
and all the installers are in Netlogon/Apps/enter program name here

what we like to go for
is that we make a seperate .kix file for each program and put that .kix file into the same folder as that program
for example in Netlogon/Apps/Notepad
and there in would Netlogon/Apps/Notepad/Notepad.kix be

the idea is, is that .kix file in Netlogon will start calling apon all install .kix files
also, that the main .kix file is "smart" enough to take a new .kix file (for example, we added another program into the /Apps folder) by itself, without messing with the main .kix file

the purpose for this
is so that we can just copy the folder of the new program to the other servers and then be done with it, without further messing with the code

Top
#205847 - 2012-09-28 01:06 AM Re: Opening multiple .kix files in multiple subdirectories [Re: LSSJPDude]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
that's where ini-files rock.
I had similar setup but the ini-file had section for each program.
it had key for checking registry or file if installation is needed and command needed for the installation.
this way the main script just read the sections from the ini-file and looped through each and installing some dozen programs was done with some 10 lines of code and never needed to be altered. if you add a new app, just add it in the ini and it all done.
_________________________
!

download KiXnet

Top
#205856 - 2012-09-28 04:24 PM Re: Opening multiple .kix files in multiple subdirectories [Re: Lonkero]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
LLSJP, the code I posted uses the UDF called DirList to scan the directory that is specified, along with all the sub directories in that directory. It will create an array of all the *.kix files it finds in those directories. So if you specify the root of the install files ("\\svrname\netlogon\apps\*.kix") it will return an array containing the paths for all the kix files in the directory/sub directories. So unless I'm completely misunderstanding what you want, it should work just fine.
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 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.139 seconds in which 0.104 seconds were spent on a total of 13 queries. Zlib compression enabled.

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