Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chris,
They won't let me turn the screensaver off. "They" are idiots. Since their policy is directly interfering with your work, take your complaint up the food-chain until a bigger fish tells them to change it. In the mean time, I have heard that http://www.rjlsoftware.com/software/utility/stopss/ will prevent your screensaver from kicking in. Not tested.... HTH, Bernie MS Excel MVP wrote in message ups.com... Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Actually, I've just tried that code and it didn't work! Any other
ideas? Cheers, Chris On Jun 5, 6:51 pm, wrote: Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for that Bernie, I suspect that the same group policy will prevent me from installing anything new on the machine, but I'll give it a try :) I was looking up the sendinput API call - any view on whether that would simulate a mouse movement? It looks like it wouldn't be interpreted as a hardware movement, so wouldn't stop the screensaver (and associated password protect) kicking in. Cheers, Chris On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org wrote: Chris, They won't let me turn the screensaver off. "They" are idiots. Since their policy is directly interfering with your work, take your complaint up the food-chain until a bigger fish tells them to change it. In the mean time, I have heard that http://www.rjlsoftware.com/software/utility/stopss/ will prevent your screensaver from kicking in. Not tested.... HTH, Bernie MS Excel MVP wrote in message ups.com... Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub- Hide quoted text - - Show quoted text - |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chris,
A quick bit of testing on my system (W2K), shows that printing anything to debug prevents the ScreenSaver kicking in. If you halt the code or the code finishes, then the screen saver starts up, but surely by then it's not a problem. Screen saver set to 1 min: Also, the DoEvents seems necssary if the Screen Saver does kick in to allow you to get rid of it. Maybe try that first. 'Option Explicit Private Sub CommandButton1_Click() Dim arr(1 To 1000000) As Variant Dim starttime As Date starttime = Now For j = 1 To 20 For i = 1 To 1000000 'Just some longish calculation arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3 Next Debug.Print Format(Now() - starttime, "ss") Erase arr ' DoEvents Next End Sub NickHK wrote in message ps.com... Thanks for that Bernie, I suspect that the same group policy will prevent me from installing anything new on the machine, but I'll give it a try :) I was looking up the sendinput API call - any view on whether that would simulate a mouse movement? It looks like it wouldn't be interpreted as a hardware movement, so wouldn't stop the screensaver (and associated password protect) kicking in. Cheers, Chris On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org wrote: Chris, They won't let me turn the screensaver off. "They" are idiots. Since their policy is directly interfering with your work, take your complaint up the food-chain until a bigger fish tells them to change it. In the mean time, I have heard that http://www.rjlsoftware.com/software/utility/stopss/ will prevent your screensaver from kicking in. Not tested.... HTH, Bernie MS Excel MVP wrote in message ups.com... Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub- Hide quoted text - - Show quoted text - |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Correction:
Whilst, surprisingly, this did work before (honest), it now seems not to. NickHK "NickHK" wrote in message ... Chris, A quick bit of testing on my system (W2K), shows that printing anything to debug prevents the ScreenSaver kicking in. If you halt the code or the code finishes, then the screen saver starts up, but surely by then it's not a problem. Screen saver set to 1 min: Also, the DoEvents seems necssary if the Screen Saver does kick in to allow you to get rid of it. Maybe try that first. 'Option Explicit Private Sub CommandButton1_Click() Dim arr(1 To 1000000) As Variant Dim starttime As Date starttime = Now For j = 1 To 20 For i = 1 To 1000000 'Just some longish calculation arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3 Next Debug.Print Format(Now() - starttime, "ss") Erase arr ' DoEvents Next End Sub NickHK wrote in message ps.com... Thanks for that Bernie, I suspect that the same group policy will prevent me from installing anything new on the machine, but I'll give it a try :) I was looking up the sendinput API call - any view on whether that would simulate a mouse movement? It looks like it wouldn't be interpreted as a hardware movement, so wouldn't stop the screensaver (and associated password protect) kicking in. Cheers, Chris On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org wrote: Chris, They won't let me turn the screensaver off. "They" are idiots. Since their policy is directly interfering with your work, take your complaint up the food-chain until a bigger fish tells them to change it. In the mean time, I have heard that http://www.rjlsoftware.com/software/utility/stopss/ will prevent your screensaver from kicking in. Not tested.... HTH, Bernie MS Excel MVP wrote in message ups.com... Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub- Hide quoted text - - Show quoted text - |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Nick Have to say, this doesn't work for me either
unfortunately! :( I'm thinking of resorting to a hardware solution - having a rotating disk against my (optical) mouse! Cheers, Chris On Jun 6, 11:22 am, "NickHK" wrote: Correction: Whilst, surprisingly, this did work before (honest), it now seems not to. NickHK "NickHK" wrote in message ... Chris, A quick bit of testing on my system (W2K), shows that printing anything to debug prevents the ScreenSaver kicking in. If you halt the code or the code finishes, then the screen saver starts up, but surely by then it's not a problem. Screen saver set to 1 min: Also, the DoEvents seems necssary if the Screen Saver does kick in to allow you to get rid of it. Maybe try that first. 'Option Explicit Private Sub CommandButton1_Click() Dim arr(1 To 1000000) As Variant Dim starttime As Date starttime = Now For j = 1 To 20 For i = 1 To 1000000 'Just some longish calculation arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3 Next Debug.Print Format(Now() - starttime, "ss") Erase arr ' DoEvents Next End Sub NickHK wrote in message ups.com... Thanks for that Bernie, I suspect that the same group policy will prevent me from installing anything new on the machine, but I'll give it a try :) I was looking up the sendinput API call - any view on whether that would simulate a mouse movement? It looks like it wouldn't be interpreted as a hardware movement, so wouldn't stop the screensaver (and associated password protect) kicking in. Cheers, Chris On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org wrote: Chris, They won't let me turn the screensaver off. "They" are idiots. Since their policy is directly interfering with your work, take your complaint up the food-chain until a bigger fish tells them to change it. In the mean time, I have heard that http://www.rjlsoftware.com/software/utility/stopss/ will prevent your screensaver from kicking in. Not tested.... HTH, Bernie MS Excel MVP wrote in message oups.com... Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chris,
Whilst this works in preventing the screen saver from starting, its use of SendKeys is somewhat unpredictable if you intend to continue working with Windows whilst your simulation is running. You could add a checkbox to indicate if you are running "Unattended", then execute the SendKeys code; otherwise there is no point executing it, as your own activity would prevent the SS from starting. If you are just clicking a WS button and walking away, this <should work. After loking at various other suggestion: - Registry settings which I assume are not accessible for you - SwitchDesktop API - Various mouse/keyboard API I could not get any to work in my open environment, so I serious doubt they would work in your environment. Private Sub CommandButton1_Click() Dim i As Long, j As Long Dim arr(1 To 1000000) As Variant Range("D1").Select For j = 1 To 20 For i = 1 To 1000000 arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3 Next Debug.Print "Run: " & j Erase arr DoEvents Application.ScreenUpdating = True SendKeys "{F2}" SendKeys "{ESC}" Application.ScreenUpdating = False Next End Sub NickHK wrote in message ps.com... Thanks Nick Have to say, this doesn't work for me either unfortunately! :( I'm thinking of resorting to a hardware solution - having a rotating disk against my (optical) mouse! Cheers, Chris On Jun 6, 11:22 am, "NickHK" wrote: Correction: Whilst, surprisingly, this did work before (honest), it now seems not to. NickHK "NickHK" wrote in message ... Chris, A quick bit of testing on my system (W2K), shows that printing anything to debug prevents the ScreenSaver kicking in. If you halt the code or the code finishes, then the screen saver starts up, but surely by then it's not a problem. Screen saver set to 1 min: Also, the DoEvents seems necssary if the Screen Saver does kick in to allow you to get rid of it. Maybe try that first. 'Option Explicit Private Sub CommandButton1_Click() Dim arr(1 To 1000000) As Variant Dim starttime As Date starttime = Now For j = 1 To 20 For i = 1 To 1000000 'Just some longish calculation arr(i) = Rnd() * Asc(Mid(Split("ahsd kjhh")(0), 2, 1)) ^ 3.3 Next Debug.Print Format(Now() - starttime, "ss") Erase arr ' DoEvents Next End Sub NickHK wrote in message ups.com... Thanks for that Bernie, I suspect that the same group policy will prevent me from installing anything new on the machine, but I'll give it a try :) I was looking up the sendinput API call - any view on whether that would simulate a mouse movement? It looks like it wouldn't be interpreted as a hardware movement, so wouldn't stop the screensaver (and associated password protect) kicking in. Cheers, Chris On Jun 5, 7:11 pm, "Bernie Deitrick" <deitbe @ consumer dot org wrote: Chris, They won't let me turn the screensaver off. "They" are idiots. Since their policy is directly interfering with your work, take your complaint up the food-chain until a bigger fish tells them to change it. In the mean time, I have heard that http://www.rjlsoftware.com/software/utility/stopss/ will prevent your screensaver from kicking in. Not tested.... HTH, Bernie MS Excel MVP wrote in message oups.com... Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Create a vb script with the following:
Option Explicit Dim WSHShell, regVal Set WSHShell = WScript.CreateObject("WScript.Shell") regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\" regVal=regVal & "ScreenSaveTimeOut" WSHShell.RegDelete regVal regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\" regVal=regVal & "ScreenSaverIsSecure" WSHShell.RegDelete regVal Set WSHShell=Nothing " wrote: Actually, I've just tried that code and it didn't work! Any other ideas? Cheers, Chris On Jun 5, 6:51 pm, wrote: Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ralph,
Unless I'm missing something, if the group policy bars the OP from changing the settings manually, how will the OP have permission to those keys ? NickHK "Ralph" ... Create a vb script with the following: Option Explicit Dim WSHShell, regVal Set WSHShell = WScript.CreateObject("WScript.Shell") regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\" regVal=regVal & "ScreenSaveTimeOut" WSHShell.RegDelete regVal regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\" regVal=regVal & "ScreenSaverIsSecure" WSHShell.RegDelete regVal Set WSHShell=Nothing " wrote: Actually, I've just tried that code and it didn't work! Any other ideas? Cheers, Chris On Jun 5, 6:51 pm, wrote: Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Where I work you can't even open the registry with the policy they have set,
but they can't block you from deleting the keys. The only problem I see with this solution is every time the policy is implemented the script would need to be re-run or it could be part of the Excel macro. "NickHK" wrote: Ralph, Unless I'm missing something, if the group policy bars the OP from changing the settings manually, how will the OP have permission to those keys ? NickHK "Ralph" ... Create a vb script with the following: Option Explicit Dim WSHShell, regVal Set WSHShell = WScript.CreateObject("WScript.Shell") regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\" regVal=regVal & "ScreenSaveTimeOut" WSHShell.RegDelete regVal regVal = "HKCU\Software\Policies\Microsoft\Windows\Cont rol Panel\Desktop\" regVal=regVal & "ScreenSaverIsSecure" WSHShell.RegDelete regVal Set WSHShell=Nothing " wrote: Actually, I've just tried that code and it didn't work! Any other ideas? Cheers, Chris On Jun 5, 6:51 pm, wrote: Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe try a web based MonteCarlo simulation
instead of Excel based. Try VanguardSystem from Vanguard Software The thing is Web based, and I believe you can even run on their servers so you can do an end run around any policies on local machines. It's also a whole lot faster than Excel On Jun 5, 12:51 pm, wrote: Hi, I have a rather restricitve group policy set on my machine. I look after a monte carlo simulation model, written in VBA, which annoying breaks whenever the screensaver kicks in. They won't let me turn the screensaver off. I have tried. I have the following programming tools available: 1. VBA 2. Python compiler and, er, that's it... Does anyone know any vba hacks (or at a stretch a python hack) which could stop my screensaver locking every 15 minutes, breaking my model? I don't care how it does it - simulate a mouse movement, type a key, turn the screensaver off... anything - it's becoming desperate! I found the following in this newsgroup, but not sure it would work with a group policy screensaver (Don Bardner, original author)... Private Declare Function SystemParametersInfo Lib "user32" Alias _ "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _ lpvParam As Any, ByVal fuWinIni As Long) As Long Sub SetScreenSaver(OnOff As Long) 'From Don Bradner Dim templong As Long Const SPI_SETSCREENSAVEACTIVE = 17 Const SPIF_UPDATEINIFILE = 1 Const SPIF_SENDWININICHANGE = 2 templong = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, OnOff, ByVal 0&, _ SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE) End Sub Sub MySub() SetScreenSaver 0 'your code here SetScreenSaver 1 End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Allow Trusted Locations on my network - Group Policy (GP) | Excel Discussion (Misc queries) | |||
How do I turn off [Group] mode? | Excel Discussion (Misc queries) | |||
Macro Security for Excel 2007 (group policy) | Setting up and Configuration of Excel | |||
How does one turn off gridlines only in a group of cells? | Excel Worksheet Functions | |||
Macro run slow when turn on ScreenSaver | Excel Programming |