Page 1 of 3 123>
Topic Options
#185185 - 2008-02-08 05:52 PM Kix+Forms+Active Directory
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
alrighty in my ini file that is processed I have the following

;sample.ini
[Domain\Drive_benefits_400]
400drivemap1=B,Benefits,\\Qs1045n5m\,

[Domain\Drive_set_400]
400drivemap1=Q,set,\\Qs1045n5m\,

 Code:
;portion of functions.kix
Function graphical400($drive,$share,$server)

if exist("$drive:\")
else
run "regsvr32 \\srv05wts\netlogon\kixforms.dll /s"


$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Caption					= "AS400 Login"
$Form.ScaleHeight				= 200
$Form.ScaleWidth				= 250
$Form.FontName					= "Arial"
$Form.FontSize					= 9

$FrameBanner 					= $Form.PictureBox
$FrameBanner.BackColor				= $Form.RGB(255,255,255)
$FrameBanner.Height 				= 70
$FrameBanner.Left				= 0
$FrameBanner.Top				= 5
$FrameBanner.Width				= 250
$FrameBanner.FontSize				= 20
$FrameBanner.FontName				= "lucida"
$FrameBanner.ForeColor				= 0
$FrameBanner.FontBold				= 1
$FrameBanner.PrintXY(70,0,"As400 Login")
$FrameBanner.FontSize				= 14
$FrameBanner.ForeColor				= $Form.RGB(0,0,0)
$FrameBanner.PrintXY(71,28,@FULLNAME)
$FrameBanner.FontBold				= 0
$FrameBanner.FontSize				= 8
$FrameBanner.ForeColor				= $Form.RGB(0,0,0)
$FrameBanner.PrintXY(71,50,"Type in your AS400 Credentials")
$FrameBanner.FontSize				= 8


; Banner Picture
$PictureBanner					= $FrameBanner.Image
$PictureBanner.Picture				= "%WINDIR%\System32\shell32.dll;18"
$PictureBanner.Height				= 60
$PictureBanner.Left				= 5
$PictureBanner.Top				= 5
$PictureBanner.Width				= 60

$TextBoxUsername				= $Form.TextBox
$TextBoxUsername.Height				= 19
$TextBoxUsername.Left				= 50
$TextBoxUsername.Top				= 85
$TextBoxUsername.Text				= username
$TextBoxUsername.Width				= 161

$TextBoxPassword				= $Form.TextBox
$TextBoxPassword.Text				= "Password"
$TextBoxPassword.Height				= 19
$TextBoxPassword.Left				= 50
$TextBoxPassword.PasswordChar 			= "*"
$TextBoxPassword.Top				= 110
$TextBoxPassword.Width				= 161

$CmdUserLogin					= $Form.CommandButton("Login")
$CmdUserLogin.Default				= 1 ; True
$CmdUserLogin.FontName				= "Arial"
$CmdUserLogin.FontSize				= 10
$CmdUserLogin.FontBold				= 1
$CmdUserLogin.Left				= 50
$CmdUserLogin.Top				= 140
$CmdUserLogin.Width				= 78
$CmdUserLogin.Height				= 19
$CmdUserLogin.OnClick				= "CmdUserLogin_Click($drive,$share,$server)"

$CmdExit	 				= $Form.CommandButton("Cancel")
$CmdExit.FontName				= "Arial"
$CmdExit.FontSize				= 10
$CmdExit.FontBold				= 1
$CmdExit.Top					= 140
$CmdExit.Width					= 80
$CmdExit.Height					= 19
$CmdExit.Left					= 133
$CmdExit.OnClick				= "quit()"

Dim $StringUsername
Dim $StringPassword

$Form.Show


$TextBoxUsername.SetFocus

While $Form.Visible
  $ = Execute($System.Application.DoEvents)
Loop

endif

EndFunction



Function CmdUserLogin_Click($drive,$share,$server)

	If $TextBoxUsername.Text = ""
		$= $Form.MsgBox("You must specify a username before clicking LOGIN.", "Invalid Username")
		$TextBoxUsername.Text = $StringUsername
		Exit Sub
	Else
		$StringUsername = $TextBoxUsername.Text
	EndIf

	If $TextBoxPassword.Text = ""
		$= $Form.MsgBox("You must specify a password before clicking LOGIN.", "Invalid Password")
		$TextBoxPassword.Text = $StringPassword
		Exit Sub
	Else
		$StringPassword = $TextBoxPassword.Text
	EndIf


	$Form.Hide




	$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 /user:$StringUsername /password:$StringPassword
		error_check(@ERROR,@SERROR,"failed to map $drive drive")




	;do your work here!
	;map400drive($StringUsername,$StringUsername)
	;$= $FORM.MsgBox("Your username is: $StringUserName Your Password is: $StringPassword", "TEST Box Return OF VALUES ENTERED")
EndFunction


So heres the fun part, it brings up the box for both, no problems there

With benefits group it even works in fact. But something is causing a bizzare error with the set group


Error in Expression Line 1 of Functions.kix

Top
#185190 - 2008-02-08 07:54 PM Re: Kix+Forms+Active Directory [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Review the Sanity output and try cleaning a few things up...

 Code:
COMPUTER - C:\temp>kgen samp
Searching for available UDFs
 2 UDFs located in 1 files.
No UDFs needed for this generation!
Generation of samp.kix is complete!


Warning: Undeclared variable.
              Variable Name: $drive:
                In function: graphical400
         Referenced on line: 5

Warning: Variable referenced inside string.
              Variable Name: $drive:
                In function: graphical400
         Referenced on line: 5
      5: if exist("$drive:\")

Warning: Undeclared variable.
              Variable Name: $System
                In function: graphical400
         Referenced on line: 10

Warning: Undeclared variable.
              Variable Name: $Form
                In function: graphical400
         Referenced on line: 12

Warning: Undeclared variable.
              Variable Name: $FrameBanner
                In function: graphical400
         Referenced on line: 19

Warning: Undeclared variable.
              Variable Name: $PictureBanner
                In function: graphical400
         Referenced on line: 41

Warning: Undeclared variable.
              Variable Name: $TextBoxUsername
                In function: graphical400
         Referenced on line: 48

Warning: Undeclared variable.
              Variable Name: $TextBoxPassword
                In function: graphical400
         Referenced on line: 55

Warning: Undeclared variable.
              Variable Name: $CmdUserLogin
                In function: graphical400
         Referenced on line: 63

Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: graphical400
         Referenced on line: 72

Warning: Variable referenced inside string.
              Variable Name: $share
                In function: graphical400
         Referenced on line: 72

Warning: Variable referenced inside string.
              Variable Name: $server
                In function: graphical400
         Referenced on line: 72
     72: $CmdUserLogin.OnClick = "CmdUserLogin_Click($Drive,$share,$server)"

Warning: Undeclared variable.
              Variable Name: $CmdExit
                In function: graphical400
         Referenced on line: 74

Warning: Undeclared variable.
              Variable Name: $
                In function: graphical400
         Referenced on line: 93

Warning: Undeclared variable.
              Variable Name: $TextBoxUsername
                In function: CmdUserLogin_Click
         Referenced on line: 104

Warning: Undeclared variable.
              Variable Name: $
                In function: CmdUserLogin_Click
         Referenced on line: 105

Warning: Undeclared variable.
              Variable Name: $Form
                In function: CmdUserLogin_Click
         Referenced on line: 105

Warning: Undeclared variable.
              Variable Name: $StringUsername
                In function: CmdUserLogin_Click
         Referenced on line: 106

Warning: Undeclared variable.
              Variable Name: $TextBoxPassword
                In function: CmdUserLogin_Click
         Referenced on line: 112

Warning: Undeclared variable.
              Variable Name: $StringPassword
                In function: CmdUserLogin_Click
         Referenced on line: 114

Warning: Variable referenced inside string.
              Variable Name: $server
                In function: CmdUserLogin_Click
         Referenced on line: 126
    126: $share="$server$share"

Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: CmdUserLogin_Click
         Referenced on line: 129
    129: ? "mapping $drive to $share"

Warning: Undeclared variable.
              Variable Name: $drive:
                In function: CmdUserLogin_Click
         Referenced on line: 130

Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: CmdUserLogin_Click
         Referenced on line: 132
    132: error_check(@ERROR,@SERROR,"failed to remove $drive drive")

Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: CmdUserLogin_Click
         Referenced on line: 136
    136: error_check(@ERROR,@SERROR,"failed to map $drive drive")
 25 warnings generated, 145 lines processed.

_________________________
Actually I am a Rocket Scientist! \:D

Top
#185191 - 2008-02-08 08:10 PM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
uh? I have to declare variables that im passing in?
Im not sure what I actually did wrong here


Edited by duo (2008-02-08 08:13 PM)

Top
#185205 - 2008-02-09 01:32 AM Re: Kix+Forms+Active Directory [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Well, you've declared no vars, placed vars in strings (although the warning on line 72 is OK, because it's a string that KF will execute). You haven't posted the entire file, so there's no way to tell where the actual error is, and the two functions you did post generated 25 warnings in a sanity check. There's no indenting of loops, commenting, identification of code sections - I could go on...

The warnings will give you an idea of how you should code when working on complex projects ("complex" being a relative term). Not counting the code you commented out, there are only two comments in the entire 145 lines. How will you understand the code next week? How do you expect others to understand your intentions.

I'm not picking on YOU, I'm making observations on code placed in the Advanced Scripting forum. These are things that advanced scripts need - it's a style you develop. Simple scripts don't need these things, but complex ones demand them. As you (and anyone else reading this) embarks on more advanced projects, you will need to develop a more formalized style and structure.

Comments - lots of them! On large projects, my Comment:Code ratio is about 55% - thats 55 lines of comments and 45 lines of code. They help you (and others) visualize the project in natural language - no coding or miscoding to interpret.

Declaration of variables - getting into using functions without declaring vars to limit their scope can have bizzare effects. You can Dim several vars on a single line, but I prefer to Dim one var per line, with a descriptive comment. If I have several temp or index pointers, I'll dim them all together, but most vars have their own declaration and written definition. No more wondering "WTF did THAT var represent???"

Code Formatting - indentation of If and Loop constructs goes a long way in readable code. So does consistent line spacing - such as
Three lines before function declarations; two lines after unique code sections; one line after every EndIf or Loop terminator so you can see where the logic sections end. Consistent indenting with spaces, not tabs - especially for code you post, where tabs make for unreasonably long lines. If a post isn't easily readable, it won't get prompt attention - just human nature.

"Empty" logic - "If X=3 Else do this EndIf" - Is something missing? Do we not want to do things when X=3? Try "negative logic" instead:
If NOT X=3
do something...
EndIf

Again, the intention is clear, nobody is left wondering if some part of code got accidentally deleted.

So - just a couple of comments to give you and all those embarking on projects that push your limits.. It's how we get better, learn, and ultimately excel. Just realize that when you go from building that treehouse to building a skyscraper, you'll need to learn and use new techniques.

You might want to take the weekend to review your code, add some of the things discussed, and post the complete package back. There are lots of us here willing to help (significantly), but "you" (anyone reading and seeking help) need to help the rest of us with good, solid information about your code and your project. We are at a disadvantage, not having sat in your chair, walked in your shoes, or (enjoyed??) a Vulcan mind-meld. \:\)

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

Top
#185206 - 2008-02-09 02:14 AM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
 Code:
run "regsvr32 \\srv05wts\netlogon\kixforms.dll /s"

This line alone is scary as it implies end-user local adminsitrator rights. Also, KiXforms should be rather distributed via GPO or other centralized method.
_________________________
There are two types of vessels, submarines and targets.

Top
#185224 - 2008-02-11 04:00 AM Re: Kix+Forms+Active Directory [Re: Sealeopard]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
This line alone is scary as it implies end-user local adminsitrator rights.

Oh i assure you its much worse than you think....

Top
#185225 - 2008-02-11 04:02 AM Re: Kix+Forms+Active Directory [Re: duo]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
 Quote:
Well, you've declared no vars, placed vars in strings (although the warning on line 72 is OK, because it's a string that KF will execute). You haven't posted the entire file, so there's no way to tell where the actual error is, and the two functions you did post generated 25 warnings in a sanity check. There's no indenting of loops, commenting, identification of code sections - I could go on...

