#39576 - 2003-04-28 03:50 PM
reload a kixscript
|
guenti
Fresh Scripter
Registered: 2000-09-29
Posts: 26
Loc: Switzerland
|
is there a way to reload a kix-script? in my script i map some networkdrives and some netprinters and after this i start a userform to show all connections. all this is in the header of the script (no functions). the user can take some changes and press an update-button to change the connections. the easyest way to make the changes is to reload the kix.script. i try it with ----quit ----Shell "kix32.exe login.kix" but the "old userform is still in the backgruond..
is there a way to do this?
thanks guenti
|
|
Top
|
|
|
|
#39579 - 2003-04-28 04:37 PM
Re: reload a kixscript
|
guenti
Fresh Scripter
Registered: 2000-09-29
Posts: 26
Loc: Switzerland
|
so this is my code...sorry i have an update-button to reload the script because it is possible to change the content of the $Studprintfile by using the printer button if the user needs other printers.... special lines in script are marked with some ####
code:
SetConsole("hide")
;******************************************************************** ;Systemvariablen ;******************************************************************** ########################from here i need to reload ;IP Adress Server $ipserver = "10.13.48.16" ;IP Adress Printserver $ipprintserver = "10.13.48.21" ;Anzahl Drucker $anzahlprinter = 30 ;Anzahl Druckerverbindungen $anzahlprinterconnection=0 ;Name des Standartdruckers $defprintername=" " ;Pfad für delprinter.txt Datei $delprintfile = "\\" + $ipserver + "\netlogon\delprinter.txt" ;Pfad für Studentenprinter.txt Datei $Studprintfile = "\\" + $ipserver + "\netlogon\studentenprinter.txt"
If (InGroup ("AngestellteM") OR InGroup("AngestellteLABOR")) $benutzer="Angestellte_M$$" EndIf If (InGroup ("StudentenM")) $benutzer="Studenten_M$$" EndIf If (InGroup ("StudentenC")) $benutzer="Studenten_C$$" EndIf
;Pfad für Printer.txt Datei $Printfile ="\\" + $ipserver + "\" + $benutzer + "\" + "@userid" + "\admin\printer.txt" ;Use x: "\\" + $ipserver + "\angestellte_m$$"
;******************************************************************** ;Kontrolle ob der PDC-Server vorhanden ist ;******************************************************************** If Exist ("\\" + $ipserver + "\netlogon\exist.txt") ;MessageBox("Alles i.O","",0) Else MessageBox (" Achtung der Hauptserver ist ausgefallen, Bitte speichern Sie ihre Daten nur auf der Festplatte C:\.Daten welche auf dem Server gespeichert werden, gehen verlohren.", "---> Error auf dem Hauptserver <---",048) EndIf
;******************************************************************** ;Löschen aller Druckerverbindungen ;******************************************************************** Shell "con2prt.exe /f"
;******************************************************************** ;Verbinden der Drucker ;********************************************************************
If InGroup ("Studenten") MessageBox("Student"," ",0) ;Alle Drucker für die Studenten ;MessageBox ($studprintfile,"test",0) Open (1,$Studprintfile,3) For $i = 1 to $anzahlprinter $x=ReadLine(1) $verbinden=SubStr($x,Len($x)-2,1) If $verbinden = 1 $printername=SubStr($x,1,Len($x)-4) ;MessageBox ("\\" + $ipprintserver + "\" + $printername,"tt",0) If AddPrinterConnection ("\\" + $ipprintserver + "\" + $printername) = 0 ? "Added printer connection" ;$defaultprinter=Right($x,1) ; MessageBox ($defaultprinter,"defaultprinter",36) ; If $defaultprinter = 1 ; $defprinter = Left($printername,Len($printername)-1) ; If SetDefaultPrinter ("\\" + $ipprintserver + "\" + $defprinter) = 0 ; ? "Defaultprinter set" ; EndIf ; EndIf EndIf Else EndIf Next Close (1) ;******************************************* ;Standartdruckerzuweisung für Schulungsräume ;******************************************* ;Schulungsraum S15 If InStr(@WKSTA,"bmasc2") $defprinter="Laserjet_5000_s15" If SetDefaultPrinter ("\\" + $ipprintserver + "\" + $defprinter) = 0 ? "Defaultprinter set" EndIf EndIf ;Schulungsraum S16 If InStr(@WKSTA,"bmasc3") $defprinter="Laserjet_5000_s15" If SetDefaultPrinter ("\\" + $ipprintserver + "\" + $defprinter) = 0 ? "Defaultprinter set" EndIf EndIf ;Schulungsraum S17 If InStr(@WKSTA,"bmasc4") $defprinter="Colorjet_4500sw_s17" If SetDefaultPrinter ("\\" + $ipprintserver + "\" + $defprinter) = 0 ? "Defaultprinter set" EndIf EndIf
EndIf
;******************************************************************** ;Löschen der Netzlaufwerke ;********************************************************************
;Löscht das Publiclaufwerk Use p: /delete
;Löscht das Industrielaufwerkes Use i: /delete
;Löscht das CAD-Laufwerk Use l: /delete
;Löscht das Daten_M-Laufwerk Use m: /delete
;Löscht das Komischen-Laufwerk Use z: /delete ;Löscht das persönliche Laufwerk Use u: /delete
; MessageBox ("169", "", 0)
;******************************************************************** ;Verbinden der Netzlaufwerke ;********************************************************************
;Verbindet das Publiclaufwerk If (InGroup ("AngestellteM") OR InGroup("AngestellteLABOR")) Use p: "\\" + $ipserver + "\public$$" Else Use p: "\\" + $ipserver + "\public$$\studenten_m" EndIf
;Verbinden des Industrielaufwerkes If (InGroup ("Angestellte")) Use i: "\\" + $ipserver + "\industrie$$" EndIf
;Verbinden vom CAD-Laufwerk If (InGroup ("AngestellteCAD")) Use l: "\\cads1001\daten_cad$$" EndIf
;Verbinden vom Daten_M-Laufwerk If (InGroup ("AngestellteLABOR") OR InGroup("AngestellteM")) Use m: "\\" + $ipserver + "\daten_m$$" EndIf
;Verbinden vom Komischen-Laufwerk If (InGroup ("Komisches")) Use z: "\\cads1001\spielwiese$$" EndIf
If Exist("\\" + $ipserver + "\" + $benutzer + "\" + "@userid" + "\admin\info.exe") Else Shell "cmd /c mkdir \\MASS1001\$benutzer\%username%\admin" Shell "cmd /c copy \\MASS1001\netlogon\chemie\admin\info.exe \\MASS1001\$benutzer\%username%\admin" Shell "cmd /c echo y| cacls \\MASS1001\$benutzer\%username% /g %username%:c" EndIf
;Shell "cmd /c copy \\MASS1001\netlogon\ideas_ms9\mplot.set d:\mquest2000\custom\mplot2k"
Use u: "\\" + $ipserver + "\" + $benutzer + "\" + "@userid" ##########################to here Break On ;************************************************** ;Layoutvorlage ;**************************************************
$Form = CreateObject("Kixtart.Form") $xform=400 $yform=400 $Form.Show $Form.Caption = "Loginscript CAD-Zentrum" $Form.Width = $xform $Form.Height = $yform $Form.Center $Form.Backcolor = 82,136,191 $Form.Show $form.forecolor = 255,255,255 $form.drawwidth = 3 ;Vertikale Linien $form.line (80,8,80,70) $form.line (80,89,80,$yform-35) ;Horizontale Linien $form.line (8,80,70,80) $form.line (90,80,$xform-16,80) $form.circle (80,80,10)
$Image = $form.Image("\\" + $ipserver + "\netlogon\industrie_blau.bmp",82,7) $Image.Fontsize =0 $Image.Border = 0 $Image.show $Form.Show $Image1 = $form.Image("\\" + $ipserver + "\netlogon\it.bmp",68,$yform-110 ) $Image1.Fontsize =0 $Image1.Border = 0 $Image1.show $Form.Show
$fraDetails = $FORM.Frame("User-Info") $fraDetails.FontSize = 14 $fraDetails.HEIGHT = $yform-195 $fraDetails.Left = 90 $fraDetails.TOP = 85 $fraDetails.WIDTH = $xform-105 $Form.Show
$cbupdate=$form.commandbutton("Update",$xform-95-200,$yform-80,80) $cbprint = $form.commandbutton("Printer",$xform-95-100,$yform-80,80) ;$cbgo.enabled=0 $cbende=$form.commandbutton("Quit",$xform-95,$yform-80,80)
$cbprint.onclick = "drucken"
$cbupdate.onclick = "progstart" ################ my update-button
$cbende.onclick = "filebeenden" ;
$xtab=100 $Tab=160 $Form.FontSize = 11 $Form.ForeColor = 0,0,0; Black $Form.PrintXY($xtab,120, "Benutzername:") $Form.PrintXY($xtab+$tab,120, @userid ) $Form.PrintXY($xtab,140, "Vollständiger Name:") $Form.PrintXY($xtab+$tab,140, @fullname ) $Form.PrintXY($xtab,160, "Loginserver:") $Form.PrintXY($xtab+$tab,160, @lserver ) $Form.PrintXY($xtab,180, "Computername:") $Form.PrintXY($xtab+$tab,180, @wksta ) $Form.PrintXY($xtab,200, "Passwortalter (Tage):") $Form.PrintXY($xtab+$tab,200, @pwage ) $Form.PrintXY($xtab,220, "Anzahl Netzwerkdrucker:") $Form.PrintXY($xtab+$tab,220, $anzahlprinterconnection) $Form.PrintXY($xtab,240, "Standarddrucker:") $Form.PrintXY($tab,260, $defprintername )
;**************************************************
$Form.Show While $Form.Visible $=Execute($Form.DoEvents()) Loop
Exit 1
Function progstart ###############here is my problem ??????? EndFunction
Function drucken Shell "\\10.1.48.16\netlogon\wkix32.exe \\10.1.48.16\netlogon\printer.kix" ; Quit EndFunction
Function filebeenden Quit EndFunction
|
|
Top
|
|
|
|
#39581 - 2003-04-29 08:09 AM
Re: reload a kixscript
|
guenti
Fresh Scripter
Registered: 2000-09-29
Posts: 26
Loc: Switzerland
|
hello its not so easy with a simply goto. i try it but i think the problem is goto from a function. here a small version with goto and a function it doesn't run: code:
:start $x=MessageBox ("it runs", "update" ,52) If $x = 6 test Else Quit EndIf
Function test Goto "start" endfunction
this way it runs without any problems code:
:start $end = "start" $x=MessageBox ("hallo", "velo" ,52) If $x = 6 Goto "start" Else Quit EndIf
and i think there should be an other way without goto (i don't like it, it is to basic ;o) ) but if it runs with a function then i will take it ;o) thanks guenti
|
|
Top
|
|
|
|
#39583 - 2003-04-29 08:51 AM
Re: reload a kixscript
|
guenti
Fresh Scripter
Registered: 2000-09-29
Posts: 26
Loc: Switzerland
|
this code doesn't run. error on line 17; label not found...
guenti
|
|
Top
|
|
|
|
#39586 - 2003-04-29 01:41 PM
Re: reload a kixscript
|
guenti
Fresh Scripter
Registered: 2000-09-29
Posts: 26
Loc: Switzerland
|
hey again ;o) so now i find a solution for my first problem without goto..... i put all about printers in a function and it runs not bad ;o) but no my userform shows not the actual text... here a small prog: code:
$Form = CreateObject("Kixtart.Form") $form.visible = 0 $xform=400 $yform=400 $Form.Show $Form.Caption = "Loginscript CAD-Zentrum" $Form.Width = $xform $Form.Height = $yform $Form.Center $Form.Backcolor = 82,136,191 $Form.Show $form.forecolor = 255,255,255 $form.drawwidth = 3 ;Vertikale Linien $form.line (80,8,80,70) $form.line (80,89,80,$yform-35) ;Horizontale Linien $form.line (8,80,70,80) $form.line (90,80,$xform-16,80) $form.circle (80,80,10)
;$cbgo.enabled=0 $cbende=$form.commandbutton("test",$xform-95,$yform-80,80) $cbende.onclick = "test"
$xtab=100 $Tab=160 $Form.FontSize = 11 $Form.ForeColor = 0,0,0; Black $Form.PrintXY($xtab,120, "Benutzername:") $Form.PrintXY($xtab+$tab,120, @userid ) $Form.PrintXY($xtab,140, "Vollständiger Name:") $Form.PrintXY($xtab+$tab,140, @fullname ) $Form.PrintXY($xtab,160, "Loginserver:") $Form.PrintXY($xtab+$tab,160, @lserver ) $Form.PrintXY($xtab,180, "Computername:") $Form.PrintXY($xtab+$tab,180, @wksta ) $Form.PrintXY($xtab,200, "Passwortalter (Tage):") $Form.PrintXY($xtab+$tab,200, @pwage ) $Form.PrintXY($xtab,220, "Anzahl Netzwerkdrucker:") $Form.PrintXY($xtab+$tab,220, $anzahlprinterconnection) $Form.PrintXY($xtab,240, "Standarddrucker:") $Form.PrintXY($tab,260, $defprintername ) ;************************************************** While $Form.Visible $=Execute($Form.DoEvents()) Loop Exit 1
Function test $anzahlprinterconnection = 1 $defprintername = "Testprinter" EndFunction
if i click on the button then set the two variables, after that i want to show the changed text in my userform... any idea
guenti
|
|
Top
|
|
|
|
#39588 - 2003-04-29 03:28 PM
Re: reload a kixscript
|
Sealeopard
KiX Master
   
Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
|
First of all, it would be better to use the LABEL object instead of the PRINTXY object, as it results in a cleaner KiXForms setup.
Secondly, once you've got the labels set up, you just assign a new text to the label and it will be reflected.
Thirdly, I would create the form first, then process the other tasks, and provide feedback to some kind of update label object.
Lastly, don't use GOTO's anywhere, they're just trouble.
_________________________
There are two types of vessels, submarines and targets.
|
|
Top
|
|
|
|
#39589 - 2003-04-29 03:32 PM
Re: reload a kixscript
|
guenti
Fresh Scripter
Registered: 2000-09-29
Posts: 26
Loc: Switzerland
|
hey, cool
i change printxy with label's and now everything works graet thanks for your help
guenti
i've got more special questions, but later
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2870 anonymous users online.
|
|
|