Page 1 of 1 1
Topic Options
#130025 - 2004-11-22 04:24 PM New function
Anonymous
Unregistered


Hello, I am French (my english is not very good) and I start to write some Kix scripts

I would know to create some new function because I didn't find a function to map some drives according to the user's group(s). The better is so I can't some ini files or data base.

Thanks to you to answer me and I'm sorry for my bad english

Snake

Top
#130026 - 2004-11-22 04:27 PM Re: New function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Well, would suggest you add the functionality of the INGROUP function and the USE statement, together it looks like this:

Code:

IF INGROUP("Domain Users")
USE M: "\\SERVER\SHARE"
ENDIF



Should give you what your looking for - try it out - if everything works, could incorporate this into a custom UDF, but get this bit working first.

-Shawn


Top
#130027 - 2004-11-22 04:29 PM Re: New function
Anonymous
Unregistered


Ok but I can't create a custom function.

How to??

Top
#130028 - 2004-11-22 04:33 PM Re: New function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
First thing you will need is that latest version of Kixtart (4.22), then just create your function somewhere in your script, like this:

Code:

FUNCTION MapDrive($Group, $Drive, $Share)
IF INGROUP($Group)
IF EXIST($Drive)
USE $Drive /DELETE
ENDIF
USE $Drive $Share
IF @ERROR
? "Error mapping drive $Drive to $Share. "+@SERROR
ENDIF
ENDIF
ENDFUNCTION



Then, just call your custom function from elsewhere in your script (like from your "mainline") ... like this:

MapDrive("Domain Users", "M:", "\\SERVER\SHARE")

-Shawn

Top
#130029 - 2004-11-22 04:36 PM Re: New function
Anonymous
Unregistered


Thanks to you for helping me.

I try your idea and I tell you teh result

still thank you

Snake059

Top
#130030 - 2004-11-22 04:41 PM Re: New function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
You welcome - what I am suggesting to you is to get this basic UDF working first (the simple map drive function). Once that works - move on to more advanced UDF using an INI based solution - just go bit at a time.

Top
#130031 - 2004-11-22 05:11 PM Re: New function
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Take a look in our UDF section as we already have a few map drive type UDFs posted there.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#130032 - 2004-11-23 02:44 AM Re: New function
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
And group-based mappings via .INI files has also already been posted.
_________________________
There are two types of vessels, submarines and targets.

Top
#130033 - 2004-12-06 10:14 AM Re: New function
Anonymous
Unregistered


Quote:

what I am suggesting to you is to get this basic UDF working first




Can you explain me what is "basic UDF" ?

Top
#130034 - 2004-12-06 11:32 AM Re: New function
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
"basic UDF"

À cet égard, Shawn parle de fonction simple, cela n'a rien à voir avec 'Basic'



Please excuse my poor french
_________________________



Top
#130035 - 2004-12-06 12:10 PM Re: New function
snake059 Offline
Lurker

Registered: 2004-12-06
Posts: 1
Loc: France, Nord, near Lille
danke gut für deine Antwort!!

entschuldigen Sie es für mein schlecht Deutsch aber zu sprechen auslanderin Sprachen

Top
#130036 - 2004-12-07 05:54 AM Re: New function
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also the FAQ Forum on what a UDF is and how to write a UDF.

See also the UDF Forum for UDFs that might alreayd do what you're looking for.

And no, I'm not going to repeat that stuff in either German or French, or even Latin
_________________________
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 1257 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.077 seconds in which 0.037 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