Advertisement
Guest User

Untitled

a guest
Jan 6th, 2020
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. "use strict";
  2.  
  3. function on_new_sub(name, text)
  4. {
  5. if(text == null || text == "")
  6. return;
  7. var newtext = "";
  8. for(var i = 0; i < text.length; i += 1)
  9. {
  10. var c = text[i];
  11. if(c == "\n" || c == "\r")
  12. continue;
  13. else if(c == '"')
  14. newtext += "”";
  15. else
  16. newtext += c;
  17. }
  18. //mp.commandv("show-text", newtext);
  19. //mp.commandv("print-text", newtext);
  20. var cmd = 'echo "' + newtext + '" | clip';
  21. //mp.commandv("print-text", cmd);
  22. mp.command("run cmd /D /C chcp 65001 | " + cmd); // this line may need to be modified to include a chcp 65001 | or chcp 6501 & on some systems
  23. }
  24.  
  25. mp.observe_property("sub-text", "string", on_new_sub);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement