Guest User

Untitled

a guest
Mar 30th, 2017
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoTrayIcon
  2.  
  3. Loop
  4. {
  5.     Sleep 500
  6.     if (WinExist("Error","&Yes"))
  7.     {
  8.         FileAppend,
  9.         (
  10.         %A_DD%.%A_MM%.%A_YYYY% %A_Hour%:%A_Min%:%A_Sec% - "Нет связи с сервером ХХ секунд! Перезагрузите компьютер!" `n
  11.         ), C:\Users\administrator\Desktop\testahk.txt
  12.         WinClose
  13.         TrayTip, ПЦН - окно с ошибкой было закрыто автоматически!,
  14.         (
  15. ПРОИЗОШЛА ОШИБКА на ПЦН:
  16. "Нет связи с сервером ХХ секунд! Перезагрузите компьютер!"
  17.  
  18. Окно было закрыто автоматически, но рекомендую проверить ПЦН вручную!
  19.  
  20. Администратор оповещен!
  21.         ),3600, 2
  22.         Telegram_MsgBox(48,1,"PCN6 - Error! Net svyazi s serverom XX secund!")  
  23.     }
  24. }
  25.  
  26.  
  27. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  28. ; #Warn  ; Enable warnings to assist with detecting common errors.
  29. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  30. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  31.  
  32. RandomVariable = sting with variable: %A_OSType%
  33.    
  34.  
  35. Telegram_MsgBox(Option,EmojiPosition,Text)
  36. {
  37.     TelegramBotToken = YOUR_BOT_TOKEN
  38.     TelegramBotChatID = CHAT_ID
  39.    
  40.     if TelegramBotChatID =
  41.         Telegram_FirstCFG()
  42.     if TelegramBotChatID =
  43.         Telegram_FirstCFG()
  44.    
  45.     if Option=16
  46.         TelegramIconString := "%E2%9D%8C"
  47.     if Option=32
  48.         TelegramIconString := "%E2%9D%94"
  49.     if Option=48
  50.         TelegramIconString := "%E2%9A%A0%EF%B8%8F"
  51.     if Option=64
  52.         TelegramIconString := "%E2%84%B9%EF%B8%8F"
  53.    
  54.     IfInString, Option, `%
  55.         TelegramIconString := Option
  56.  
  57.     IfLessOrEqual, EmojiPosition, 1
  58.         Text = %TelegramIconString% %Text%
  59.    
  60.     IfGreaterOrEqual, EmojiPosition, 2
  61.         Text = %Text% %TelegramIconString%
  62.        
  63.     loop 3
  64.     {
  65.         UrlDownloadToFile https://api.telegram.org/bot%TelegramBotToken%/sendmessage?chat_id=%TelegramBotChatID%&text=%Text%, %A_ScriptDir%\check.rups
  66.         sleep 1000
  67.         ifexist %A_ScriptDir%\check.rups
  68.         {
  69.             break
  70.         }
  71.         if A_index = 3
  72.         {
  73.             MsgBox, 16,, something went wrong with sending
  74.         }
  75.     }
  76.     ;filedelete %A_ScriptDir%\check.rups
  77. }
  78.  
  79. Telegram_FirstCFG()
  80. {
  81.     msgbox open telegram and open a new Chat with @botfater`nif yout dont know how you do that, search in your default serach engine for "Telegram Botfather first bot"`n`nyou need to choose a unique name (you cant change it)
  82.     loop
  83.     {
  84.         InputBox, BotToken, enter the in telegram indicated bot token,
  85.         MsgBox, 4, , Bot Token correct?:`n%BotToken%
  86.             IfMsgBox Yes
  87.                 break
  88.     }
  89.    
  90.     Random, SecurityCode, 1000, 9999
  91.     msgbox now open a new chat with your new created bot (search for @*yourbotname* and start a new chat) and enter this number %SecurityCode% and send it via telegram`n press OK, when done.
  92.     UrlDownloadToFile https://api.telegram.org/bot%BotToken%/getupdates , %A_ScriptDir%\findChatID.txt
  93.     sleep 2000
  94.     run %A_ScriptDir%\findChatID.txt
  95.     msgbox now search for the number %SecurityCode% and on the same line there should be something like: "chat":{"id":782163891`n`nfound it? press ok
  96.     InputBox ChatID, enter the number after "chat":{"id": here:
  97.     FileAppend, Telegram Bot Token = %BotToken%`n, %A_ScriptDir%\TokenAndID.txt
  98.     FileAppend, Telegram Chat ID = %ChatID%, %A_ScriptDir%\TokenAndID.txt
  99.     run %A_ScriptDir%\TokenAndID.txt
  100.     msgbox here you go. copy and past the values to the variables TelegramBotToken & TelegramChatID in the sourcecode.`n`n(you can delte all the .txt files)
  101.     exitapp
  102. }
Advertisement
Add Comment
Please, Sign In to add comment