Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #Persistent
- #SingleInstance, force
- SetBatchLines, -1
- paths := {}
- paths["/SendConsole"] := Func("SendConsole")
- paths["404"] := Func("NotFound")
- paths["/logo"] := Func("Logo")
- paths["/FadeUp"] := Func("FadeUp")
- paths["/FadeDown"] := Func("FadeDown")
- server := new HttpServer()
- server.LoadMimes(A_ScriptDir . "/mime.types")
- server.SetPaths(paths)
- server.Serve(8000)
- return
- Logo(ByRef req, ByRef res, ByRef server) {
- server.ServeFile(res, A_ScriptDir . "/logo.png")
- res.status := 200
- }
- NotFound(ByRef req, ByRef res) {
- res.SetBodyText("Page not found")
- }
- SendConsole(ByRef req, ByRef res) {
- ; Go to VConsole
- WinActivate, VConsole
- ; Command field
- Click, 133, 782
- ; Type command
- Cmd := req.queries["command"]
- Send, %Cmd%
- ; Hit enter
- Send, {Enter}
- res.SetBodyText("OK")
- res.status := 200
- }
- FadeUp(ByRef req, ByRef res) {
- Loop 100 {
- Sleep 10
- SoundSet,+1
- }
- res.SetBodyText("OK")
- res.status := 200
- }
- FadeDown(ByRef req, ByRef res) {
- Loop 100 {
- Sleep 10
- SoundSet,-1
- }
- res.SetBodyText("OK")
- res.status := 200
- }
- #include, %A_ScriptDir%\AHKhttp.ahk
- #include %A_ScriptDir%\AHKsock.ahk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement