Jump to content

CornerLaunch


rakudave
 Share

Recommended Posts

this script launches the screensaver if you move the mouse to a corner of the screen.

you may choose the "hotspot" in the traymenu...

perhaps anyone can use it... (??)

#Include <Constants.au3>
$sdir = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE")
$where = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch")
if $where = 1 OR $where = -1 then
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch","REG_SZ","ur")
    $where = "ur"
endif
if $where <> "ul" AND $where <> "ur" AND $where <> "ll" AND $where <> "lr" then
    RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch","REG_SZ","ur")
    $where = "ur"
endif
Opt("TrayMenuMode",1)

$settingsitem   = TrayCreateMenu("Hot Spots")
$ul = TrayCreateItem("upper-left corner", $settingsitem)
TrayItemSetState(-1,$TRAY_UNCHECKED)
$ur = TrayCreateItem("upper-right corner", $settingsitem)
TrayItemSetState(-1,$TRAY_UNCHECKED)
$ll = TrayCreateItem("lower-left corner", $settingsitem)
TrayItemSetState(-1,$TRAY_UNCHECKED)
$lr = TrayCreateItem("lower-right corner", $settingsitem)
TrayItemSetState(-1,$TRAY_UNCHECKED)
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
select
    case $where = "ul"
        TrayItemSetState($ul,$TRAY_CHECKED)
    case $where = "ur"
        TrayItemSetState($ur,$TRAY_CHECKED)
    case $where = "ll"
        TrayItemSetState($ll,$TRAY_CHECKED)
    case $where = "lr"
        TrayItemSetState($lr,$TRAY_CHECKED)
endselect
TraySetState()

While 1

$mou = MouseGetPos()
    if $mou[0] < 2 AND $mou[1] < 2 AND $where = "ul" then
    runwait($sdir & " /S")
    endif
    if $mou[0] > @desktopwidth -2 AND $mou[1] < 2 AND $where = "ur" then
    runwait($sdir & " /S")
    endif
    if $mou[0] < 2 AND $mou[1] > @desktopheight -2 AND $where = "ll" then
    runwait($sdir & " /S")
    endif
    if $mou[0] > @desktopwidth -2 AND $mou[1] > @desktopheight -2 AND $where = "lr" then
    runwait($sdir & " /S")
    endif
$msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $exititem
            Exit
        case $msg = $ul
            TrayItemSetState($ul,$TRAY_CHECKED)
            TrayItemSetState($ur,$TRAY_UNCHECKED)
            TrayItemSetState($ll,$TRAY_UNCHECKED)
            TrayItemSetState($lr,$TRAY_UNCHECKED)
            $where = "ul"
            RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch","REG_SZ",$where)
        case $msg = $ur
            TrayItemSetState($ul,$TRAY_UNCHECKED)
            TrayItemSetState($ur,$TRAY_CHECKED)
            TrayItemSetState($ll,$TRAY_UNCHECKED)
            TrayItemSetState($lr,$TRAY_UNCHECKED)
            $where = "ur"
            RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch","REG_SZ",$where)
        case $msg = $ll
            TrayItemSetState($ul,$TRAY_UNCHECKED)
            TrayItemSetState($ur,$TRAY_UNCHECKED)
            TrayItemSetState($ll,$TRAY_CHECKED)
            TrayItemSetState($lr,$TRAY_UNCHECKED)
            $where = "ll"
            RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch","REG_SZ",$where)
        case $msg = $lr
            TrayItemSetState($ul,$TRAY_UNCHECKED)
            TrayItemSetState($ur,$TRAY_UNCHECKED)
            TrayItemSetState($ll,$TRAY_UNCHECKED)
            TrayItemSetState($lr,$TRAY_CHECKED)
            $where = "lr"
            RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop","cornerlaunch","REG_SZ",$where)
    EndSelect
Wend
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...