Screen saver written in Macro Scheduler script

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Screen saver written in Macro Scheduler script

Post by JRL » Thu Oct 19, 2006 10:40 pm

This one's for you Paul.

You were talking about a short script to keep your customer's real screen saver from popping up. This will keep the regular screen saver at bay and provide a little protection for the computer while you're at lunch. Mostly it was fun to create and gave me a chance to develop some techniques I want to use elsewhere

The way this works is it puts up a blank full screen dialog then runs a stayontop box that also moves around thus preventing the real screensaver. Set "passwordvar" to whatever you want the password to be. "Xspeed" and "Yspeed" determine how fast the box will move. "ChangeRate" determines how often the speeds will change. After you start this script, don't worry about catching up with the box using the mouse, just type in your password and press return,(As-is there is no password so simply hit return) that should kill the script. If not, Shift+Esc should kill it. If not..... oops.

You may need to change the path for mshed.exe, depends on your setup.

This is not foolproof and is not meant to represent foolproof screen saving protection. CTRL+ALT+DEL can defeat it for sure as will SHIFT+ESC. Possibly other ways to kill it that I haven't thought of.

It's fun to watch anyway,
Dick

Code: Select all

Let>passwordvar=
Let>XSpeed=10
Let>YSpeed=10
Let>ChangeRate=80

OnEvent>KEY_DOWN,VK9,0,alttab

Dialog>Dialog1
   Caption=BackGround
   Width=2000
   Height=2000
   Top=0
   Left=0
EndDialog>Dialog1
Let>3wide=133
Let>3high=80
Dialog>Dialog3
   Caption=Enter your password
   Width=%3wide%
   Height=%3high%
   Top=120
   Left=69
   Close=0
   Edit=msEdit1,0,0,121,
   Button=Ok,24,24,75,25,3
   Default=Ok
EndDialog>Dialog3

show>dialog1
WIN>2,BackGround
wait>0.01
CloseDialog>Dialog1
wait>0.001
LibFunc>user32,FindWindowA,dhwnd,TForm,BackGround
LibFunc>user32,SetWindowLongA,sres,dhwnd,-16,65536
show>dialog1
set>BackGround

Show>dialog3

Let>macrofile=%TEMP_DIR%~MovePassWinAround~.scp
IfFileExists>%macrofile%
  DeleteFile>%macrofile%
EndIf

WriteLn>%macrofile%,wresult,GCP>X,Y
WriteLn>%macrofile%,wresult,  Mou>10000,10000
WriteLn>%macrofile%,wresult,  GCP>screenX,screenY
WriteLn>%macrofile%,wresult,  MOU>%X%,%Y%
WriteLn>%macrofile%,wresult,Let>moveright=1
WriteLn>%macrofile%,wresult,Let>movedown=1
WriteLn>%macrofile%,wresult,Random>%Xspeed%,Xm
WriteLn>%macrofile%,wresult,Random>%Yspeed%,Ym
WriteLn>%macrofile%,wresult,Random>%ChangeRate%,timeout
WriteLn>%macrofile%,wresult,add>Ym,1
WriteLn>%macrofile%,wresult,add>Xm,1
WriteLn>%macrofile%,wresult,add>timeout,1
WriteLn>%macrofile%,wresult,Let>k=0

WriteLn>%macrofile%,wresult,Label>start
WriteLn>%macrofile%,wresult,Wait>0.01

WriteLn>%macrofile%,wresult,Set>Enter your password

WriteLn>%macrofile%,wresult,GetActiveWindow>window_title,X,Y
WriteLn>%macrofile%,wresult,If>{(%X%<%screenX%-%3wide%)and(%moveright%=1)}
WriteLn>%macrofile%,wresult,  Add>X,%Xm%
WriteLn>%macrofile%,wresult,Else>
WriteLn>%macrofile%,wresult,  Let>moveright=0
WriteLn>%macrofile%,wresult,  If>{(%X%>0)and(%moveright%=0)}
WriteLn>%macrofile%,wresult,    Sub>X,%Xm%
WriteLn>%macrofile%,wresult,  Else>
WriteLn>%macrofile%,wresult,    Let>moveright=1
WriteLn>%macrofile%,wresult,	Add>X,%Xm%
WriteLn>%macrofile%,wresult,  EndIf
WriteLn>%macrofile%,wresult,EndIf
WriteLn>%macrofile%,wresult,If>{(%Y%<%screenY%-%3high%)and(%movedown%=1)}
WriteLn>%macrofile%,wresult,  Add>Y,%Ym%
WriteLn>%macrofile%,wresult,Else>
WriteLn>%macrofile%,wresult,  Let>movedown=0
WriteLn>%macrofile%,wresult,  If>{(%Y%>0)and(%movedown%=0)}
WriteLn>%macrofile%,wresult,    Sub>Y,%Ym%
WriteLn>%macrofile%,wresult,  Else>
WriteLn>%macrofile%,wresult,    Let>movedown=1
WriteLn>%macrofile%,wresult,	Add>Y,%Ym%
WriteLn>%macrofile%,wresult,  EndIf
WriteLn>%macrofile%,wresult,EndIf
WriteLn>%macrofile%,wresult,MoveWindow>%window_title%,%X%,%Y%

WriteLn>%macrofile%,wresult,If>{(%k%>%timeout%)}
WriteLn>%macrofile%,wresult,  Let>k=0
WriteLn>%macrofile%,wresult,  Random>%Xspeed%,Xm
WriteLn>%macrofile%,wresult,  Random>%Yspeed%,Ym
WriteLn>%macrofile%,wresult,  Random>%ChangeRate%,timeout
WriteLn>%macrofile%,wresult,  add>timeout,1
WriteLn>%macrofile%,wresult,  add>Ym,1
WriteLn>%macrofile%,wresult,  add>Xm,1
WriteLn>%macrofile%,wresult,Else
WriteLn>%macrofile%,wresult,  add>k,1
WriteLn>%macrofile%,wresult,EndIf

WriteLn>%macrofile%,wresult,IfW>Enter your password,start,end

WriteLn>%macrofile%,wresult,Label>end

Run>C:\Program Files\MJT Net Ltd\Macro Scheduler\msched.exe %macrofile%

Label>start
Set>Enter your password
GDA>dialog3,r3
If>r3=3,process
Wait>0.01
Release ALT
Release LALT
Release RALT
Release ALTGR
Release CTRL
Release LCTRL
Release RCTRL
Release LWinKey
Release RWinKey
goto>start

SRT>process
If>%dialog3.msedit1%=%passwordvar%,end
Press tab
Let>%dialog3.msedit1%=
RDA>dialog3
Press tab
END>process

SRT>alttab
set>BackGround
Set>Enter your password
END>alttab

Label>end

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 20, 2006 11:47 am

Next step - use the registry to locate the user's desktop bitmap. Set an image object to fill the main dialog. Load it with the user's desktop bitmap. ;-)
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Oct 20, 2006 3:46 pm

Very clever, Dick!

I have considered simply creating a bitmap that "looks like" a logged-out screen and writing a sript to display it until some event occurs.

some system managers might consider these methods to be "outside the rules of operation", but ......

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 20, 2006 3:51 pm

It's kinda the opposite of what Vista does. When a UAC prompt pops up in Vista requesting admin privs for an operation the background goes dark. What actually happens is that a screen shot of your desktop is taken and control switches to the logon (security) desktop. The logon desktop serves up the UAC prompt and shows the screen shot behind it. This is so as not to distract from the user experience too much and make you think you're still looking at your desktop. In fact you're now communicating with the security desktop!
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Oct 20, 2006 4:00 pm

Let me think... As a system manager (yes I am) would I rather have you running a mouse move program that defeats the screen saver or a makeshift screen saver that will defeat 99% of people who might walk up to the computer to use it for non-company use?

I choose door number 2.

Nothing says you can't work on this a bit and make it more secure.

Marcus' suggestion for displaying the wallpaper is good but there are computers (like mine) that have no wallpaper. So maybe at the process start it should perform a LWINKEY+D and minimise everything, then run ScreenCapture> on the entire screen (the script gets those ccordinates at the beginning) then use that captured bitmap in the big dialog to display a fake desktop. Then after the password is typed in press LWINKEY+D again to put the windows back to where they were.

I'll work on that this weekend.

Later,
Dick

Marcus just posted in ahead of me... Does what I've described above sound like it would look like what Vista does?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 20, 2006 4:08 pm

JRL wrote:Marcus just posted in ahead of me... Does what I've described above sound like it would look like what Vista does?
Kind of.

This version grabs the desktop:

Code: Select all

Let>passwordvar=
Let>XSpeed=10
Let>YSpeed=10
Let>ChangeRate=80

OnEvent>KEY_DOWN,VK9,0,alttab

Press LWinKey
Send>d
Release LWinKey
Let>wPaper=%TEMP_DIR%\screen.bmp
ScreenCapture>0,0,2000,2000,wPaper

Dialog>Dialog1
   Caption=BackGround
   Width=2000
   Height=2000
   Top=0
   Left=0
   Image=%wPaper%,0,0,2000,2000,imgBack
EndDialog>Dialog1

Let>3wide=133
Let>3high=80
Dialog>Dialog3
   Caption=Enter your password
   Width=%3wide%
   Height=%3high%
   Top=120
   Left=69
   Close=0
   Edit=msEdit1,0,0,121,
   Button=Ok,24,24,75,25,3
   Default=Ok
EndDialog>Dialog3

show>dialog1
WIN>2,BackGround
wait>0.01
CloseDialog>Dialog1
wait>0.001
LibFunc>user32,FindWindowA,dhwnd,TForm,BackGround
LibFunc>user32,SetWindowLongA,sres,dhwnd,-16,65536
show>dialog1
set>BackGround

Show>dialog3

Let>macrofile=%TEMP_DIR%~MovePassWinAround~.scp
IfFileExists>%macrofile%
  DeleteFile>%macrofile%
EndIf

WriteLn>%macrofile%,wresult,GCP>X,Y
WriteLn>%macrofile%,wresult,  Mou>10000,10000
WriteLn>%macrofile%,wresult,  GCP>screenX,screenY
WriteLn>%macrofile%,wresult,  MOU>%X%,%Y%
WriteLn>%macrofile%,wresult,Let>moveright=1
WriteLn>%macrofile%,wresult,Let>movedown=1
WriteLn>%macrofile%,wresult,Random>%Xspeed%,Xm
WriteLn>%macrofile%,wresult,Random>%Yspeed%,Ym
WriteLn>%macrofile%,wresult,Random>%ChangeRate%,timeout
WriteLn>%macrofile%,wresult,add>Ym,1
WriteLn>%macrofile%,wresult,add>Xm,1
WriteLn>%macrofile%,wresult,add>timeout,1
WriteLn>%macrofile%,wresult,Let>k=0

WriteLn>%macrofile%,wresult,Label>start
WriteLn>%macrofile%,wresult,Wait>0.01

WriteLn>%macrofile%,wresult,Set>Enter your password

WriteLn>%macrofile%,wresult,GetActiveWindow>window_title,X,Y
WriteLn>%macrofile%,wresult,If>{(%X%<%screenX%-%3wide%)and(%moveright%=1)}
WriteLn>%macrofile%,wresult,  Add>X,%Xm%
WriteLn>%macrofile%,wresult,Else>
WriteLn>%macrofile%,wresult,  Let>moveright=0
WriteLn>%macrofile%,wresult,  If>{(%X%>0)and(%moveright%=0)}
WriteLn>%macrofile%,wresult,    Sub>X,%Xm%
WriteLn>%macrofile%,wresult,  Else>
WriteLn>%macrofile%,wresult,    Let>moveright=1
WriteLn>%macrofile%,wresult,	Add>X,%Xm%
WriteLn>%macrofile%,wresult,  EndIf
WriteLn>%macrofile%,wresult,EndIf
WriteLn>%macrofile%,wresult,If>{(%Y%<%screenY%-%3high%)and(%movedown%=1)}
WriteLn>%macrofile%,wresult,  Add>Y,%Ym%
WriteLn>%macrofile%,wresult,Else>
WriteLn>%macrofile%,wresult,  Let>movedown=0
WriteLn>%macrofile%,wresult,  If>{(%Y%>0)and(%movedown%=0)}
WriteLn>%macrofile%,wresult,    Sub>Y,%Ym%
WriteLn>%macrofile%,wresult,  Else>
WriteLn>%macrofile%,wresult,    Let>movedown=1
WriteLn>%macrofile%,wresult,	Add>Y,%Ym%
WriteLn>%macrofile%,wresult,  EndIf
WriteLn>%macrofile%,wresult,EndIf
WriteLn>%macrofile%,wresult,MoveWindow>%window_title%,%X%,%Y%

WriteLn>%macrofile%,wresult,If>{(%k%>%timeout%)}
WriteLn>%macrofile%,wresult,  Let>k=0
WriteLn>%macrofile%,wresult,  Random>%Xspeed%,Xm
WriteLn>%macrofile%,wresult,  Random>%Yspeed%,Ym
WriteLn>%macrofile%,wresult,  Random>%ChangeRate%,timeout
WriteLn>%macrofile%,wresult,  add>timeout,1
WriteLn>%macrofile%,wresult,  add>Ym,1
WriteLn>%macrofile%,wresult,  add>Xm,1
WriteLn>%macrofile%,wresult,Else
WriteLn>%macrofile%,wresult,  add>k,1
WriteLn>%macrofile%,wresult,EndIf

WriteLn>%macrofile%,wresult,IfW>Enter your password,start,end

WriteLn>%macrofile%,wresult,Label>end

Run>C:\Program Files\MJT Net Ltd\Macro Scheduler\msched.exe %macrofile%

Label>start
Set>Enter your password
GDA>dialog3,r3
If>r3=3,process
Wait>0.01
Release ALT
Release LALT
Release RALT
Release ALTGR
Release CTRL
Release LCTRL
Release RCTRL
Release LWinKey
Release RWinKey
goto>start

SRT>process
If>%dialog3.msedit1%=%passwordvar%,end
Press tab
Let>%dialog3.msedit1%=
RDA>dialog3
Press tab
END>process

SRT>alttab
set>BackGround
Set>Enter your password
END>alttab

Label>end
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3529
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Oct 20, 2006 4:15 pm

:) I like it!!!! :)

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts