Gos
(Fresh Scripter)
2004-09-14 12:48 PM
Screensaver trouble

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?


Richard H.Administrator
(KiX Supporter)
2004-09-14 01:12 PM
Re: Screensaver trouble

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.


LonkeroAdministrator
(KiX Master Guru)
2004-09-14 01:29 PM
Re: Screensaver trouble

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).


Gos
(Fresh Scripter)
2004-09-14 01:47 PM
Re: Screensaver trouble

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


Gos
(Fresh Scripter)
2004-09-14 01:49 PM
Re: Screensaver trouble

Strange.... Got the *.scr to work. But not the timeout.

JochenAdministrator
(KiX Supporter)
2004-09-14 01:50 PM
Re: Screensaver trouble

No, he doesn't mean the cpl thingie but relaunching the shell (Explorer.exe)

Gos
(Fresh Scripter)
2004-09-14 02:02 PM
Re: Screensaver trouble

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. ,)


LonkeroAdministrator
(KiX Master Guru)
2004-09-14 02:13 PM
Re: Screensaver trouble

ja, that's what I ment!

Sealeopard
(KiX Master)
2004-09-15 05:45 AM
Re: Screensaver trouble

This is a well-documented issue and can eb solved by e.g. using the following UDF: UpdateUserParameters() - updates per-user system parameters

**DONOTDELETE**
(Lurker)
2004-09-15 10:21 AM
Re: Screensaver trouble

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. =)



JochenAdministrator
(KiX Supporter)
2004-09-15 10:40 AM
Re: Screensaver trouble

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



Gos
(Fresh Scripter)
2004-09-15 10:42 AM
Re: Screensaver trouble

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()


JochenAdministrator
(KiX Supporter)
2004-09-15 10:43 AM
Re: Screensaver trouble

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()


Gos
(Fresh Scripter)
2004-09-15 12:04 PM
Re: Screensaver trouble

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


LonkeroAdministrator
(KiX Master Guru)
2004-09-15 12:10 PM
Re: Screensaver trouble

what errors you got?

JochenAdministrator
(KiX Supporter)
2004-09-15 12:14 PM
Re: Screensaver trouble

Works perfectly for me (Hey, I like winnt.bmp ... NOT! )

What are the errors you get ?


Gos
(Fresh Scripter)
2004-09-15 12:19 PM
Re: Screensaver trouble

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?


JochenAdministrator
(KiX Supporter)
2004-09-15 12:55 PM
Re: Screensaver trouble

does that bmp really exist ?

Gos
(Fresh Scripter)
2004-09-15 01:03 PM
Re: Screensaver trouble

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.



JochenAdministrator
(KiX Supporter)
2004-09-15 01:11 PM
Re: Screensaver trouble

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 ...


Les
(KiX Master)
2004-09-15 02:27 PM
Re: Screensaver trouble

LOL
Quote:

Does it matter what key you push to continue?




You have to push the "ANY" key!


Gos
(Fresh Scripter)
2004-09-16 08:19 AM
Re: Screensaver trouble

Hehe. Well, I (somehow) managed to believe the keystroke would have something to do with something something. That it actually played a part of the whole thing. But apparantly not.
=)

I have done some testing. This is what I have figured out - So if someone knows it is wrong, please correct me. =)

I have tried to update the following with the Updatethingy:

ScreenSaveActive - Works
ScreenSaverIsSecure - Works
ScreenSaveTimeOut - Does not work
SCRNSAVE.EXE - Works
Wallpaper - Works


Cybex
(Getting the hang of it)
2004-09-16 11:46 AM
Re: Screensaver trouble

Could the timeout you are setting be trumped by a domain policy which was already set? Try looking at the policies to see if the Local Setting is different than the Effective Setting. You may only be changing the local setting and the effective setting to say 10 min, but the effective setting which could be set via GP from the domain may still be set to 15 min.

Gos
(Fresh Scripter)
2004-09-16 12:27 PM
Re: Screensaver trouble

It work. But it wont work before you loged off and back on a couple of times.

No Global GP. =)


LonkeroAdministrator
(KiX Master Guru)
2004-09-16 01:51 PM
Re: Screensaver trouble

it might be that it's not updateble
try this:
run your script, kill explorer.exe and rerun it with taskmanager, did the setting change?
that's the optimal "update all settings" way without relogging.


Gos
(Fresh Scripter)
2004-09-16 02:55 PM
Re: Screensaver trouble

Killed and revived.... Seems like it is not updatable. =\

Thanks.


JochenAdministrator
(KiX Supporter)
2004-09-16 03:14 PM
Re: Screensaver trouble

Quote:

Killed and revived.... Seems like it is not updatable. =\

Thanks.




Sounds like Windows NT 4 to me ... is it ??


Gos
(Fresh Scripter)
2004-09-17 09:41 AM
Re: Screensaver trouble

No. Win2000 and XP.

LonkeroAdministrator
(KiX Master Guru)
2004-09-17 01:38 PM
Re: Screensaver trouble

that "does not make sense"...
in english, this is something I haven't come accross too often.

well, xp I could understand, but on w2k it should work just fine.


AllenAdministrator
(KiX Supporter)
2004-09-17 04:05 PM
Re: Screensaver trouble

I used to do what you are doing in my login script for both W2K and XP. I had no problems adjusting the timeout. I didn't use Jen's UpdateUserParameters UDF, but just a simple set command (I think they are doing similiar things, just differnt ways). Here's a link to a post similar to this: Applying Registry Settings

You might try the set command, but if Jen's UDF is not working, the set probably won't help either.

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")

set 'ss='