KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Error in script

 
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic
View previous topic :: View next topic  
Author Message
dasiguer
KiXforms Follower
KiXforms Follower


Joined: 10 Sep 2003
Posts: 15
Location: Rio de Janeiro, Brazil

PostPosted: Fri Nov 07, 2003 12:40 pm    Post subject: Error in script Reply with quote

Where work we use one script for each user, starting with two If...Else, one for identification of the user and another one for identification of the operational system.
Let us say that if it forgets one definitive one to caracter, as for example, quotations marks (").
That, when any user effects logon, exactly that the error is not in script of this user, is generated an error in one determined line of script and the form of the KiX is only generated when this line is corrected, this for any user.
It has some form to decide this problem, or either, exactly that it has an error in script and only the line that is missed only disables logon or the appearance of the form of the KiX for the user where the error is located? I say, when the user to effect logon, all do not verify script, of this the first user until the last one.


Code:
if @userid="user"
   if @producttype="Windows 98" or @producttype="Windows xp professional"

Break On Cls      ;- Remove CLS if using WKIX32
$nul=SetConsole("Hide")   ;- Hide console when script is done

;==============================================================
;= Instala automaticamente a Biblioteca necessaria para o KIX.=
;==============================================================

select
case @producttype="Windows 98"
 shell "c:\windows\system\regsvr32 /s \\Dell_Server\KiXtart\DLL\kixforms.dll"
case @producttype="Windows xp professional"
 shell "c:\windows\system32\regsvr32 /s \\Dell_Server\KiXtart\DLL\kixforms.dll"
endselect


shell "net time \\DELL_SERVER /set /y"

;============
;= Saudacao =
;============
$Hour = SubStr("@TIME",1,2)
Select
Case Val("$Hour") < 12
  $Saudacao = "Bom Dia"
Case Val("$Hour") > 18
  $Saudacao = "Boa Noite"
Case 1
  $Saudacao = "Boa Tarde"
EndSelect

;==========================
;= Declaracao das Funcoes =
;==========================

$FuncToExecute=Split("userA,userB,userC,userD,userE",",")

;======================
;= Formulario do Menu =
;======================
$frmMain       = CreateObject("Kixtart.Form")
$frmMain.Size    = 370,280
$frmMain.Center
$frmMain.Text    = "Script de Logon da Rede - Depto. Inform?tica"
$frmMain.SysMenu   = 0      ; Desabilita as op??es Minimizar,Maximizar,Fechar

select
case @producttype="Windows 98"
 $frmMain.Picture = \\DELL_SERVER\KiXtart\Logo\logowin98.bmp
case @producttype="Windows xp professional"
 $frmMain.Picture = \\DELL_SERVER\KiXtart\Logo\logowinxp.bmp
endselect

;================================
;= Mostrando a Data e o Relogio =
;================================

$lblDay             = $frmMain.Label("@DAY, @MDAYNO @MONTH @YEAR",180,13,175,15)
$lblDay.Alignment  = 1
$lblDay.Borderstyle = 0

;======================
;= Saudacao e Usuario =
;======================

$lblFName                = $frmMain.Label("$Saudacao  @FULLNAME!",5,35,350,25)
$lblFName.ForeColor    = $frmMain.RGB(0,0,128)
$lblFName.Alignment  = 2
$lblFName.FontSize    = 12.5
$lblFName.FontBold    = 1
$lblFName.BorderStyle = 0

$lblAdvNut                = $frmMain.Label("TEXT",3,60,356,25)
$lblAdvNut.ForeColor    = $frmMain.RGB(0,0,0)
$lblAdvNut.Alignment  = 2
$lblAdvNut.FontSize    = 10.5
$lblAdvNut.FontBold    = 1
$lblAdvNut.BorderStyle = 0

;==========================
;= Informacoes do Usuario =
;==========================
$fraUser       = $frmMain.Frame
$fraUser.Size    = 350,90
$fraUser.Text    = "Informa??es do usu?rio:"
$fraUser.Alignment    = 2
$fraUser.Center
$fraUser.FontBold   = 0
$fraUser.FontSize   = 8

$lblUserID    = $fraUser.Label("Usu?rio:",10,12,80,20)
$lblUserID.Alignment    = 0
$lblUserID.FontBold    = 0
$lblUserID.FontSize    = 10
$lblUserID.ForeColor   = $frmMain.RGB(0,0,0)

$lblUserID2    = $fraUser.label(LCase(@USERID),95,12,185,20)
$lblUserID2.Alignment = 0
$lblUserID2.FontBold    = 0
$lblUserID2.FontSize    = 10
$lblUserID2.ForeColor   = $frmMain.RGB(0,0,128)

$lblNetComp    = $fraUser.Label("Computador:",10,30,80,20)
$lblNetComp.Alignment = 0
$lblNetComp.FontBold = 0
$lblNetComp.FontSize = 10
$lblNetComp.ForeColor = $frmMain.RGB(0,0,0)

$lblNetComp2    = $fraUser.label(LCase(@WKSTA),95,30,185,20)
$lblNetComp2.Alignment = 0
$lblNetComp2.FontBold = 0
$lblNetComp2.FontSize = 10
$lblNetComp2.ForeColor = $frmMain.RGB(0,0,128)

$lblLServer    = $fraUser.Label("Servidor:",10,48,80,20)
$lblLServer.Alignment = 0
$lblLServer.FontBold    = 0
$lblLServer.FontSize    = 10
$lblLServer.ForeColor   = $frmMain.RGB(0,0,0)

$lblLServer2    = $fraUser.label(LCase(@LSERVER),95,48,185,20)
$lblLServer2.Alignment = 0
$lblLServer2.FontBold = 0
$lblLServer2.FontSize = 10
$lblLServer2.ForeColor = $frmMain.RGB(0,0,128)

$lblLDom       = $fraUser.Label("Dom?nio:",10,66,80,20)
$lblLDom.Alignment    = 0
$lblLDom.FontBold    = 0
$lblLDom.FontSize    = 10
$lblLDom.ForeColor   = $frmMain.RGB(0,0,0)

$lblLDom2    = $fraUser.Label(LCase(@DOMAIN),95,66,185,20)
$lblLDom2.Alignment    = 0
$lblLDom2.FontBold    = 0
$lblLDom2.FontSize    = 10
$lblLDom2.ForeColor   = $frmMain.RGB(0,0,128)

;==================================
;= Status do Logon e Progress Bar =
;==================================
$fraStatus       = $frmMain.Frame
$fraStatus.FontBold   = 0
$fraStatus.FontSize   = 8
$fraStatus.Alignment    = 2
$fraStatus.Size    = 350,70
$fraStatus.Center
$fraStatus.Top    = $fraUser.Bottom + 5
$fraStatus.Text    = "Aguarde enquanto o script de logon est? sendo executado!"

$lblStatus       = $fraStatus.Label("Processando logonscript...",10,20,260,20)

$prgStatus    = $fraStatus.ProgressBar
$prgStatus.Size    = 330,20
$prgStatus.Center
$prgStatus.Top    = $lblStatus.Bottom

;=================================================
;= Status da Funcao e Formulario do Progress Bar =
;=================================================
$frmFuncStatus    = CreateObject("Kixtart.Form")
$frmFuncStatus.Size    = 300,80
$frmFuncStatus.Center
$frmFuncStatus.Top    = $frmFuncStatus.Top + ($frmMain.Height/2)+50
$frmFuncStatus.SysMenu = 0      ; Desabilita as op??es Minimizar,Maximizar,Fechar
$frmFuncStatus.Text    = "Processando script de rede..."

$lblFuncStatus    = $frmFuncStatus.Label("Processando script de rede...")
$lblFuncStatus.Size    = 280,20
$lblFuncStatus.Center
$lblFuncStatus.Top    = 5

$prgFuncStatus    = $frmFuncStatus.ProgressBar
$prgFuncStatus.Size    = 280,20
$prgFuncStatus.Center
$prgFuncStatus.Top    = $lblFuncStatus.Bottom

;==================================
;= Script de Execucao das Funcoes =
;==================================
$frmMain.Show

$prgStatus.Max = Ubound($FuncToExecute)+1
For Each $sFunction in $FuncToExecute
   $prgStatus.Value = $prgStatus.Value+1
   $nul = Execute($sFunction)
   Sleep 1
Next

Exit()

$lblStatus.FontBold   = 0
$lblStatus.FontSize   = 8

;======================
;= Script das Funcoes =
;======================
Function userA()
   $lblStatus.Text = "Definindo Papel de Parede Padr?o..."

   SCRIPT

   Sleep 1
EndFunction

Function userB()
   $lblStatus.Text = "Sincronizando o rel?gio com o Servidor..."
   shell "net time \\DELL_SERVER /set /y"
   sleep 0.5
EndFunction

Function userC()
   $lblStatus.Text = "Mapeando os drives da rede..."

   $sNetDrives=Split("H,I,J,L,M,N,S",",")

   $frmFuncStatus.Text = "Mapeando os drives da rede..."
   $prgFuncStatus.Max = Ubound($sNetDrives)+1
   $prgFuncStatus.Value = ""
   $frmFuncStatus.Show
   Sleep 0.25
   For Each $sDrive in $sNetDrives
      $prgFuncStatus.Value = $prgFuncStatus.Value + 1
      $lblFuncStatus.Text = "Mapeando $sDrive:\"
      Sleep 0.5
   Next
   $frmFuncStatus.Hide
   Exit()
EndFunction

Function userD()
   $lblStatus.Text = "Aplicando diretivas no registro..."
   shell "regedit /s \\dell_server\KiXtart\registryfiles\driveicons.reg"
   shell "regedit /s \\dell_server\KiXtart\registryfiles\windowtitle_ie.reg"
   shell "regedit /s \\dell_server\KiXtart\registryfiles\Propriedades_do_Video_Ativa.reg"
   shell "delpaper.bat"
   Sleep 0.5
EndFunction

Function userE()
   $lblStatus.Text = "Script de logon executado com sucesso!"
   Sleep 1
EndFunction

  endif
endif


Are you also script can indicate me a more easy way for the identification in mine, or either, each user possesss a different mapping of drives, but all remaining of script the user is equal for almost all, less for me and the general administrator.
It stows thinking about using instead of two IF as in script, only one and in the mapping of drives, to define a variable using the If...Else for each user with its script of mapping drives and to use CASE it, verifying the users and selecting your variables.

It will be that this could all diminish the size of mine script?
________
Ford focus rs history


Last edited by dasiguer on Tue Feb 15, 2011 12:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Fri Nov 07, 2003 3:23 pm    Post subject: Reply with quote

I have to admit that I have a really hard time to actually understand what you wrote or asking for.

Anyway, your script sytax is messed up as you have functions inside the actual script. Functions should be either at the very top or the very bottom of a script but not within script code itself.

You realize, that your script requires local admin privileges to run correctly?

You can use INGROUP to differentiate between different user groups.

_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Fri Nov 07, 2003 3:46 pm    Post subject: Reply with quote

... and there are no endifs for the first 2 ifs Confused
_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Fri Nov 07, 2003 4:00 pm    Post subject: Reply with quote

Actually, therer are. They are at the very end of the script, thus the function/endfunction blocks are actually inside the IF construcst.
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
dasiguer
KiXforms Follower
KiXforms Follower


Joined: 10 Sep 2003
Posts: 15
Location: Rio de Janeiro, Brazil

PostPosted: Fri Nov 07, 2003 4:24 pm    Post subject: Reply with quote

Perhaps the translation is not helping.

I have translated of the Portuguese for the English for the Altavista because I do not know total English, but am learning not to pass for difficulties.

Sealeopard, its translation also is a little complicated for me.

We use this script in a computer with Win2000 Server and all the stations of work with Win98 and two with WinXPPro.

And already was preparing the reply when you it wrote first on the Endifs.

Thanks!
________
Honda Cbx1000 History


Last edited by dasiguer on Tue Feb 15, 2011 12:46 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Fri Nov 07, 2003 4:45 pm    Post subject: Reply with quote

Now that explains the strange sentences, hmm, translated from Protugese to English
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group