Advertisement
tabnation

pipeline 1 test

Jul 4th, 2022
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. InputBox, codestring, Enter code, Enter one line code
  2. PipeRun(codestring)
  3. return ; End of auto-execute
  4.  
  5.  
  6. PipeRun(Script) {
  7. pipe := "\\.\pipe\AHK" A_TickCount
  8. loop 2 {
  9. pipe%A_Index% := DllCall("Kernel32\CreateNamedPipe", "Str",pipe, "UInt",2
  10. , "UInt",0, "UInt",255, "UInt",0, "UInt",0, "UInt",0, "Ptr",0)
  11. }
  12. if (pipe1 = -1 || pipe2 = -1) {
  13. ErrorLevel := -1
  14. return false ; Couldn't create pipes
  15. }
  16. Run % A_AhkPath " " pipe,, UseErrorLevel
  17. if (ErrorLevel) {
  18. ErrorLevel := -2
  19. return false ; Couldn't run the pipe
  20. }
  21. DllCall("Kernel32\ConnectNamedPipe", "Ptr",pipe1, "Ptr",0)
  22. DllCall("Kernel32\CloseHandle", "Ptr",pipe1)
  23. DllCall("Kernel32\ConnectNamedPipe", "Ptr",pipe2, "Ptr",0)
  24. if (!FileOpen(pipe2, "h", "UTF-8").Write(Script)) {
  25. ErrorLevel := -2
  26. return false ; Couldn't write to pipe
  27. }
  28. DllCall("Kernel32\CloseHandle", "Ptr",pipe2)
  29. return true
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement