Advertisement
LockdateforGHS

ahk test

Jun 4th, 2023
1,731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SwapMouseButtons() {
  2.     Random, %RandomValue%, 0, 1
  3.     If %RandomValue%
  4.         Click, Right
  5.     Else
  6.         Click, Left
  7. }
  8. ; hi
  9. ReverseWords(sentence) {
  10.     words := StrSplit(sentence, " ")
  11.     reversedSentence := ""
  12.     Loop, %words.MaxIndex()
  13.         reversedSentence := words[A_Index] " " reversedSentence
  14.     return RTrim(reversedSentence)
  15. }
  16.  
  17. EncryptString(string) {
  18.     encryptedString := ""
  19.     Loop, Parse, string
  20.     {
  21.         char := Asc(A_LoopField)
  22.         char += 5
  23.         encryptedString .= Chr(char)
  24.     }
  25.     return encryptedString
  26. }
  27.  
  28. DecryptString(encryptedString) {
  29.     decryptedString := ""
  30.     Loop, Parse, encryptedString
  31.     {
  32.         char := Asc(A_LoopField)
  33.         char -= 5
  34.         decryptedString .= Chr(char)
  35.     }
  36.     return decryptedString
  37. }
  38.  
  39. ^!x::
  40.     Random, %RandomValue%, 1, 4
  41.     If %RandomValue% = 1
  42.         SwapMouseButtons()
  43.     Else If %RandomValue% = 2
  44.         MsgBox, % ReverseWords("This is a text")
  45.     Else If %RandomValue% = 3 {
  46.         input := InputBox("Enter a string to encrypt:")
  47.         encrypted := EncryptString(input)
  48.         MsgBox, %encrypted%
  49.     } Else {
  50.         input := InputBox("Enter a string to decrypt:")
  51.         decrypted := DecryptString(input)
  52.         MsgBox, %decrypted%
  53.     }
  54. Return
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement