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

And Again question about Progress bar

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


Joined: 25 Aug 2003
Posts: 38
Location: Sneek, The Netherlands

PostPosted: Wed Sep 10, 2003 10:55 am    Post subject: And Again question about Progress bar Reply with quote

Dear all,

First time I posted here Rod and Shanw helped me with a progessbar. Now I'm finaly done with the script but there is one thing that I still want to change.
Code:

; -----------------------------------------------------------------
; Kixtart Version: Kixtart 2001 V4.12
; Developer:       Bert Jellema, coralcat15@hotmail.com
; Company:         Superfrog Company
; -----------------------------------------------------------------

If SetConsole("HIDE") = 0
? "Console is hidden"
Else
? "Console did not hide"
EndIf

Dim $TaskList[4]
$TaskList[0] = "Removing persistent mappings ...","UnMap()",20
$TaskList[1] = "Creating Network mappings for everyone ...","Mapall()",20
$TaskList[2] = "Customizing the Startmenu ...","CustomizeStartmenu()",20
$TaskList[3] = "Customizing the Desktop ...","CustomizeDesktop()",20
$TaskList[4] = "Customizing the Screensaver ...","CustomizeScreensaver()",20

$= TaskProgressDialog($TaskList,"Login",,400)

Exit 1

; Alle Netwerk schijven wissen
Function UnMap()
Use '*' /delete /persistent
EndFunction

; Netwerk schijf aanmaken 
Function Mapall()
Use z: "\\winnt\@USERID$"
EndFunction

; --- Startmenu ---
Function CustomizeStartmenu()

; Hier worden de groepen gewist, omdat als je rechten veranderen,
; natuurlijk ook je startmenu moet veranderen
If DelProgramGroup("admin", 0) = 0
  ? "NewGroup deleted...."
EndIf
If DelProgramGroup("algemeen", 0) = 0
  ? "NewGroup deleted...."
EndIf
If DelProgramGroup("Microsoft Office 97", 0) = 0
EndIf

; De algemene user applicaties

If InGroup ("Domain Users")
If AddProgramGroup("Algemeen", 0) = 0
   ? "Newgroup has been Created...."
EndIf
EndIf

If AddProgramItem("notepad.exe", "Notepad", "", 0, "c:\",0,0) = 0
EndIf

If AddProgramItem("mspaint.exe", "Paint", "", 0, "c:\",0,0) = 0
EndIf

If AddProgramItem("calc.exe", "Rekenmachine", "", 0, "c:\",0,0) = 0
EndIf

If AddProgramItem("charmap.exe", "Character Map", "", 0, "c:\",0,0) = 0
EndIf

If AddProgramItem("c:\Program Files\Windows NT\Accessories\Wordpad.exe", "wordpad", "", 0, "c:\",0,0) = 0
EndIf

If AddProgramItem("C:\Program Files\Internet Explorer\IEXPLORE.EXE", "Internet", "", 0, "c:\",0,0) = 0
EndIf

; Als je Admin bent van het Domain
If InGroup ("Domain Admins")
If AddProgramGroup("Admin")
EndIf

If AddProgramItem("\\winnt\app$\Usrmgr.exe", "UserManager", "", 0, "c:\",0,0) = 0
EndIf
If AddProgramItem("telnet.exe", "Telnet", "", 0, "c:\",0,0) = 0
EndIf
If AddProgramItem("C:\Program Files\Radmin\radmin.exe", "Remote Administrator", "", 0, "c:\",0,0) = 0
EndIf

 ; Voor de gebruiks die office rechten hebben
If InGroup ("App office")
If AddProgramGroup("Microsoft Office 97")
   ? "Newgroup has been Created...."
EndIf
EndIf
; Voor de gebruiks die Access rechten hebben
If InGroup ("App access")
If AddProgramItem("C:\Program Files\Microsoft Office\Office\MSACCESS.EXE", "Microsoft Access", "", 0, "c:\",0,0) = 0
   ? "Added program item 'Microsoft Access' to current group..."
EndIf
EndIf
; Voor de gebruiks die Excel rechten hebben
If InGroup ("App excel") 
If AddProgramItem("C:\Program Files\Microsoft Office\Office\EXCEL.EXE", "Microsoft Excel", "", 0, "c:\",0,0) = 0
   ? "Added program item 'Microsoft Excel' to current group..."
EndIf
EndIf
; Voor de gebruiks die Powerpoint rechten hebben
If InGroup ("App powerpoint")
If AddProgramItem("C:\Program Files\Microsoft Office\Office\POWERPNT.EXE", "Microsoft PowerPoint", "", 0, "c:\",0,0) = 0
   ? "Added program item 'Microsoft Powerpoint' to current group..."
EndIf
EndIf
; Voor de gebruiks die Word rechten hebben
If InGroup ("App word")
If AddProgramItem("C:\Program Files\Microsoft Office\Office\winword.exe", "Microsoft Word", "", 0, "c:\",0,0) = 0
   ? "Added program item 'Microsoft Word' to current group..."
EndIf
EndIf

; Voor de gebruiks die Remote Administrator rechten hebben
If InGroup ("App RA")
If AddProgramGroup("Remote Administrator")
   ? "NewGroup has created...."
EndIf
EndIf
; Voor de gebruiks die Remote Administrator rechten hebben
If InGroup ("App RA")
If AddProgramItem("C:\Program Files\Radmin\radmin.exe", "Remote Administrator", "", 0, "c:\",0,0) = 0
   ? "Added program item 'Remote Administrator' to current group..."
EndIf
EndIf
EndFunction

; --- Desktop ---
Function CustomizeDesktop()
If @producttype = "windows 95" OR @producttype = "windows 98"
  GoTo win9x
EndIf
If @producttype = "windows nt workstation" OR @producttype = "Windows NT Server"
  GoTo winnt
EndIf
If @producttype = "windows xp home edition" OR @producttype = "windows xp professional" OR @producttype = "Windows XP Server" OR @producttype = "Windows XP Domain Controller" OR @producttype = "Windows 2000 Server" OR @producttype = "Windows 2000 Domain Controller" 
  GoTo winxp
EndIf

:win9x
If NOT Exist ("c:\windows\desktop\snelkoppeling.lnk")
  Copy "\\server\directory\snelkoppeling.lnk" "c:\windows\desktop\"
EndIf
GoTo endcdf

:winnt
If NOT Exist ("c:\winnt\profiles\all users\desktop\snelkoppeling.lnk")
  Copy "\\server\directory\snelkoppeling.lnk" "c:\winnt\profiles\all users\desktop"
EndIf
GoTo endcdf

:winxp
If NOT Exist ("c:\documents and settings\all users\desktop\snelkoppeling.lnk")
  Copy "\\server\directory\snelkoppeling.lnk" "c:\documents and settings\all users\desktop"
EndIf

If NOT Exist ("c:\documents and settings\all users\bureaublad\snelkoppeling.lnk")
  Copy "\\server\directory\snelkoppeling.lnk" "c:\documents and settings\all users\bureaublad"
EndIf

:endcdf
EndFunction

; --- Screensaver ---
Function CustomizeScreensaver()
;5min =300, 10min=600, 15min=900, 20min=1200, 25min=1500, 30min=1800
; Voor de gebruiks die Screensaver rechten van 15 minuten
If InGroup ("sc 15")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","900","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","c:\winnt\system32\SSPIPES.SCR","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DPipes","JointType","2","REG_SZ")
EndIf

If InGroup ("sc 30")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","1800","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","c:\winnt\system32\SSPIPES.SCR","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DPipes","JointType","2","REG_SZ")
EndIf

If InGroup ("sc 45")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","2100","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","c:\winnt\system32\SSPIPES.SCR","REG_SZ")
WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DPipes","JointType","2","REG_SZ")
EndIf
EndFunction

; Progressbar Thanks to Shawn and Rod
Function TaskProgressDialog(
$TaskList,
Optional $Title,
Optional $Width,
Optional $Height
)

Dim $Form,$Frame,$ListView,$Status,$Progress
Dim $Item,$Task,$Mask
Dim $i,$j
Dim $START,$CURRENT,$END

$START = 9
$CURRENT = 19
$END = 10

If NOT $Title
  $Title = "Operation in Progress, Please Wait..."
EndIf

If $Width < 100
  If NOT $Width
   $Width =  450
  Else
   $Width =  100
  EndIf
EndIf

If $Height < 200
  If NOT $Height
   $Height = 300
  Else
   $Height = 200
  EndIf
EndIf

$Form = CreateObject("Kixtart.Form")
$Form.Size = $Width,$Height
$Form.Text = $Title
$Form.FontSize = 10
$Form.MinButton = 0

$Frame = $Form.Frame
$Frame.Text = "Task List"
$Frame.Location = 10,5
$Frame.Right = $Form.ClientWidth - 10
$Frame.Bottom = $Form.ClientHeight - 100

$ListView = $Frame.ListView
$ListView.Location = 10,20
$ListView.Right = $Frame.ClientWidth - 10
$ListView.Bottom = $Frame.ClientHeight - 10
$ListView.GridLines = True
$ListView.HeaderStyle = 0
$ListView.ForeColor = Blue
$ListView.SmallImageList = $Form.SmallImageList

$Form.Icon = $Form.SmallImageList.Images(0)

; Build ListView columns ...

$ListView.Columns.Count = 1
$ListView.Columns(0).Text = "Task"

; Build the task list ...

For Each $Task In $TaskList
  $Item = $ListView.Items.Add($Task[0])
  $Item.ImageIndex = $START
Next

$ListView.Columns(0).Width = $ListView.ClientWidth


$Progress = $Form.ProgressBar
$Progress.Left = 20
$Progress.Top = $ListView.Bottom + 40
$Progress.Right = $Form.ClientWidth - 20
$Progress.Height = 20
;$Progress.ForeColor = Blue
$Progress.Value = 0
;$Progress.Style = 1

$Button = $Form.ToolButton
$Button.Center
$Button.Top = $Progress.Bottom + 15
$Button.Text = "Cancel"
$Button.Icon = 9
$Button.OnClick = "$$Form.Tag = 1"

$Form.Tag = 0
$Form.Center
$Form.Show

; Run the dialog ...

$i = 0
While $i <= Ubound($TaskList) AND $Form.Visible AND $Form.Tag = 0
  $ListView.Items($i).Selected = True
  $ListView.EnsureVisible($i)
  $ListView.Items($i).ImageIndex = $CURRENT
  $=Execute($TaskList[$i][1])
  $Progress.Value = $Progress.Value + Val($TaskList[$i][2])
  $ListView.Items($i).ImageIndex = $END
  $i = $i + 1
  $=Execute($Form.DoEvents(1))
Loop

$Button.Text = "Done"
$Button.Icon = 10

While $Form.Visible AND $Form.Tag = 0
  $=Execute($Form.DoEvents)
Loop

EndFunction

If the script creates a new Startmenu group, It popups. Is there a way to stop it. Because it is very anoying if you are making 4 or more groups.
Hope you can help me again please.

Many Thanks,

_________________
Greetz,
Bertje


Last edited by Bertje on Wed Sep 10, 2003 11:16 am; edited 1 time in total
Back to top
View user's profile Send private message AIM Address MSN Messenger
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Wed Sep 10, 2003 11:14 am    Post subject: Reply with quote

Hi there Bert,

it is really ANNOYING, isn't it ?
Unfortunately this behavior is kinda quirky system default behavior which is AFAIK not supressable, well at least I don't know of a way Confused

btw. you posted your script twice Sceptic

_________________
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: Thu Sep 11, 2003 9:23 pm    Post subject: Reply with quote

There is actually a way around this. Do not use ADDPORGRAMGROUP/ADDPROGRAMITEM but copy/paste/delete the folders/.LNK files instead. Create a cental repository or use the KiXtart.org UDFs for creating links.
_________________
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
Bertje
KiXforms Regular
KiXforms Regular


Joined: 25 Aug 2003
Posts: 38
Location: Sneek, The Netherlands

PostPosted: Tue Sep 16, 2003 7:42 am    Post subject: Reply with quote

Sealeopard wrote:
There is actually a way around this. Do not use ADDPORGRAMGROUP/ADDPROGRAMITEM but copy/paste/delete the folders/.LNK files instead. Create a cental repository or use the KiXtart.org UDFs for creating links.


Okay I will try that
Thanks

_________________
Greetz,
Bertje
Back to top
View user's profile Send private message AIM Address 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