I understand fully, Tommorow morning I am going to clean it up as best I can and post the entire thing in its terrible entirety...

Top
#185226 - 2008-02-11 04:26 AM Re: Kix+Forms+Active Directory [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
well, by then, I'm sure it will be significantly "less terrible"! \:\) We'll either guide you to the enlightened way, or beat you into submission! \:o ;\)

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

Top
#185238 - 2008-02-11 04:16 PM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
 Code:
BREAK OFF
$ = SetOption('NoMacrosInStrings', 'On')

$osname=left(@ProductType,10)
$vista=0

;-------------------------------------------------------global variables
$logfilepath="S:\logfile.txt"
$inifile="\\srv05wts\netlogon\sample.ini"

if $osname="Windows Vi"
$vista=1

;Vista Paths
$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

;--------------------------------------------------------
;version 1.1.6.9-Vista support attempt
;changes since 1.1.6.7



;call \\srv05wts\netlogon\functions.kix
;call functions.kix






RUN "\\srv05wts\keyfinder\keyfinder.exe /save \\srv05wts\logs$\ /close"



ENUMINI($inifile)










;functions.kix



FUNCTION ENUMINI($fl)
  DIM $sections,$keys,$sectionkey,$sectionentry,$rc,$resource,$commands,$desc,$function
  $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
		;maybe there is a cleaner way to do this process?
		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
			;? $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
;$server="$server+\icons$"
$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)
		if exist("$drive:\")
		;do something
		else
			run "regsvr32 \\srv05wts\netlogon\kixforms.dll /s"

			$System = CreateObject("Kixtart.System")
			$Form = $System.Form()
			$Form.Caption					= "AS400 Login"
			$Form.ScaleHeight				= 200
			$Form.ScaleWidth				= 250
			$Form.FontName					= "Arial"
			$Form.FontSize					= 9
			$FrameBanner 					= $Form.PictureBox
			$FrameBanner.BackColor			= $Form.RGB(255,255,255)
			$FrameBanner.Height 			= 70
			$FrameBanner.Left				= 0
			$FrameBanner.Top				= 5
			$FrameBanner.Width				= 250
			$FrameBanner.FontSize			= 20
			$FrameBanner.FontName			= "lucida"
			$FrameBanner.ForeColor			= 0
			$FrameBanner.FontBold			= 1
			$FrameBanner.PrintXY(70,0,"As400 Login")
			$FrameBanner.FontSize			= 14
			$FrameBanner.ForeColor			= $Form.RGB(0,0,0)
			$FrameBanner.PrintXY(71,28,@FULLNAME)
			$FrameBanner.FontBold			= 0
			$FrameBanner.FontSize			= 8
			$FrameBanner.ForeColor			= $Form.RGB(0,0,0)
			$FrameBanner.PrintXY(71,50,"Type in your AS400 Credentials")
			$FrameBanner.FontSize			= 8
			$PictureBanner					= $FrameBanner.Image
			$PictureBanner.Picture			= "%WINDIR%\System32\shell32.dll;18"
			$PictureBanner.Height			= 60
			$PictureBanner.Left				= 5
			$PictureBanner.Top				= 5
			$PictureBanner.Width			= 60
			$TextBoxUsername				= $Form.TextBox
			$TextBoxUsername.Height			= 19
			$TextBoxUsername.Left			= 50
			$TextBoxUsername.Top			= 85
			$TextBoxUsername.Text			= username
			$TextBoxUsername.Width			= 161
			$TextBoxPassword				= $Form.TextBox
			$TextBoxPassword.Text			= "Password"
			$TextBoxPassword.Height			= 19
			$TextBoxPassword.Left			= 50
			$TextBoxPassword.PasswordChar 	= "*"
			$TextBoxPassword.Top			= 110
			$TextBoxPassword.Width			= 161
			$CmdUserLogin					= $Form.CommandButton("Login")
			$CmdUserLogin.Default			= 1 ; True
			$CmdUserLogin.FontName			= "Arial"
			$CmdUserLogin.FontSize			= 10
			$CmdUserLogin.FontBold			= 1
			$CmdUserLogin.Left				= 50
			$CmdUserLogin.Top				= 140
			$CmdUserLogin.Width				= 78
			$CmdUserLogin.Height			= 19
			$CmdUserLogin.OnClick			= "CmdUserLogin_Click($drive,$share,$server)"
			$CmdExit						= $Form.CommandButton("Cancel")
			$CmdExit.FontName				= "Arial"
			$CmdExit.FontSize				= 10
			$CmdExit.FontBold				= 1
			$CmdExit.Top					= 140
			$CmdExit.Width					= 80
			$CmdExit.Height					= 19
			$CmdExit.Left					= 133
			$CmdExit.OnClick				= "quit()"

			Dim $StringUsername
			Dim $StringPassword

			$Form.Show
			$TextBoxUsername.SetFocus

			While $Form.Visible
				$ = Execute($System.Application.DoEvents)
			Loop
	endif
EndFunction



Function CmdUserLogin_Click($drive,$share,$server)
	If $TextBoxUsername.Text = ""
		$= $Form.MsgBox("You must specify a username before clicking LOGIN.", "Invalid Username")
		$TextBoxUsername.Text = $StringUsername
		Exit Sub
	Else
		$StringUsername = $TextBoxUsername.Text
	EndIf

	If $TextBoxPassword.Text = ""
		$= $Form.MsgBox("You must specify a password before clicking LOGIN.", "Invalid Password")
		$TextBoxPassword.Text = $StringPassword
		Exit Sub
	Else
		$StringPassword = $TextBoxPassword.Text
	EndIf


	$Form.Hide




	$share=$server$share

	? "variables are" $share $Stringusername $Stringpassword

	? "mapping $drive to $share"
	Use "$drive:" /Delete
		if @ERROR <> "2250"
		error_check(@ERROR,@SERROR,"failed to remove $drive drive")
		endif

	Use $drive: $share /user:$StringUsername /password:$StringPassword
		error_check(@ERROR,@SERROR,"failed to map $drive drive")




	;do your work here!
	;map400drive($StringUsername,$StringUsername)
	;$= $FORM.MsgBox("Your username is: $StringUserName Your Password is: $StringPassword", "TEST Box Return OF VALUES ENTERED")
EndFunction
;functions.kix

Maybe its not as bad as we all think(i hope)


Edited by duo (2008-02-11 05:20 PM)

Top
#185251 - 2008-02-11 08:10 PM Re: Kix+Forms+Active Directory [Re: duo]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
 Code:
		call \\srv05wts\netlogon\sanity.kix

		Dim $File 
		$File= 'main-ext.kix' 
		Del '.\report.txt' 
		Sanity($File, '.\report.txt') 



S:\>\\srv05wts\netlogon\kix32 \\srv05wts\netlogon\usesanity.kix
0 warnings generated, 10001 lines processed.

S:\>

Wth?

Top
#185262 - 2008-02-11 10:33 PM Re: Kix+Forms+Active Directory [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Try downloading the latest version of Sanity from my web site. Doc posted the UDF for me here on KORG and I can't edit it.

You might also want to do it all in a local folder instead of over the network to the netlogon share!

When I run
 Code:
Call '.\Sanity.KXF'
Sanity('yourscript.kix', 'report.txt')

I get
 Code:
          
Warning: Undeclared variable.
              Variable Name: $
                In function: Main
         Referenced on line: 2
          
Warning: Undeclared variable.
              Variable Name: $osname
                In function: Main
         Referenced on line: 4
          
Warning: Undeclared variable.
              Variable Name: $vista
                In function: Main
         Referenced on line: 5
          
Warning: Undeclared variable.
              Variable Name: $logfilepath
                In function: Main
         Referenced on line: 8
          
Warning: Undeclared variable.
              Variable Name: $inifile
                In function: Main
         Referenced on line: 9
          
Warning: Undeclared variable.
              Variable Name: $personal_loc
                In function: Main
         Referenced on line: 15
          
Warning: Undeclared variable.
              Variable Name: $desktop_loc
                In function: Main
         Referenced on line: 16
          
Warning: Undeclared variable.
              Variable Name: $start_loc
                In function: Main
         Referenced on line: 17
          
Warning: Variable referenced inside string.
              Variable Name: $
                In function: Main
         Referenced on line: 41
     41: RUN "\\srv05wts\keyfinder\keyfinder.exe /save \\srv05wts\logs$\ /close"
          
Warning: Undeclared variable.
              Variable Name: $count
                In function: ENUMINI
         Referenced on line: 75
          
Warning: Undeclared variable.
              Variable Name: $personal_loc
                In function: run_functions
         Referenced on line: 112
          
Warning: Undeclared variable.
              Variable Name: $desktop_loc
                In function: run_functions
         Referenced on line: 112
          
Warning: Undeclared variable.
              Variable Name: $start_loc
                In function: run_functions
         Referenced on line: 112
          
Warning: Variable referenced inside string.
              Variable Name: $command2
                In function: run_functions
         Referenced on line: 119
    119: RUN "$command2$command"
          
Warning: Undeclared variable.
              Variable Name: $
                In function: copy_files
         Referenced on line: 143
          
Warning: Variable referenced inside string.
              Variable Name: $
                In function: copy_files
         Referenced on line: 143
    143: $file=$server + "icons$\" + $program
          
Warning: Variable referenced inside string.
              Variable Name: $personal
                In function: copy_files
         Referenced on line: 147
    147: if not exist ("$personal$program")
          
Warning: Variable referenced inside string.
              Variable Name: $file
                In function: copy_files
         Referenced on line: 150
    150: error_check(@ERROR,@SERROR,"couldnt copy $file to $personal")
          
Warning: Variable referenced inside string.
              Variable Name: $desktop
                In function: copy_files
         Referenced on line: 152
    152: if not exist ("$desktop$program")
          
Warning: Variable referenced inside string.
              Variable Name: $file
                In function: copy_files
         Referenced on line: 155
    155: error_check(@ERROR,@SERROR,"couldnt copy $file to $desktop")
          
Warning: Variable referenced inside string.
              Variable Name: $start
                In function: copy_files
         Referenced on line: 160
    160: if not exist ("$start$program")
          
Warning: Variable referenced inside string.
              Variable Name: $file
                In function: copy_files
         Referenced on line: 163
    163: error_check(@ERROR,@SERROR,"couldnt copy $file to $start")
          
Warning: Variable referenced inside string.
              Variable Name: $server
                In function: drive_mapping
         Referenced on line: 178
    178: $share="$server$share"
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: drive_mapping
         Referenced on line: 181
    181: ? "mapping $drive to $share"
          
Warning: Undeclared variable.
              Variable Name: $drive:
                In function: drive_mapping
         Referenced on line: 182
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: drive_mapping
         Referenced on line: 184
    184: error_check(@ERROR,@SERROR,"failed to remove $drive drive")
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: drive_mapping
         Referenced on line: 188
    188: error_check(@ERROR,@SERROR,"failed to map $drive drive")
          
Warning: Variable referenced inside string.
              Variable Name: $server
                In function: printer_mapping
         Referenced on line: 205
    205: If AddPrinterConnection("$server$printer")=0
          
Warning: Variable referenced inside string.
              Variable Name: $printer
                In function: printer_mapping
         Referenced on line: 208
    208: error_check(@ERROR,@SERROR,"couldnt add $printer from $server")
          
Warning: Undeclared variable.
              Variable Name: $logfilepath
                In function: error_check
         Referenced on line: 239
          
Warning: Variable referenced inside string.
              Variable Name: $errnum
                In function: error_check
         Referenced on line: 240
          
Warning: Variable referenced inside string.
              Variable Name: $error
                In function: error_check
         Referenced on line: 240
    240: WriteLine(1, @DATE + " " + @TIME + " Error# $errnum $error occured, $message" + Chr(13) + Chr(10))
          
Warning: Undeclared variable.
              Variable Name: $logfilepath
                In function: update_logfile
         Referenced on line: 256
          
Warning: Undeclared variable.
              Variable Name: $drive:
                In function: graphical400
         Referenced on line: 266
          
Warning: Variable referenced inside string.
              Variable Name: $drive:
                In function: graphical400
         Referenced on line: 266
    266: if exist("$drive:\")
          
Warning: Undeclared variable.
              Variable Name: $System
                In function: graphical400
         Referenced on line: 271
          
Warning: Undeclared variable.
              Variable Name: $Form
                In function: graphical400
         Referenced on line: 272
          
Warning: Undeclared variable.
              Variable Name: $FrameBanner
                In function: graphical400
         Referenced on line: 278
          
Warning: Undeclared variable.
              Variable Name: $PictureBanner
                In function: graphical400
         Referenced on line: 297
          
Warning: Undeclared variable.
              Variable Name: $TextBoxUsername
                In function: graphical400
         Referenced on line: 303
          
Warning: Undeclared variable.
              Variable Name: $TextBoxPassword
                In function: graphical400
         Referenced on line: 309
          
Warning: Undeclared variable.
              Variable Name: $CmdUserLogin
                In function: graphical400
         Referenced on line: 316
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: graphical400
         Referenced on line: 325
          
Warning: Variable referenced inside string.
              Variable Name: $share
                In function: graphical400
         Referenced on line: 325
          
Warning: Variable referenced inside string.
              Variable Name: $server
                In function: graphical400
         Referenced on line: 325
    325: $CmdUserLogin.OnClick			= "CmdUserLogin_Click($drive,$share,$server)"
          
Warning: Undeclared variable.
              Variable Name: $CmdExit
                In function: graphical400
         Referenced on line: 326
          
Warning: Undeclared variable.
              Variable Name: $
                In function: graphical400
         Referenced on line: 343
          
Warning: Undeclared variable.
              Variable Name: $TextBoxUsername
                In function: CmdUserLogin_Click
         Referenced on line: 351
          
Warning: Undeclared variable.
              Variable Name: $
                In function: CmdUserLogin_Click
         Referenced on line: 352
          
Warning: Undeclared variable.
              Variable Name: $Form
                In function: CmdUserLogin_Click
         Referenced on line: 352
          
Warning: Undeclared variable.
              Variable Name: $StringUsername
                In function: CmdUserLogin_Click
         Referenced on line: 353
          
Warning: Undeclared variable.
              Variable Name: $TextBoxPassword
                In function: CmdUserLogin_Click
         Referenced on line: 359
          
Warning: Undeclared variable.
              Variable Name: $StringPassword
                In function: CmdUserLogin_Click
         Referenced on line: 361
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: CmdUserLogin_Click
         Referenced on line: 377
    377: ? "mapping $drive to $share"
          
Warning: Undeclared variable.
              Variable Name: $drive:
                In function: CmdUserLogin_Click
         Referenced on line: 378
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: CmdUserLogin_Click
         Referenced on line: 380
    380: error_check(@ERROR,@SERROR,"failed to remove $drive drive")
          
Warning: Variable referenced inside string.
              Variable Name: $drive
                In function: CmdUserLogin_Click
         Referenced on line: 384
    384: error_check(@ERROR,@SERROR,"failed to map $drive drive")
 57 warnings generated, 394 lines processed.

In the report.txt file (sanity warnings)
I also get the following :
 Code:
WARNINGS.CSV file:
Undeclared variable.,,$,Main,2
Undeclared variable.,,$osname,Main,4
Undeclared variable.,,$vista,Main,5
Undeclared variable.,,$logfilepath,Main,8
Undeclared variable.,,$inifile,Main,9
Undeclared variable.,,$personal_loc,Main,15
Undeclared variable.,,$desktop_loc,Main,16
Undeclared variable.,,$start_loc,Main,17
Variable referenced inside string.,,$,Main,41
     41: RUN "\\srv05wts\keyfinder\keyfinder.exe /save \\srv05wts\logs$\ /close",,,,
Undeclared variable.,,$count,ENUMINI,75
Undeclared variable.,,$personal_loc,run_functions,112
Undeclared variable.,,$desktop_loc,run_functions,112
Undeclared variable.,,$start_loc,run_functions,112
Variable referenced inside string.,,$command2,run_functions,119
    119: RUN "$command2$command",,,,
Undeclared variable.,,$,copy_files,143
Variable referenced inside string.,,$,copy_files,143
    143: $file=$server + "icons$\" + $program,,,,
Variable referenced inside string.,,$personal,copy_files,147
    147: if not exist ("$personal$program"),,,,
Variable referenced inside string.,,$file,copy_files,150
    150: error_check(@ERROR,@SERROR,"couldnt copy $file to $personal"),,,,
Variable referenced inside string.,,$desktop,copy_files,152
    152: if not exist ("$desktop$program"),,,,
Variable referenced inside string.,,$file,copy_files,155
    155: error_check(@ERROR,@SERROR,"couldnt copy $file to $desktop"),,,,
Variable referenced inside string.,,$start,copy_files,160
    160: if not exist ("$start$program"),,,,
Variable referenced inside string.,,$file,copy_files,163
    163: error_check(@ERROR,@SERROR,"couldnt copy $file to $start"),,,,
Variable referenced inside string.,,$server,drive_mapping,178
    178: $share="$server$share",,,,
Variable referenced inside string.,,$drive,drive_mapping,181
    181: ? "mapping $drive to $share",,,,
Undeclared variable.,,$drive:,drive_mapping,182
Variable referenced inside string.,,$drive,drive_mapping,184
    184: error_check(@ERROR,@SERROR,"failed to remove $drive drive"),,,,
Variable referenced inside string.,,$drive,drive_mapping,188
    188: error_check(@ERROR,@SERROR,"failed to map $drive drive"),,,,
Variable referenced inside string.,,$server,printer_mapping,205
    205: If AddPrinterConnection("$server$printer")=0,,,,
Variable referenced inside string.,,$printer,printer_mapping,208
    208: error_check(@ERROR,@SERROR,"couldnt add $printer from $server"),,,,
Undeclared variable.,,$logfilepath,error_check,239
Variable referenced inside string.,,$errnum,error_check,240
Variable referenced inside string.,,$error,error_check,240
    240: WriteLine(1, @DATE + " " + @TIME + " Error# $errnum $error occured, $message" + Chr(13) + Chr(10)),,,,
Undeclared variable.,,$logfilepath,update_logfile,256
Undeclared variable.,,$drive:,graphical400,266
Variable referenced inside string.,,$drive:,graphical400,266
    266: if exist("$drive:\"),,,,
Undeclared variable.,,$System,graphical400,271
Undeclared variable.,,$Form,graphical400,272
Undeclared variable.,,$FrameBanner,graphical400,278
Undeclared variable.,,$PictureBanner,graphical400,297
Undeclared variable.,,$TextBoxUsername,graphical400,303
Undeclared variable.,,$TextBoxPassword,graphical400,309
Undeclared variable.,,$CmdUserLogin,graphical400,316
Variable referenced inside string.,,$drive,graphical400,325
Variable referenced inside string.,,$share,graphical400,325
Variable referenced inside string.,,$server,graphical400,325
    325: $CmdUserLogin.OnClick			= "CmdUserLogin_Click($drive,$share,$server)",,,,
Undeclared variable.,,$CmdExit,graphical400,326
Undeclared variable.,,$,graphical400,343
Undeclared variable.,,$TextBoxUsername,CmdUserLogin_Click,351
Undeclared variable.,,$,CmdUserLogin_Click,352
Undeclared variable.,,$Form,CmdUserLogin_Click,352
Undeclared variable.,,$StringUsername,CmdUserLogin_Click,353
Undeclared variable.,,$TextBoxPassword,CmdUserLogin_Click,359
Undeclared variable.,,$StringPassword,CmdUserLogin_Click,361
Variable referenced inside string.,,$drive,CmdUserLogin_Click,377
    377: ? "mapping $drive to $share",,,,
Undeclared variable.,,$drive:,CmdUserLogin_Click,378
Variable referenced inside string.,,$drive,CmdUserLogin_Click,380
    380: error_check(@ERROR,@SERROR,"failed to remove $drive drive"),,,,
Variable referenced inside string.,,$drive,CmdUserLogin_Click,384
    384: error_check(@ERROR,@SERROR,"failed to map $drive drive"),,,,
 57 warnings generated, 394 lines processed.,,,,
Undeclared variable.,,$,Main,2
Undeclared variable.,,$osname,Main,4
Undeclared variable.,,$vista,Main,5
Undeclared variable.,,$logfilepath,Main,8
Undeclared variable.,,$inifile,Main,9
Undeclared variable.,,$personal_loc,Main,15
Undeclared variable.,,$desktop_loc,Main,16
Undeclared variable.,,$start_loc,Main,17
Variable referenced inside string.,,$,Main,41
     41: RUN "\\srv05wts\keyfinder\keyfinder.exe /save \\srv05wts\logs$\ /close",,,,
Undeclared variable.,,$count,ENUMINI,75
Undeclared variable.,,$personal_loc,run_functions,112
Undeclared variable.,,$desktop_loc,run_functions,112
Undeclared variable.,,$start_loc,run_functions,112
Variable referenced inside string.,,$command2,run_functions,119
    119: RUN "$command2$command",,,,
Undeclared variable.,,$,copy_files,143
Variable referenced inside string.,,$,copy_files,143
    143: $file=$server + "icons$\" + $program,,,,
Variable referenced inside string.,,$personal,copy_files,147
    147: if not exist ("$personal$program"),,,,
Variable referenced inside string.,,$file,copy_files,150
    150: error_check(@ERROR,@SERROR,"couldnt copy $file to $personal"),,,,
Variable referenced inside string.,,$desktop,copy_files,152
    152: if not exist ("$desktop$program"),,,,
Variable referenced inside string.,,$file,copy_files,155
    155: error_check(@ERROR,@SERROR,"couldnt copy $file to $desktop"),,,,
Variable referenced inside string.,,$start,copy_files,160
    160: if not exist ("$start$program"),,,,
Variable referenced inside string.,,$file,copy_files,163
    163: error_check(@ERROR,@SERROR,"couldnt copy $file to $start"),,,,
Variable referenced inside string.,,$server,drive_mapping,178
    178: $share="$server$share",,,,
Variable referenced inside string.,,$drive,drive_mapping,181
    181: ? "mapping $drive to $share",,,,
Undeclared variable.,,$drive:,drive_mapping,182
Variable referenced inside string.,,$drive,drive_mapping,184
    184: error_check(@ERROR,@SERROR,"failed to remove $drive drive"),,,,
Variable referenced inside string.,,$drive,drive_mapping,188
    188: error_check(@ERROR,@SERROR,"failed to map $drive drive"),,,,
Variable referenced inside string.,,$server,printer_mapping,205
    205: If AddPrinterConnection("$server$printer")=0,,,,
Variable referenced inside string.,,$printer,printer_mapping,208
    208: error_check(@ERROR,@SERROR,"couldnt add $printer from $server"),,,,
Undeclared variable.,,$logfilepath,error_check,239
Variable referenced inside string.,,$errnum,error_check,240
Variable referenced inside string.,,$error,error_check,240
    240: WriteLine(1, @DATE + " " + @TIME + " Error# $errnum $error occured, $message" + Chr(13) + Chr(10)),,,,
Undeclared variable.,,$logfilepath,update_logfile,256
Undeclared variable.,,$drive:,graphical400,266
Variable referenced inside string.,,$drive:,graphical400,266
    266: if exist("$drive:\"),,,,
Undeclared variable.,,$System,graphical400,271
Undeclared variable.,,$Form,graphical400,272
Undeclared variable.,,$FrameBanner,graphical400,278
Undeclared variable.,,$PictureBanner,graphical400,297
Undeclared variable.,,$TextBoxUsername,graphical400,303
Undeclared variable.,,$TextBoxPassword,graphical400,309
Undeclared variable.,,$CmdUserLogin,graphical400,316
Variable referenced inside string.,,$drive,graphical400,325
Variable referenced inside string.,,$share,graphical400,325
Variable referenced inside string.,,$server,graphical400,325
    325: $CmdUserLogin.OnClick			= "CmdUserLogin_Click($drive,$share,$server)",,,,
Undeclared variable.,,$CmdExit,graphical400,326
Undeclared variable.,,$,graphical400,343
Undeclared variable.,,$TextBoxUsername,CmdUserLogin_Click,351
Undeclared variable.,,$,CmdUserLogin_Click,352
Undeclared variable.,,$Form,CmdUserLogin_Click,352
Undeclared variable.,,$StringUsername,CmdUserLogin_Click,353
Undeclared variable.,,$TextBoxPassword,CmdUserLogin_Click,359
Undeclared variable.,,$StringPassword,CmdUserLogin_Click,361
Variable referenced inside string.,,$drive,CmdUserLogin_Click,377
    377: ? "mapping $drive to $share",,,,
Undeclared variable.,,$drive:,CmdUserLogin_Click,378
Variable referenced inside string.,,$drive,CmdUserLogin_Click,380
    380: error_check(@ERROR,@SERROR,"failed to remove $drive drive"),,,,
Variable referenced inside string.,,$drive,CmdUserLogin_Click,384
    384: error_check(@ERROR,@SERROR,"failed to map $drive drive"),,,,
 57 warnings generated, 394 lines processed.,,,,

=========================

VarInfo.INI file:
[ENUMINI]
DefinedOnLine=60
$ENUMINI=1,60
$fl=2,60
$sections=2,61
$keys=2,61
$sectionkey=2,61
$sectionentry=2,61
$rc=2,61
$resource=2,61
$commands=2,61
$desc=2,61
$function=2,61
$count=2,75
[run_functions]
DefinedOnLine=97
$run_functions=1,97
$function=2,97
$desc=2,97
$command=2,97
$command2=2,97
$command3=2,97
$personal_loc=0,112
$desktop_loc=0,112
$start_loc=0,112
[copy_files]
DefinedOnLine=140
$copy_files=1,140
$personal=2,140
$desktop=2,140
$start=2,140
$server=2,140
$program=2,140
$file=2,141
$=0,143
[drive_mapping]
DefinedOnLine=177
$drive_mapping=1,177
$drive=2,177
$share=2,177
$server=2,177
$drive:=2,182
[printer_mapping]
DefinedOnLine=204
$printer_mapping=1,204
$server=2,204
$printer=2,204
[registry_fixes]
DefinedOnLine=217
$registry_fixes=1,217
$path=2,217
$field=2,217
$value=2,217
$type=2,217
[error_check]
DefinedOnLine=237
$error_check=1,237
$errnum=2,237
$error=2,237
$message=2,237
$logfilepath=0,239
[update_logfile]
DefinedOnLine=255
$update_logfile=1,255
$logfilepath=0,256
[graphical400]
DefinedOnLine=265
$graphical400=1,265
$drive=2,265
$share=2,265
$server=2,265
$StringUsername=2,336
$StringPassword=2,337
$drive:=0,266
$System=2,271
$Form=2,272
$FrameBanner=2,278
$PictureBanner=2,297
$TextBoxUsername=2,303
$TextBoxPassword=2,309
$CmdUserLogin=2,316
$CmdExit=2,326
$=0,343
[CmdUserLogin_Click]
DefinedOnLine=350
$CmdUserLogin_Click=1,350
$drive=2,350
$share=2,350
$server=2,350
$TextBoxUsername=2,351
$=2,352
$Form=2,352
$StringUsername=2,353
$TextBoxPassword=2,359
$StringPassword=2,361
$drive:=2,378
[Main]
$=2,2
$osname=2,4
$vista=2,5
$logfilepath=0,8
$inifile=2,9
$personal_loc=2,15
$desktop_loc=2,16
$start_loc=2,17

These extra files are in a format easily read by a program, and give you critical information about the functions and the variables used in those functions, in addition to the warnings.

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

Top
#185267 - 2008-02-11 11:16 PM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This one (it's in there several times)

 Quote:

....
Variable referenced inside string.,,$,Main,41
41: RUN "\\srv05wts\keyfinder\keyfinder.exe /save \\srv05wts\logs$\ /close",,,,
....


is actually not really true. It's a hidden share and not a variable. This might be a difficult one to get Sanity to skip and not report as an error or not best practice.


Edited by Mart (2008-02-11 11:16 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#185269 - 2008-02-11 11:19 PM Re: Kix+Forms+Active Directory [Re: Mart]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
If this keyfinder app is what I think it is (getting all kinds of serials) then it could possible be replaced with one or more UDF's depending on what serials/installation keys it is retrieving just to be less dependant on external apps.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#185271 - 2008-02-12 12:33 AM Re: Kix+Forms+Active Directory [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Agreed - I mentioned this in Duo's earlier post - that Sanity would warn about this in KF references as well. That's why Sanity refers to them as "warnings" and not "errors". It can't tell when it's a Kix var, or a reference such as this, since it doesn't actually execute the code. The point is for you to decide that it's valid (or not).

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

Top
#185275 - 2008-02-12 12:58 AM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well I would update it for you but the one on your site does not meet the HEADER criteria of at least DATE and VERSION, maybe other but I didn't look that close.

Please update the code on your site if you like Glenn and I'll update the UDF here on Korg.

Thanks

Top
#185281 - 2008-02-12 04:17 AM Re: Kix+Forms+Active Directory [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
OK - should be good to go!

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

Top
#185288 - 2008-02-12 05:21 PM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
[redacted]

Edited by duo (2008-02-12 06:02 PM)

Top
#185290 - 2008-02-12 07:20 PM Re: Kix+Forms+Active Directory [Re: duo]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
I am working on cleaning up these warnings, question
 Code:
function copy_files($personal,$desktop,$start,$server,$program)
DIM $file
;$server="$server+\icons$"
$file=$server + "icons$\" + $program
	if not exist ("$personal")


I get the warning that $personal is not declared here. What do i need to do to declare it?

Top
#185291 - 2008-02-12 07:37 PM Re: Kix+Forms+Active Directory [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
That's odd - "Personal" is declared implicitly in the function definition.

Also, try
 Code:
	if not exist($personal)

The "(" should immediatly follow the function name (not strictly required in Kix, but is in most other languages), and the $Personal should not be inside quotes.

Another concern is the "Icons$\" - I know it's a hidden share name, but kix could interpret it unless you set the NoVarsInStrings option.
 Code:
$ = SetOption('NoVarsInStrings', 'On')

This tells kix to ignore the presense of "$" inside quoted strings.

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

Top
#185292 - 2008-02-12 07:42 PM Re: Kix+Forms+Active Directory [Re: Glenn Barnas]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
That gets us to an interesting point Glen, check out this line
 Code:
Use $drive: $share /user:$StringUsername /password:$StringPassword

There is definantly something wrong with this line. What is the proper syntax for this line with novarsinstrings on?


also what is the difference between $=novars in strings or $variable name=no vars in strings?


Final comment, This is where everything gets frustrating
 Code:
$System = CreateObject("Kixtart.System")

$Form = $System.Form()
$Form.Caption					= "AS400 Login"
$Form.ScaleHeight				= 200
$Form.ScaleWidth				= 250
$Form.FontName					= "Arial"
$Form.FontSize					= 9

$FrameBanner 					= $Form.PictureBox
$FrameBanner.BackColor				= $Form.RGB(255,255,255)
$FrameBanner.Height 				= 70
$FrameBanner.Left				= 0
$FrameBanner.Top				= 5
$FrameBanner.Width				= 250
$FrameBanner.FontSize				= 20
$FrameBanner.FontName				= "lucida"
$FrameBanner.ForeColor				= 0
$FrameBanner.FontBold				= 1
$FrameBanner.PrintXY(70,0,"As400 Login")
$FrameBanner.FontSize				= 14
$FrameBanner.ForeColor				= $Form.RGB(0,0,0)
$FrameBanner.PrintXY(71,28,"@FULLNAME")
$FrameBanner.FontBold				= 0
$FrameBanner.FontSize				= 8
$FrameBanner.ForeColor				= $Form.RGB(0,0,0)
$FrameBanner.PrintXY(71,50,"Type in your AS400 Credentials")
$FrameBanner.FontSize				= 8


; Banner Picture
$PictureBanner					= $FrameBanner.Image
$PictureBanner.Picture				= "%WINDIR%\System32\shell32.dll;18"
$PictureBanner.Height				= 60
$PictureBanner.Left				= 5
$PictureBanner.Top				= 5
$PictureBanner.Width				= 60

$TextBoxUsername				= $Form.TextBox
$TextBoxUsername.Height				= 19
$TextBoxUsername.Left				= 50
$TextBoxUsername.Top				= 85
$TextBoxUsername.Text				= username
$TextBoxUsername.Width				= 161

$TextBoxPassword				= $Form.TextBox
$TextBoxPassword.Text				= "Password"
$TextBoxPassword.Height				= 19
$TextBoxPassword.Left				= 50
$TextBoxPassword.PasswordChar 			= "*"
$TextBoxPassword.Top				= 110
$TextBoxPassword.Width				= 161

$CmdUserLogin					= $Form.CommandButton("Login")
$CmdUserLogin.Default				= 1 ; True
$CmdUserLogin.FontName				= "Arial"
$CmdUserLogin.FontSize				= 10
$CmdUserLogin.FontBold				= 1
$CmdUserLogin.Left				= 50
$CmdUserLogin.Top				= 140
$CmdUserLogin.Width				= 78
$CmdUserLogin.Height				= 19
$CmdUserLogin.OnClick				= "CmdUserLogin_Click()"

$CmdExit	 				= $Form.CommandButton("Cancel")
$CmdExit.FontName				= "Arial"
$CmdExit.FontSize				= 10
$CmdExit.FontBold				= 1
$CmdExit.Top					= 140
$CmdExit.Width					= 80
$CmdExit.Height					= 19
$CmdExit.Left					= 133
$CmdExit.OnClick				= "quit()"

Dim $StringUsername
Dim $StringPassword


$Form.Show
$TextBoxUsername.SetFocus

While $Form.Visible
  $ = Execute($System.Application.DoEvents)
Loop




Function CmdUserLogin_Click()

	If $TextBoxUsername.Text = ""
		$= $Form.MsgBox("You must specify a username before clicking LOGIN.", "Invalid Username")
		$TextBoxUsername.Text = $StringUsername
		Exit Sub
	Else
		$StringUsername = $TextBoxUsername.Text
	EndIf

	If $TextBoxPassword.Text = ""
		$= $Form.MsgBox("You must specify a password before clicking LOGIN.", "Invalid Password")
		$TextBoxPassword.Text = $StringPassword
		Exit Sub
	Else
		$StringPassword = $TextBoxPassword.Text
	EndIf


	$Form.Hide

	$drive="B"
	$server="\\Qs1045n5m\"
	$share="Benefits"

	$share='$server$share'

	;? "variables are" $share $Stringusername $Stringpassword

	? "mapping $drive to $share"
	Use "$drive:" /Delete
	Use "$drive:" $share /user:$StringUsername /password:$StringPassword
	
	


	EndFunction


This works,and there is no real difference between this, or how its executed from the login script. It collects the user/pass and maps the drive...so why does this work with one of the drives through login script, but not both, when this works with both.


Edited by duo (2008-02-12 08:18 PM)

Top
Page 1 of 3 123>


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

Who's Online
0 registered and 539 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.077 seconds in which 0.025 seconds were spent on a total of 14 queries. Zlib compression enabled.

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