Page 1 of 1 1
Topic Options
#19855 - 2002-04-12 07:31 AM Screen saver
Gera Offline
Getting the hang of it

Registered: 2002-02-27
Posts: 70
Loc: Israel
I try to write script for screen saver.
What I need:
1.start sc after 30 min
(not important wich sc)
2.use password.

;Screen saver script
READPROFILESTRING "SYSTEM.INI","boot","SCRNSAVE.EXE")
If @error=0
Writevalue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeout","120","reg_sz")
Writevalue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","reg_sz")
Writevalue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveUsePassword","1","reg_dword")
ELSE
WriteProfileString("c:\windows\system.ini","boot","scrnsave.exe","c:\windows\System\3D Maze.scr")
Writevalue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeout","2","reg_sz")
Writevalue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","reg_sz")
Writevalue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveUsePassword","1","reg_dword")
ENDIF

This line :
WriteProfileString("c:\windows\system.ini","boot","scrnsave.exe","c:\windows\System\3D Maze.scr")
dosn't works.

Top
#19856 - 2002-04-12 08:43 AM Re: Screen saver
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11611
Loc: CA
Kent or Les,

Maybe you can clean this up a bit and post this as an FAQ about the SYSTEM.INI file.

Gera,

Please review this post. In a nutshell you can not edit the SYSTEM.INI file as it is redirected by an API and controlled in the Registry on NT/2000/XP

READPROFILESTRING functionality - SYSTEM.INI

Or if this is your problem on a Windows 9x SYSTEM.INI there is also a problem trying to read/write to multiple entries in the BOOT section.

See this post:
Unconventional INI file... need help

[ 12 April 2002, 08:46: Message edited by: NTDOC ]

Top
#19857 - 2002-04-13 02:14 PM Re: Screen saver
Gera Offline
Getting the hang of it

Registered: 2002-02-27
Posts: 70
Loc: Israel
Hi NtDoc!
Thanks.I got it.
But what I can write for screen saver.
What do you think?

Top
#19858 - 2002-04-13 02:54 PM Re: Screen saver
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Gera,

Have a look at the following code..


 ;*************************************************************************************
 ; Set the Logon Screen Saver with a timer (15 minutes) and make it required to enter a password
 ; Kent Dyer - 2/16/00
 ;*************************************************************************************
 $hkcu = 'HKEY_CURRENT_USER'
 $hkcus = 'HKEY_CURRENT_USER\SOFTWARE'
 $poleditkey = $hkcus+"\Microsoft\Windows\CurrentVersion\Policies\System"
 $screensavekey = $hkcu+"\Control Panel\Desktop"
 $sysini = "%Windir%\System.ini"

 ; -- Hide the screensaver tab (can also be done in POLEDIT)
 $screensavetab = Readvalue($poleditkey,"NoDispScrSavPage")
 IF $screensavetab <> 1
       $systempol = EXISTKEY($poleditkey)
       IF $systempol <> 0
             $rc = ADDKEY($poleditkey)
       ENDIF
       $rc = WRITEVALUE($poleditkey,"NoDispScrSavPage","1","REG_DWORD")
 ENDIF

 ; -- Set the timeout
 IF "900" <> Readvalue($screensavekey,"ScreenSaveTimeOut")
       $rc = WRITEVALUE($screensavekey,"ScreenSaveTimeOut","900","REG_SZ")
 ENDIF
 ; -- Be sure that the screen saver is active
 IF 1 <> Readvalue($screensavekey,"ScreenSaveActive")
       $rc = WRITEVALUE($screensavekey,"ScreenSaveActive","1","REG_SZ")
 ENDIF

 IF "%OS%" = "Windows_NT"
       IF "%windir%\system32\logon.scr" <> Readvalue($screensavekey,"SCRNSAVE.EXE")
             $rc = WRITEVALUE($screensavekey,"SCRNSAVE.EXE","%windir%\system32\logon.scr","REG_SZ")
       ENDIF
 ELSE
       IF "%windir%\System\3DMaze~1.scr" <> ReadProfileString($sysini,"boot","scrnsave.exe")
             $rc = WriteProfileString($sysini,"boot","scrnsave.exe","%windir%\System\3DMaze~1.scr")
       ENDIF
 ENDIF

 IF 1 <> Readvalue($screensavekey,"ScreenSaverIsSecure")
       $rc = WRITEVALUE($screensavekey,"ScreenSaverIsSecure","1","REG_SZ")
 ENDIF
 RETURN



I will also post this in the FAQ Section.

Thanks!

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#19859 - 2002-04-14 06:28 AM Re: Screen saver
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

Each type of screen saver requires other settings in registry and some files:
- registry key: HKEY_CURRENT_USER\Control Panel\desktop
- file: c:\windows\control.ini
- file: c:\windows\system.ini
in some situations some parameters aren't available.

An example
code:
 $screen_saver="scroll~1.scr"
;
$hkcu_desktop="HKEY_CURRENT_USER\Control Panel\desktop"
SELECT
CASE ($screen_saver = "underw~2.scr")
$null=WriteValue($hkcu_desktop,"ScreenSaveTimeout","600","reg_sz")
$null=WriteValue($hkcu_desktop,"ScreenSaveActive","1","reg_sz")
$null=WriteValue($hkcu_desktop,"ScreenSaveUsePassword","0","reg_dword")
$null=WriteProfileString("c:\windows\system.ini","boot","scrnsave.exe","c:\windows\system\"+$screen_saver)
CASE ($screen_saver = "scroll~1.scr")
$null=WriteValue($khcu_desktop,"ScreenSaveTimeOut","600","REG_SZ")
$null=WriteValue($hkcu_desktop,"ScreenSaveActive","1","REG_SZ")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","Text","Busy ... ")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","Font","Times New Roman")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","Size","72")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","BackgroundColor","0 0 0")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","TextColor","255 0 0")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","Speed","18")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","Attributes","00011")
$null=WriteProfileString("c:\windows\control.ini","Screen Saver.Marquee","CharSet","0")
$null=WriteProfileString("c:\windows\system.ini","boot","scrnsave.exe","c:\windows\system\"+$screen_saver)
ENDSELECT

greetings.

btw: are the other topics
http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=1;t=004565
http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=1;t=004566
solved?
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#19860 - 2002-04-14 09:54 PM Re: Screen saver
Gera Offline
Getting the hang of it

Registered: 2002-02-27
Posts: 70
Loc: Israel
Hi!
Thanks for help.I try to edit Kdyer's script.I liked,thanks.I put some code to check if there is any sc in system.ini and make settings for it.But I have question.
I have win98,win95 machine.I have to write difirent code for each or I can make one for both.
I mean in case if nothing in system.ini.

Top
#19861 - 2002-04-15 01:27 PM Re: Screen saver
Gera Offline
Getting the hang of it

Registered: 2002-02-27
Posts: 70
Loc: Israel
Hi!
I make something with your help.

$screensavekey = "HKEY_CURRENT_USER\Control Panel\Desktop"
$sysini = "%Windir%\System.ini"
$sc = ReadProfileString($sysini, "boot", "scrnsave.exe")
IF $sc <> ""
$rc = WRITEVALUE($screensavekey,"ScreenSaveTimeOut","1800","REG_SZ")
$rc = WRITEVALUE($screensavekey,"ScreenSaveActive","1","REG_SZ")
$rc = WRITEVALUE($screensavekey,"ScreenSaveUsePassword","00000001","REG_DWORD")
$rc = WRITEVALUE($screensavekey,"ScreenSaverIsSecure","1","REG_SZ")
ELSE
copy "Z:\space.scr" "%windir%\system"
$rc = WriteProfileString($sysini,"boot","scrnsave.exe","%windir%\System\space.scr")
$rc = WRITEVALUE($screensavekey,"ScreenSaveTimeOut","1800","REG_SZ")
$rc = WRITEVALUE($screensavekey,"ScreenSaveActive","1","REG_SZ")
$rc = WRITEVALUE($screensavekey,"ScreenSaveUsePassword","00000001","REG_DWORD")
$rc = WRITEVALUE($screensavekey,"ScreenSaverIsSecure","1","REG_SZ")
ENDIF

I check on win9x station's.
It's look like it's work.I will see later.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 315 anonymous users online.
Newest Members
Praveer, Ollero, rayyo, Foxlicht, DonChild
17742 Registered Users

Generated in 0.146 seconds in which 0.123 seconds were spent on a total of 13 queries. Zlib compression enabled.

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