#185293 - 2008-02-12 07:54 PM
Re: Kix+Forms+Active Directory
[Re: duo]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Okay I just posted the updated version 1.1 of Glenn's SANITY UDF
SANITY UDF
|
Top
|
|
|
|
#185299 - 2008-02-12 11:25 PM
Re: Kix+Forms+Active Directory
[Re: Glenn Barnas]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
This just gets more interesting as we go along it seems. I didnt even think of the possibility of $drive: becoming a variable, but having difficulties with that made me change my ini file to be B:, F:, etc. Til tomorrow guys!
|
Top
|
|
|
|
#185300 - 2008-02-12 11:27 PM
Re: Kix+Forms+Active Directory
[Re: duo]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
I didn't like the idea of using A-H as drive letters for the record, B is the only one in this range I do utilize.
|
Top
|
|
|
|
#185316 - 2008-02-13 05:32 PM
Re: Kix+Forms+Active Directory
[Re: duo]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
Function CmdUserLogin_Click()
Thats going to be a no go, as i need to pass in those variables, but i think i figured it out, I need to beable to nest functions in this, thats why its breaking. Im trying to call a function from a function, that needs to be inside the original function.
How does one nest a function in kixtart? Or, what are the alternatives.
Edited by duo (2008-02-13 06:15 PM)
|
Top
|
|
|
|
#185365 - 2008-02-14 02:43 PM
Re: Kix+Forms+Active Directory
[Re: Glenn Barnas]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
Thanks for all the info on this, it didnt resolve the issues but did force me to some better standards. That said, I am abandoning this fixforms test, but still need a graphical way to prompt the user for user/pass. People ignore the cmd prompt all day and just let it sit there when it asks them for it.
|
Top
|
|
|
|
#185371 - 2008-02-14 03:42 PM
Re: Kix+Forms+Active Directory
[Re: Mart]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
I do not.
function graphical400($drive,$share,$server)
Dim $choice,$400username,$400password,$passlen,$userlen,$count
$count=0
$userlen=0
$passlen=0
if exist("$drive")
? "You already have"+$drive
else
$share=$server + $share
? "mapping $drive to $share"
$choice = MessageBox("Do you want to map "+$drive+" to "+$share+"?", "AS400 Drives", 36)
If $choice = 6 ;6=yes to question
while ($400username=@CRLF|$userlen=0)
cls
color y+/n
? "Please enter your AS400 Username"+@CRLF
color g+/n
GETS $400username
$userlen=len($400username)
loop
while ($400password=@CRLF|$passlen=0)
cls
color y+/n
? "Please enter your AS400 Password"+@CRLF
color g+/n
GETS $400password
$passlen=len($400password)
loop
Use $drive /Delete
if @ERROR <> "2250"
error_check(@ERROR,@SERROR,"failed to remove $drive drive")
endif
Use $drive $share /user:$400username /password:$400Password
error_check(@ERROR,@SERROR,"failed to map $drive drive")
endif
endfunction
|
Top
|
|
|
|
#185376 - 2008-02-14 04:30 PM
Re: Kix+Forms+Active Directory
[Re: duo]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
For anyone interested...
;Version 1.2.14.08
;
;
;Function ENUMINI() taken from Kent Dyer,Jens Meyer,Howard Bullock
;and modified for more fields and stopping double entries
BREAK OFF
$ = SetOption('Explicit', 'On')
$ = SetOption('NoMacrosInStrings', 'On')
DIM $osname,$inifile
GLOBAL $vista,$personal_loc,$desktop_loc,$start_loc,$logfilepath
$osname=left(@ProductType,10)
$vista=0
;----------------------------------------------script variables
$logfilepath="S:\logfile.txt"
$inifile="C:\Documents and Settings\duo\Desktop\newlogscript\sample.ini"
if $osname="Windows Vi"
;Vista Paths
$vista=1
$personal_loc="S:\icons\"
$desktop_loc="C:\Users\"+@USERID+"\Desktop\"
$start_loc="C:\Users\"+@USERID+"\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\"
else
;XP,2k,2k3 Paths
$personal_loc="S:\icons\"
$desktop_loc="C:\documents and settings\"+@USERID+"\desktop\"
$start_loc="C:\documents and settings\"+@USERID+"\start menu\programs\apps\"
endif
;--------------------------------------------------------
ENUMINI($inifile) ;processes the ini file and takes all specified actions
;testing stuff----stay away!----
;RUN "\\srv05wts\keyfinder\keyfinder.exe /save \\srv05wts\logs$\ /close"
;new thing testing
;if $vista=1
;$filetransfer ='robocopy "%USERPROFILE%\Documents" "S:\My Documents" /MOV /XO';endif
;else
;$filetransfer ='robocopy "%USERPROFILE%\My Documents" "S:\My Documents" /MOV /XO';endif
;endif
;Run $filetransfer
;end test
FUNCTION ENUMINI($fl)
DIM $sections,$keys,$sectionkey,$sectionentry,$rc,$resource,$commands,$desc,$function,$count
$sections=split(readprofilestring($fl,'',''),chr(10))
FOR EACH $sectionentry IN $sections
IF $sectionentry <>''
$keys=split(readprofilestring($fl,$sectionentry,''),chr(10))
FOR EACH $sectionkey IN $keys
IF $sectionkey <>''
;? 'Key "'+$sectionkey+'" = "'+readprofilestring($fl,$sectionentry,$sectionkey)+'"'
$resource=readprofilestring($fl,$sectionentry,$sectionkey)
If InStr($resource, '@USERID')
$resource = Join(Split($resource, '@USERID'), @USERID)
EndIF
IF INGROUP($sectionentry) | @hostname=$sectionentry
$commands=split('$resource',',')
$count=0
For Each $desc IN $commands
$count=$count+1
if $count=2; this is nessicary do to the fact that the For Each is running each item twice, essentially a modulus
;function=$sectionkey desc is=$commands[0] command=$commands[1]
;? $desc $sectionkey
run_functions($sectionkey,$commands[0],$commands[1], $commands[2], $commands[3])
endif
Next
ENDIF
ENDIF
NEXT
ENDIF
NEXT
ENDFUNCTION
function run_functions($function,$desc,$command,$command2,$command3)
$function=left($function,5)
Select
case $function="400dr"
;?"400drive to be mapped is " $desc ":\ from " $command2$command
graphical400($desc,$command,$command2)
case $function="drive"
;? "drive to be mapped is " $desc ":\ from " $server$command
drive_mapping($desc,$command,$command2)
case $function="print"
;? "printer to be mapped is " $desc " from " $printserver$command
printer_mapping($command2,$command)
case $function="copyf"
copy_files($personal_loc,$desktop_loc,$start_loc,$command2,$command)
? $command
case $function="regha"
;? "path is "$desc @CRLF" key is " $command " value " $command2 " type " $command3
registry_fixes($desc, $command, $command2, $command3)
case $function="runap"
;? "command 1 $command @CRLF command 2 $command2"
Run '$command2$command'
case 1
error_check(@ERROR,@SERROR,"improper function in run_functions")
Endselect
endfunction
function copy_files($personal,$desktop,$start,$server,$program)
DIM $file
$file=$server + "icons$\" + $program
if not exist ("$personal")
md "S:\icons\"
endif
if not exist ("$personal$program")
;? "need in personal drive"
COPY "$file" "$personal" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $personal")
endif
if not exist ("$desktop$program")
;? "need in desktop"
COPY "$file" "$desktop" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $desktop")
endif
if not exist ("$start")
md "C:\documents and settings\"+@USERID+"\start menu\programs\apps\"
endif
if not exist ("$start$program")
;? "need in startmenu"
COPY "$file" "$start" /c
error_check(@ERROR,@SERROR,"couldnt copy $file to $start")
endif
endfunction
function drive_mapping($drive,$share,$server)
$share='$server$share'
? "mapping "+ $drive +" to "+ $share
Use $drive /Delete
if @ERROR <> "2250"
error_check(@ERROR,@SERROR,"failed to remove $drive drive")
endif
Use $drive $share
error_check(@ERROR,@SERROR,"failed to map $drive drive")
if $drive="S"
update_logfile()
endif
endfunction
function printer_mapping($server,$printer)
If AddPrinterConnection("$server$printer")=0
? "Added $printer"
else
error_check(@ERROR,@SERROR,"couldnt add $printer from $server")
endfunction
function registry_fixes($path,$field,$value,$type)
WriteValue($path, $field, $value, $type)
error_check(@ERROR,@SERROR,"Couldnt modify $field")
endfunction
function error_check($errnum,$error,$message)
If @ERROR<>0
Open(1,$logfilepath, 5)
WriteLine(1, @DATE + " " + @TIME + " Error# $errnum $error occured, $message" + Chr(13) + Chr(10))
Close(1)
EndIf
endfunction
function update_logfile()
Open(1,$logfilepath, 5)
WriteLine(1, @CRLF + @DATE + " " + @TIME + " LogonServer=" + @LDRIVE + " Computer=" + @HOSTNAME + Chr(13) + Chr(10))
Close(1)
endfunction
function graphical400($drive,$share,$server)
Dim $choice,$400username,$400password,$passlen,$userlen,$count
$count=0
$userlen=0
$passlen=0
if exist("$drive")
? "You already have"+$drive
else
$share=$server + $share
? "mapping $drive to $share"
$choice = MessageBox("Do you want to map "+$drive+" to "+$share+"?", "AS400 Drives", 36)
If $choice = 6 ;6=yes to question
while ($400username=@CRLF|$userlen=0)
cls
color y+/n
? "Please enter your AS400 Username"+@CRLF
color g+/n
GETS $400username
$userlen=len($400username)
loop
while ($400password=@CRLF|$passlen=0)
cls
color y+/n
? "Please enter your AS400 Password"+@CRLF
color g+/n
GETS $400password
$passlen=len($400password)
loop
Use $drive /Delete
if @ERROR <> "2250"
error_check(@ERROR,@SERROR,"failed to remove $drive drive")
endif
Use $drive $share /user:$400username /password:$400Password
error_check(@ERROR,@SERROR,"failed to map $drive drive")
endif
endfunction
|
Top
|
|
|
|
#185418 - 2008-02-17 07:25 PM
Re: Kix+Forms+Active Directory
[Re: Arend_]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
True Or look for it in the registry under the key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" See FAQ: Locations of Desktop, Start Menu, etc.
|
Top
|
|
|
|
#185420 - 2008-02-18 12:27 AM
Re: Kix+Forms+Active Directory
[Re: Les]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Right Les I wanted to point to the HKEY_CURRENT_USER part of the registry
|
Top
|
|
|
|
#185435 - 2008-02-18 04:25 PM
Re: Kix+Forms+Active Directory
[Re: Les]
|
duo
Getting the hang of it
Registered: 2007-10-25
Posts: 61
Loc: iowa
|
One should NEVER hard code @UserID in a path! It's so noobish. tsk tsk
I am open to suggestions
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 898 anonymous users online.
|
|
|