Page 1 of 2 12>
Topic Options
#126669 - 2004-09-14 12:48 PM Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
Code:
$sskey = "HKEY_CURRENT_USER\Control Panel\Desktop"

WriteValue($sskey, "ScreenSaveActive", "1", "REG_SZ")
WriteValue($sskey, "ScreenSaveTimeOut", "120", "REG_SZ")
WriteValue($sskey, "ScreenSaverIsSecure", "1", "REG_SZ")
WriteValue($sskey, "SCRNSAVE.EXE", "C:\WINDOWS\System32\scrnsave.scr", "REG_SZ")





First one: Works
Second one: Do not work
Third one: Works
Fourth one: Do not work


First one: It always turns the screensaver on.
Second one: It never changes the time... The time stays as it was before I run the script.
Third one: Always sets it to secure.
Fourth one: If a screensaver already exist (i.e. screensaver not active) - It set the screensaver to what I wish.


Why does it not work? Any suggestions?
Must the values be deleted or something before I can change it?

Top
#126670 - 2004-09-14 01:12 PM Re: Screensaver trouble
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Check the return values of WriteValue() and the value of @ERROR and @SERROR after each call.

You may well not have permission to write / create these keys.

Top
#126671 - 2004-09-14 01:29 PM Re: Screensaver trouble
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
how you check that they don't work?
if you just look in the GUI after the change, it shouldn't appear there before re-launching shell (as is done in logon).
_________________________
!

download KiXnet

Top
#126672 - 2004-09-14 01:47 PM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
Quote:

Check the return values of WriteValue() and the value of @ERROR and @SERROR after each call.

You may well not have permission to write / create these keys.




Have done that. It only returns a bunch 0's. Which I believe means it is working correctly. =)



Quote:

how you check that they don't work?
if you just look in the GUI after the change, it shouldn't appear there before re-launching shell (as is done in logon).





Not completly sure what you mean, but I go to the GUI of screensaverthingy, yes... Also re-launched that one.
I also have the registery up. It shows the timeout has been changed, but not the screensaver.scr

Top
#126673 - 2004-09-14 01:49 PM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
Strange.... Got the *.scr to work. But not the timeout.
Top
#126674 - 2004-09-14 01:50 PM Re: Screensaver trouble
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
No, he doesn't mean the cpl thingie but relaunching the shell (Explorer.exe)
_________________________



Top
#126675 - 2004-09-14 02:02 PM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
PROBLEM SOLVED
PROBLEM SOLVED
PROBLEM SOLVED

Thank you for your help. I loged out and loged in again and it worked. =) Thank you for your help. ,)

Top
#126676 - 2004-09-14 02:13 PM Re: Screensaver trouble
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, that's what I ment!
_________________________
!

download KiXnet

Top
#126677 - 2004-09-15 05:45 AM Re: Screensaver trouble
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
This is a well-documented issue and can eb solved by e.g. using the following UDF: UpdateUserParameters() - updates per-user system parameters
_________________________
There are two types of vessels, submarines and targets.

Top
#126678 - 2004-09-15 10:21 AM Re: Screensaver trouble
Anonymous
Unregistered


So if I understand this correct, if I put the UserUpdateParamter-code behind my code there, the user wont have to logoff and logon again for the screensaver to become "active"?

Cool. Thanks. =)


Top
#126679 - 2004-09-15 10:40 AM Re: Screensaver trouble
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
not only the function code (udf as linked by Jens), you must as well call the function ...

Code:

;the things you do to change the screensaver here

;call udf :

$nul = UpdateUserParameters()

;place udf(s) at end of script

;FUNCTION UpdateUserParameters
;
;ACTION updates per-user system parameters
;
;AUTHOR Jens Meyer (sealeopard@usa.net)
;
;VERSION 1.0
;
;DATE CREATED 01/26/2004
;
;DATE MODIFIED 01/26/2004
;
;KIXTART 4.x
;
;SYNTAX UpdateUserParameters()
;
;PARAMETERS none
;
;RETURNS none
;
;REMARKS used to refresh e.g. the desktop wallpaper or screensaver
;
;DEPENDENCIES none
;
;EXAMPLE $rc=writevalue('HKCU\Control Panel\Desktop\','Wallpaper','C:\WINDOWS\Web\Wallpaper\Bliss.bmp','REG_SZ')
; $rc=UpdateUserParameters()
; ? 'Press any key to continue...'
; get $rc
; $rc=writevalue('HKCU\Control Panel\Desktop\','Wallpaper','','REG_SZ')
; $rc=UpdateUserParameters()
;
;KIXTART BBS http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=111232
;
function UpdateUserParameters()
SHELL 'RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters'
exit @error
endfunction



Edited by Jochen (2004-09-15 10:42 AM)
_________________________



Top
#126680 - 2004-09-15 10:42 AM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
Quote:

So if I understand this correct, if I put the UserUpdateParamter-code behind my code there, the user wont have to logoff and logon again for the screensaver to become "active"?

Cool. Thanks. =)






That was me. However, I can not seem to get it to work. I am trying to get the example in that link to work. (With a different picture though)

Does it matter what key you push to continue?

Calling the function means just writing this, right?
UpdateUserParameters()


Edited by Gos (2004-09-15 10:43 AM)

Top
#126681 - 2004-09-15 10:43 AM Re: Screensaver trouble
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
see above

yeah, but normally, if you don't want to work with the returncodes of functions you 'silence' them with a dummy variable like $nul = function()


Edited by Jochen (2004-09-15 10:45 AM)
_________________________



Top
#126682 - 2004-09-15 12:04 PM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
So... Why does not this work?

Code:
writevalue('HKCU\Control Panel\Desktop\','Wallpaper','c:\pic.jpg','REG_SZ')

$nul = UpdateUserParameters()


function UpdateUserParameters()

SHELL 'RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters'

exit @error

endfunction

$nul



It has perhaps something to do with the UDF-calling thingy, but I only got a bunch of errors. =P Remember I am a newbeginner in kiX'ing. =D

Top
#126683 - 2004-09-15 12:10 PM Re: Screensaver trouble
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what errors you got?
_________________________
!

download KiXnet

Top
#126684 - 2004-09-15 12:14 PM Re: Screensaver trouble
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Works perfectly for me (Hey, I like winnt.bmp ... NOT! )

What are the errors you get ?
_________________________



Top
#126685 - 2004-09-15 12:19 PM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
There is no errors. But I if I check out the Display page, it shows that the background image has been changed and everything, but the background-background is black...

Strangly enough. Does it have to be *.bmp?
Do I lack something in my code?

Top
#126686 - 2004-09-15 12:55 PM Re: Screensaver trouble
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
does that bmp really exist ?
_________________________



Top
#126687 - 2004-09-15 01:03 PM Re: Screensaver trouble
Gos Offline
Fresh Scripter

Registered: 2004-05-28
Posts: 23
Gentlemen... You are hereby entitled to calling me a "n00b".
Why?

Because, this was said: "does that bmp really exist ?" and I thought.... Does it really have to be a bmp. Guess what? It worked when I used a bmp-picture instead.

Thank you again for helping me out. =) I really appreciate it.


Top
#126688 - 2004-09-15 01:11 PM Re: Screensaver trouble
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oh yeah, it has to be really a bmp

For example, if you choose a jpg to be your wallpaper (set it with your favorite browser or for instance ACDSee) and you don't have Active Desktop running it gets converted to like "Internet Explorer Wallpaper.bmp" before it is shown ...
_________________________



Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.082 seconds in which 0.032 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