Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InputBox, codestring, Enter code, Enter one line code
- PipeRun(codestring)
- return ; End of auto-execute
- PipeRun(Script) {
- pipe := "\\.\pipe\AHK" A_TickCount
- loop 2 {
- pipe%A_Index% := DllCall("Kernel32\CreateNamedPipe", "Str",pipe, "UInt",2
- , "UInt",0, "UInt",255, "UInt",0, "UInt",0, "UInt",0, "Ptr",0)
- }
- if (pipe1 = -1 || pipe2 = -1) {
- ErrorLevel := -1
- return false ; Couldn't create pipes
- }
- Run % A_AhkPath " " pipe,, UseErrorLevel
- if (ErrorLevel) {
- ErrorLevel := -2
- return false ; Couldn't run the pipe
- }
- DllCall("Kernel32\ConnectNamedPipe", "Ptr",pipe1, "Ptr",0)
- DllCall("Kernel32\CloseHandle", "Ptr",pipe1)
- DllCall("Kernel32\ConnectNamedPipe", "Ptr",pipe2, "Ptr",0)
- if (!FileOpen(pipe2, "h", "UTF-8").Write(Script)) {
- ErrorLevel := -2
- return false ; Couldn't write to pipe
- }
- DllCall("Kernel32\CloseHandle", "Ptr",pipe2)
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement