System Control Shortcuts

By TheImrac on Jan 27, 2009

A quick little snippet I came up with in 25 minutes or so of work. Download and save the following image as 'sysimg.png'
Image
Load The code into your remote, and [size=18]save it in the same place as the image[/size]

It doesn't work that great, more of a proof of concept. It does use the run command, so if you don't have run enabled it wont work.

The icons are as follows: ShutDown, Restart, Sleep, Hibernate, Lock and Log off respectively.

Double click to use.

on *:Start:{ SysCtrl }
alias SysCtrl {
  window -w0Bp +d @SysCtrl $calc($window(-2).dw - 307) $calc($window(-2).dh - 27) 307 27
  drawpic -c @SysCtrl 0 0 $shortfn($scriptdirsysimg.png)
}
menu @SysCtrl {
  mouse:{
    var %b = $ceil($calc(($mouse.x - 1) / 51))
    If (%b == %Sys.Mouse) { halt }
    Set %Sys.Mouse %b
    drawpic -cn @SysCtrl 0 0 $shortfn($scriptdirsysimg.png)
    drawpic -cn @SysCtrl $calc(51 * %b - 50) 0 $calc(51 * %b - 50) 27 51 27 $shortfn($scriptdirsysimg.png)
    drawpic @SysCtrl
  }
  leave:drawpic -c @SysCtrl 0 0 $shortfn($scriptdirsysimg.png)
  dclick:{
    var %b = $ceil($calc(($mouse.x - 1) / 51))
    If (%b == 1) run shutdown.exe -s -t 15 -f
    ElseIf (%b == 2) run shutdown.exe -r -t 15
    ElseIf (%b == 3) run rundll32.exe PowrProf.dll, SetSuspendState Sleep
    ElseIf (%b == 4) run shutdown.exe -h
    ElseIf (%b == 5) run rundll32.exe user32.dll, LockWorkStation
    ElseIf (%b == 6) run shutdown.exe -L
  }
  Close:window -c @SysCtrl
}

Comments

Sign in to comment.
Prelude   -  Jan 28, 2009

I suggest making this a /toolbar function Imrac. Would be way cooler as buttons on the toolbar and you already have the images.

 Respond  
Kirby   -  Jan 28, 2009

Works nice.
Thanks for making it. :>
/me rates 9.0 as well.

 Respond  
PuNkTuReD   -  Jan 27, 2009

very sweet lil snippet youve made here Thelmrac 9/10

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.