;/////////////////////////////////////////////// ; GroupMsg v1.1.1 | script by Gahks ; http://www.autohotkey.com/forum/topic41997.html ; http://www.autohotkey.net/~gahks ; AutoHotKey version 1.0.48.00 ; Thanks to the authors of the codes ; included at the bottom of the script. ;/////////////////////////////////////////////// #NoEnv ;/////////////////// ;Settings file IfExist, %A_ScriptDir%\GroupMsg-settings.ini { settings_path = %A_ScriptDir%\GroupMsg-settings.ini cache_path = %A_ScriptDir%\GroupMsg-cache.dat } Else { settings_path = %A_ScriptDir%\gmrc-settings.ini cache_path = %A_ScriptDir%\gmrc-cache.dat } ;/////////////////// ;Language init ;DEAFULT LANGUAGE STRINGS gui_mode_0 = I want to use the... gui_mode_1 = &Group messenger/remote control client gui_mode_2 = &Remote control server gui_account_0 = Remote control gui_account_1 = Private group messaging gui_account_2 = Group gui_account_3 = Password gui_account_4 = Message deletion password gui_account_5 = O&K gui_account_6 = E&xit gui_main_0 = Current group gui_main_1 = Date gui_main_2 = ID gui_main_3 = Nr gui_main_4 = Read gui_main_5 = Show the last gui_main_6 = messages gui_main_7 = &Refresh list gui_main_8 = &Send a message gui_main_9 = &Change group gui_main_10 = He&lp gui_main_11 = E&xit gui_main_12 = Connecting... gui_main_13 = Checking group... gui_main_14 = Loading messages... gui_main_15 = messages loaded gui_main_16 = Done: gui_main_17 = Loading . . . gui_main_18 = No messages in the group yet . . . gui_main_19 = About gui_main_20 = If you have further questions: gui_sending_0 = Submit a message to this group: gui_sending_1 = Password for later deletion: (See: Help) gui_sending_2 = Message by: (Optional. If you're sending a command leave it blank!) gui_sending_3 = Message: gui_sending_4 = Submit gui_sending_5 = Go back gui_sending_6 = Help gui_sending_7 = Sent by: gui_sending_8 = Sending... gui_sending_9 = Message id gui_sending_10 = Message gui_sending_11 = Message sent gui_sending_12 = OK gui_sending_13 = Delete gui_sending_help_0 = Help gui_sending_help_1 = Back gui_deleting_0 = Password for deletion gui_deleting_1 = Enter the deletion password gui_saving_0 = Select a folder to save the file to gui_saving_1 = Saving message... gui_saving_2 = Text files gui_saving_3 = Saving failed. gui_saving_4 = Message saved: gui_saving_5 = Sent on: gui_menu_context_0 = Save this message to disk gui_menu_context_1 = Delete this message gui_menu_tray_0 = Change group gui_menu_tray_1 = Change mode gui_menu_tray_2 = E&xit msg_commands_0 = Returned value(s) msg_commands_1 = Executed code: msg_commands_2 = Response msg_error_0 = You don't have the password to read this message. msg_error_1 = Try changing the group password. msg_error_2 = Error! msg_error_3 = The message or the deletion password field is blank! msg_error_4 = Cannot proceed msg_error_5 = Blank Group name or password! msg_error_6 = Blank message deletion password! msg_error_7 = Connection error! msg_error_8 = Couldn't connect to the internet. Would you like to try again? ;LOADING LANGUAGE STRINGS FROM INI IniRead, language, %settings_path%, Default, language ;LANGUAGE INITIALIZATION var=gui_mode_|gui_account_|gui_main_|gui_sending_|gui_sending_help_|gui_deleting_|gui_saving_|gui_menu_context_|gui_menu_tray_|msg_commands_|msg_error_ StringSplit, var, var, | Loop, %var0% { c_key := var%a_index% IniRead, c_lnr, %settings_path%, %language%, %c_key%0_0 Loop, %c_lnr% { c_keynr := a_index-1 c_skey := c_key . c_keynr IniRead, c_skey_temp, %settings_path%, %language%, %c_skey% If c_skey_temp <> %c_skey% := c_skey_temp } } ;/////////////////// ;Tray Menu Menu, Tray, NoStandard Menu, Tray, Add, %gui_menu_tray_0%, Change ;Change group Menu, Tray, Add, %gui_menu_tray_1%, Change_mode ;Change mode Menu, Tray, Add, Menu, Tray, Add, %gui_menu_tray_2%, Cancel ;E&xit Menu, Tray, Default, %gui_menu_tray_0% ;Change group ;/////////////////// ;Vars show_limit = 10 msg_max_nr := show_limit*5 start_date = %a_yyyy%%a_mm%%a_dd%%a_hour%%a_min%%a_sec% msg_lifetime := 1440 IniRead, multimode_off, %settings_path%, Default, multimode_off IniRead, Group, %settings_path%, Default, default_group_name IniRead, Password, %settings_path%, Default, default_group_password IniRead, Pass_del, %settings_path%, Default, default_deletion_password If Group = ERROR Group = If Password = ERROR Password = If Pass_del = ERROR Pass_del = ;The next few lines are oly important if you're gonna use the remote control server mode. ;By default in remote control server mode if a command was sent 24 hours or sooner before the script started, ;the script will not execute it. You can manipulate this behaviour by adding the ini file GroupMsg-settings.ini ;the "message_lifetime" key and changing it's value. You have to specify it's value in minutes. ;E.g. If you add this line: message_lifetime=50 to the ini, the script will only download and execute ;the commands that were sent 50 minutes or later before it started. ;If you're in a different time zone than the openpaste.org server (GMT+1), ;you should adjust this vlaue to your own time zone. IniRead, temp_msg_lifetime, %settings_path%, Default, message_lifetime If (temp_msg_lifetime <> "ERROR" AND temp_msg_lifetime <> "") { msg_lifetime := temp_msg_lifetime ;/////////////////// ;Command line switches v_0 = %0% v_1 = %1% v_2 = %2% v_3 = %3% v_4 = %4% var = listen If (v_1 = var AND v_2 = "") { remote_control = 1 Goto, Account_GUI } Else if (v_1 = var AND v_2 <> "") { remote_control = 1 Group := v_2 if v_3 { Password := v_3 if v_4 { Pass_del := v_4 Goto, MainGUI } Goto, Account_GUI } Goto, Account_GUI } ;/////////////////// ;Looking for settings in ini file } ;Selecting operation mode Mode: Menu, Tray, Icon, * IniRead, gmrc_mode, %settings_path%, Default, mode If (gmrc_mode = 0 AND gmrc_mode <> "" AND modechanger <> 1) { remote_control = 0 Goto, Account_GUI } Else if (gmrc_mode = 1 AND gmrc_mode <> "" AND modechanger <> 1) { remote_control = 1 Goto, Account_GUI } Else ;GUI for selecting operation mode (Group messaging GUi/Remote control) { Gui, 1:Destroy Gui, Add, Button, gmsg_or_rmt vchoose_msg w300, %gui_mode_1% ;&Group messenger/remote control client Gui, Add, Button, gmsg_or_rmt w300, %gui_mode_2% ;&Remote control server Gui, Show, Autosize, %gui_mode_0% ;You want to use the... return } Msg_or_rmt: If a_guicontrol = choose_msg remote_control = 0 Else remote_control = 1 Gui, Destroy ;/////////////////// ;Group name and password query Account_GUI: If remote_control = 1 { Gui, Add, Text,, %gui_account_2% ;Group Gui, Add, Edit, w180 vGroup x, %Group% Gui, Add, Text, x, %gui_account_3% ;Password Gui, Add, Edit, w180 Password vPassword x, %Password% Gui, Add, Text, x, %gui_account_4% ;Message deletion password Gui, Add, Edit, w180 Password vPass_del x, %Pass_del% Gui, Add, Button, Default gMainGUI vOK w70 x, %gui_account_5% ;O&K Gui, Add, Button, gCancel vCancel x+40 w70, %gui_account_6% ;E&xit Gui, Show, w200 h140, GroupMsg: %gui_account_0% ;Remote control Gui, -Caption +Border +MaximizeBox Gui, Show } else { Menu, Tray, Icon, * Gui, Add, Text,, %gui_account_2% ;Group Gui, Add, Edit, w180 vGroup x, %Group% Gui, Add, Text, x, %gui_account_3% ;Password Gui, Add, Edit, w180 Password vPassword x, %Password% Gui, Add, Button, Default gMainGUI vOK w70 x, %gui_account_5% ;O&K Gui, Add, Button, gCancel vCancel x+40 w70, %gui_account_6% ;E&xit Gui, Show, w200 h100, GroupMsg: %gui_account_1% ;Private group messaging Gui, -Caption +Border +MaximizeBox Gui, Show } return ;/////////////////// ;Building main GUI MainGUI: Gui, Submit, Nohide If (Password = "" OR Group = "") { MsgBox,48, %msg_error_4%, %msg_error_5% ;Cannot proceed, Blank Group name or password! return } If remote_control = 1 { If Pass_del = { MsgBox,48, %msg_error_4%, %msg_error_6% ;Cannot proceed, Blank message deletion password! return } } Gui, Destroy If remote_control <> 1 { ; BEGIN IF remote_control Gui, 1:+Owndialogs Gui, Add, ListView, vMSgList gMsgList r20 AltSubmit, %gui_main_1%|%gui_main_2%|%gui_main_3%|%gui_main_4% ;Date|ID|Nr|Read ;ListView Context menu Menu, LVContext, Add, %gui_menu_context_0%, SaveMsg ;Save this message to disk Menu, LVContext, Add, %gui_menu_context_1%, Del ;Delete this message Gui, Add, Text, yp+315, %gui_main_5%: ;Show the last: Gui, Add, Edit, x+10 gSetMaxMsg vMsg_max_nr yp-5 w50, Gui, Add, UpDown, xp+10 Wrap 0x80 Range1-9999, %msg_max_nr% Gui, Add, Text, x+10 yp+5, %gui_main_6% ;messages Gui, Add, Edit, vMsg_rcv w500 h300 y=0, Gui, Add, Button, Default gDL_messages w90, %gui_main_7% ;&Refresh list Gui, Add, Button, gSendMsg xp+100 w90, %gui_main_8% ;&Submit a message Gui, Add, Button, gChange xp+100 w90, %gui_main_9% ;&Change group Gui, Add, Button, gHelp xp+100 w90, %gui_main_10% ;He&lp Gui, Add, Button, gCancel xp+100 w90, %gui_main_11% ;E&xit Gui, Add, StatusBar,, Gui, Show, Autosize, %gui_main_0%: %Group% ;Current group: %Group% Gui, Font, s18 w600, Verdana } ; END IF remote_control ; ENCRYPTING group name and passwords If remote_control = 1 { DelPass := RC4txt2hex(Pass_del, Pass_del) DelPass := SubStr(DelPass, 1, 15) } Send_Group := RC4txt2hex(Group, Group) Send_Group := SubStr(Send_Group, 1, 15) LockPass := RC4txt2hex(Password, Password) LockPass := SubStr(LockPass, 1, 15) ;/////////////////// ;Processing messages DL_messages: If remote_control <> 1 { ; BEGIN IF remote_control Gui, 1:Default SB_SetText(gui_main_12) ;("Connecting...") GuiControl, Disable, MsgList LV_Delete() } ; END IF remote_control If remote_control = 1 ; Menu, Tray, Icon, %A_ScriptFullPath%, 3 ;For the compile_ahkII compiled script Menu, Tray, Icon, shell32.dll, 14 ;For the non-compiled or ahk2exe compiled script on XP URL := "http://openpaste.org/en/search2/" POSTDATA := "search_author=" . Send_Group . "&advanced_search=0&action=Search&search_syntax=---&search_age_min=---&search_age_min_unit=---&search_age_max=---&search_age_max_unit=---&advanced_search=0" SetTimer, CheckError, -50000 ;If cannot connect in 50 s, ask what to do httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) SetTimer, CheckError, Off ;If successfully connected, turn off the timer Gosub, CheckError ;Check if the page is successfully loaded outputvar := html If remote_control <> 1 SB_SetText(gui_main_13) ;("Checking group...") ; COUNTING the pages (5 msgs/page) StringGetPos, var, outputvar,

var := SubStr(outputvar, var) StringGetPos, outputvarx, var,

var := SubStr(var, 1, outputvarx) IfInString, var, { first_page := outputvar } Loop ; PARSE the ids and put the links in "page" variables { If a_index <= 10 { ; Parsing method: from the first page it extracts the first 9 links. ; After that it loades the sites four by four starting from 10 ; (e.g. after 10 it loads 14, 18 after that, 22 after that etc.) ; and from each downloaded site it extracts the links to the next four pages ; (e.g. from 10 --> 11, 12, 13 14, from 14--> 15, 16, 17, 18 etc.) ; and it goes on until it's stopped by the limit stored in the "show_limit" variable ; There are 5 messages on one page. If a_index = 1 ; Start from the second page, cause page1 (if a_index=1 in page%a_index%) is the first page Continue StringGetPos, var2, var, page%a_index% := "http://openpaste.org" . SubStr(var, 1+10, var3-11) var := SubStr(var, var3) If page%a_index% = http://openpaste.org Break nr_of_pages := a_index If a_index = 10 { pnr = 10 URL := "http://openpaste.org/search2/author-" . Send_Group . "/page-10/" ;JAVITANI ALTALANOSABBRA httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL) VarSetCapacity(HTML,-1) outputvar := html ; CHECKING HOW MANY PAGES THERE ARE StringGetPos, var, outputvar,

var := SubStr(outputvar, var) StringGetPos, outputvarx, var,

var := SubStr(var, 1, outputvarx) StringGetPos, var2, var, var := SubStr(var, var2) Continue } } Else If a_index > %show_limit% Break Else if a_index > 10 { StringGetPos, var2, var,
page%a_index% := "http://openpaste.org" . SubStr(var, 1+10, var3-11) var := SubStr(var, var3) If page%a_index% = http://openpaste.org Break nr_of_pages := a_index If (a_index = pnr+4) { pnr += 4 URL := "http://openpaste.org/search2/author-" . Send_group . "/page-" . pnr . "/" ;JAVITANI ALTALANOSABBRA httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL) VarSetCapacity(HTML,-1) outputvar := html StringGetPos, var, outputvar,

var := SubStr(outputvar, var) StringGetPos, outputvarx, var,

var := SubStr(var, 1, outputvarx) StringGetPos, var2, var, var := SubStr(var, var2) Continue } } } If nr_of_pages < 10 ;This operation is only necessary, if only the first page is being processed (that is if the total nr of pages is less than 10) { IfInString, outputvar, ">>>
; Only if the first page contains an additional link to the next page nr_of_pages -= 1 ;Cause of the additional ahref which points to the next page } page_nr = 1 node_nr = 0 ;Loading the first page URL := "http://openpaste.org/en/search2/" POSTDATA := "search_author=" . Send_group . "&advanced_search=0&action=Search&search_syntax=---&search_age_min=---&search_age_min_unit=---&search_age_max=---&search_age_max_unit=---&advanced_search=0" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) outputvar := html If remote_control <> 1 SB_SetText(gui_main_14) ;("Loading messages...") Loop ;Parsing the first page, extracting dates and IDs { StringGetPos, var, outputvar,
If var = -1 ;If no more posts on this page jump to the next one { page_nr += 1 If page_nr > %nr_of_pages% Break next_page := page%page_nr% If next_page = Break URL := next_page httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL) VarSetCapacity(HTML,-1) outputvar := html Continue } Outputvar:= SubStr(outputvar, var) ;Extracting the next message StringGetPos, var2, outputvar,
StringGetPos, var3, outputvar, node_url%a_index% := SubStr(node%a_index%, 9+2, var-11) StringReplace, node_url%a_index%, node_url%a_index%, /en/, StringReplace, node_url%a_index%, node_url%a_index%, /, StringGetPos, var, node%a_index%, var3 := SubStr(node%a_index%, var) StringGetPos, var, var3, node_date%a_index% := SubStr(var3, 28, var-27) node_nr += 1 Outputvar:= SubStr(outputvar, var2) ;END of extracting date and id ;If the remote control mode is enabled, start processing the current msg if remote_control = 1 ;START looking in the current message for remote control commands { ;If current msg was sent before the program started, don't download it StringReplace, post_date, node_date%a_index%, -, ,All StringReplace, post_date, post_date, :, ,All StringReplace, post_date, post_date, %a_space%, ,All temp_start_date := start_date EnvSub, temp_start_date, %post_date%, hours If temp_start_date > %msg_lifetime% ;if the message is older than the specified (by default 24) hours, leave it Continue ;Downloading and decrypting the current msg LockPass := RC4txt2hex(Password, Password) LockPass := SubStr(LockPass, 1, 15) URL := "http://openpaste.org/en/secret/" . node_url%a_index% . "/" POSTDATA := "lock_pass=" . LockPass . "&action=unlock" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) outputvar := html StringGetPos, var, html, var := SubStr(var, 1, var2) var := RC4hex2txt(var,Password) ; END of decrypting the msg, now start looking for commands StringSplit, varx, var, `n var2 := varx1 If var2 = |Multi| ;If the first line is |Multi|, we've got a multiline command { If multimode_off = 1 ;If multi mode is off skip the messages that contain Multiline commands Continue IniRead, ahk_path, %settings_path%, Default, ahk_path If (ahk_path = "ERROR" OR ahk_path = "") { FileInstall, c:\AutoHotKey.exe, %A_ScriptDir%\AutoHotKey.exe ahk_path = %A_ScriptDir%\AutoHotKey.exe } ; Menu, Tray, Icon, %A_ScriptFullPath%, 2 ;For the compile_ahkII compiled script Menu, Tray, Icon, shell32.dll, 72 ;For the non-compiled or ahk2exe compiled script on XP FileDelete, %A_ScriptDir%\temp.ahk StringSplit, varx, var, `n Loop, %varx0% { ;START Loop If a_index = 1 Continue FileAppend, % varx%a_index% "`n", %A_ScriptDir%\temp.ahk } ;END Loop Run, %ahk_path% %A_ScriptDir%\temp.ahk return_value = (No returned value) multi_code = FileRead, multi_code, temp.ahk executed_code = Multiline code:`n`n%multi_code% Menu, Tray, Icon, * } ;END of if |Multi| else if var2 = |Single| ;If the first line is |Single|, we've got one or more single-line command { ; Menu, Tray, Icon, %A_ScriptFullPath%, 2 ;For the compile_ahkII compiled script Menu, Tray, Icon, shell32.dll, 72 ;For the non-compiled or ahk2exe compiled script StringSplit, varx, var, `n ;Split the message into rows each line contains one command executed_code = return_value = Loop, %varx0% { ;START Processing the message from line to line executing each command If a_index = 1 Continue StringSplit, vary, varx%a_index%, | var2 = Loop, %vary0% { ;START parsing and rebuilding the current command If vary%a_index% = _ var2 := var2 . "," Else var2 := var2 vary%a_index% . "," } ;END of Loop StringTrimRight, var2, var2, 1 return_value := return_value . "`n" . execute(var2) executed_code = %executed_code%`n%var2% } ;End of |Single| Loop Menu, Tray, Icon, * } ;END of If |Single| else ;If the first line is neither |Single| nor |Multi| this message doesnt contain any commands Continue ;DELETE the processed message to avoid double-execution URL := "http://openpaste.org/en/" . node_url%a_index% . "/" POSTDATA := "id_pbin=" . node_url%a_index% . "&secret_key=" . Delpass . "&action=Erase" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) ;SEND a response-message which includes the executed command, the return value and the current date and time(s) current_time = %a_yyyy%-%a_mm%-%a_dd% %a_hour%:%a_min%:%a_sec% Msg := "|" . msg_commands_2 . "|`n" . current_time . "`n" . msg_commands_0 . " " . return_value "`n`n" . msg_commands_1 . " " . executed_code Msg := RC4txt2hex(Msg,Password) Msg := uriEncode(Msg) URL := "http://openpaste.org/en/" POSTDATA := "url=&mail=&message=&syntax=text&hint=&code=" . uriEncode(Msg) . "&MAX_FILE_SIZE=102400&file_upload=0&code_file=&author=" . Send_Group . "&action=Submit&submit_button=Submit&email=&web=&desc=&secret_key=" . DelPass . "×tamp=1236575804&taction= ANwgTN3UjNzIT*fXv*&lock_pass=" . LockPass . "&lock_hidden=1&lock_secret=1" ;&lock_pass=&lock_hidden=0&lock_secret=0×tamp=1236577067&taction= wN2AzN3UjNzIT*fXv*&" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) } ;END if remote_control and processing the current msg If remote_control <> 1 { ;Update the GUI's list of downloaded messages IniRead, IsRead, %cache_path%, IsDownloaded, % node_url%a_index% If IsRead <> + LV_Add("", node_date%a_index%, node_url%a_index%, node_nr) Else LV_Add("", node_date%a_index%, node_url%a_index%, node_nr, "+") LV_ModifyCol() SB_SetText(gui_main_14 . " " . node_nr . " " . gui_main_15) ;("Loading messages... " . node_nr . " messages loaded") } If node_nr = %msg_max_nr% ;If the message download limit is reached, stop { Break } } ;END OF Loop, end of downloading messages If remote_control <> 1 ;If GUI mode is active stop and display the messages { LV_GetText(RowText, 1, 1) If RowText = GuiControl,, Msg_rcv, %gui_main_18% ;No messages in the group yet . . . SB_SetText(gui_main_16 . " " . node_nr . " " . gui_main_15) ;("Done: " . node_nr . " messages loaded") GuiControl, Enable, MsgList Gui, 1:Show } Else ;If remote_control mode is active, don't stop, contniue looking for new messages { Sleep, 5000 Goto, DL_messages } return ;END of remote control part ;Only functions and GUI-mode related stuff below ;/////////////////// ;MainGui--> Listview MsgList: ;If a list item is left-clicked, the message is downloaded and decrypted to the right panel if A_GuiEvent = Normal { LV_GetText(RowText, A_EventInfo, 2) ; Get the text from the row's first field. LV_GetText(RowDate, A_EventInfo, 1) If RowText = ID return GuiControl,, Msg_rcv, %gui_main_17% ;Loading . . . ; ; LV_GetText(IsRead, A_EventInfo, 4) ;DEBUG IniRead, EnableCache, %settings_path%, Default, enable_cache var = IsRead = If EnableCache = 1 { IniRead, IsRead, %cache_path%, IsDownloaded, %RowText% IniRead, var, %cache_path%, MsgCache, %RowText% } If (IsRead <> "+" OR var = "" OR var = "ERROR") { LockPass := RC4txt2hex(Password, Password) LockPass := SubStr(LockPass, 1, 15) LV_Modify(A_EventInfo, "Col4", "+") URL := "http://openpaste.org/en/secret/" . RowText . "/" POSTDATA := "lock_pass=" . LockPass . "&action=unlock" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) outputvar := html StringGetPos, var, html, var := SubStr(var, 1, var2) If EnableCache = 1 { IniWrite, %var%, %cache_path%, MsgCache, %RowText% IniWrite, +, %cache_path%, IsDownloaded, %RowText% } } var := RC4hex2txt(var,Password) GuiControl,, Msg_rcv, %var% } ;END If else if A_GuiEvent = RightClick ;If a list item is right-clicked, it show a context menu, with an option to delete the message { if A_GuiControl <> MSgList return LV_GetText(RowText, A_EventInfo, 2) If RowText = ID return post_id := RowText Menu, LVcontext, Show, %A_GuiX%, %A_GuiY% } ;END else if return ;/////////////////// ;GUI for sending messages SendMsg: Gui 2:+owner1 Gui 2:+Owndialogs Gui 1:+Disabled Gui, 2:Add, Text,, %gui_sending_1% ;Password for later deletion: (See: Help) Gui, 2:Add, Edit, vPass_del w150, Gui, 2:Add, Text,, %gui_sending_2% ;Message by: (Optional. If you're sending a command leave it blank!) Gui, 2:Add, Edit, vAuthor w150, Gui, 2:Add, Text,, %gui_sending_3% ;Message: Gui, 2:Add, Edit, vMsg w400 h200, Gui, 2:Add, Button, gSubmit vOK w70, %gui_sending_4% ;Submit Gui, 2:Add, Button, g2Cancel vBack xp+80 w70, %gui_sending_5% ;Go back Gui, 2:Add, Button, Default g2Help vHelp xp+80 w70, %gui_sending_6% ;Help Gui, 2:Show, Autosize, %gui_sending_0% %Group% ;Submit a message to this group: %Group% return ;/////////////////// ;Sending messages Submit: Pass_del = DelPass = Gui, 2:Submit, Nohide If (Msg = "" OR Pass_del = "") { MsgBox, 64, %msg_error_2%, %msg_error_3% ;Error!, The message or the deletion password field is blank! Return } If Author <> Msg = Sent by: %Author%`n`n%Msg% GuiControl,, OK, %gui_sending_8% ;Sending... GuiControl, Disable, OK ;Encrypting the password, group name, message and deletion key Send_Group := RC4txt2hex(Group, Group) Send_Group := SubStr(Send_Group, 1, 15) LockPass := RC4txt2hex(Password, Password) LockPass := SubStr(LockPass, 1, 15) DelPass := RC4txt2hex(Pass_del, Pass_del) DelPass := SubStr(DelPass, 1, 15) Msg := RC4txt2hex(Msg,Password) Msg := uriEncode(Msg) ;Sending the message URL := "http://openpaste.org/en/" POSTDATA := "url=&mail=&message=&syntax=text&hint=&code=" . uriEncode(Msg) . "&MAX_FILE_SIZE=102400&file_upload=0&code_file=&author=" . Send_Group . "&action=Submit&submit_button=Submit&email=&web=&desc=&secret_key=" . DelPass . "×tamp=1236575804&taction= ANwgTN3UjNzIT*fXv*&lock_pass=" . LockPass . "&lock_hidden=1&lock_secret=1" ;&lock_pass=&lock_hidden=0&lock_secret=0×tamp=1236577067&taction= wN2AzN3UjNzIT*fXv*&" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) ;Message sent, extracting the ID of the new message StringGetPos, var, html, StringTrimLeft, var, var, var3+1 StringGetPos, var2, var, var := SubStr(var, 1, var2) ;Decrypting and displaying the message var := RC4hex2txt(var,Password) Gui, 2:destroy Gui 2:+owner1 Gui 2:+Owndialogs Gui, 2:Add, Edit, w400 h200 ReadOnly,% "[" . gui_sending_9 . "]`n" . new_id . "`n[" . gui_sending_10 . "]`n" var Gui, 2:Add, Button, gBack w70 Default, %gui_sending_12% ;OK Gui, 2:Add, Button, gDel w70 xp+80, %gui_sending_13% ;Delete Gui, 2:Show,, %gui_sending_11% ;Message sent Return Back: Gui, 2:Destroy Gui 1:-Disabled Gui, 1:Show Goto, DL_messages return 2GuiClose: 2Cancel: Gui, 2:Destroy Gui 1:-Disabled Gui, 1:Show return ;/////////////////// ;"Submit a message" GUI--> Help ;Text content of the Help gui's edit control 2Help: help2_content = (Join Password for later deletion:`nIf you want to delete the message later, you need to specify a password. If you leave it blank, the message will be automatically deleted 6 months after you submit it. If you want to send a command, you must specify the same password as you did for the remote control server. `n`nMessage by:`nHere you can specify a name, which will be inserted in the first line of the message after the phrase "Sent by:". If you leave it blank, the message will be submitted without the "Sent by" line. IMPORTANT: If you want to send a command, you must leave this field BLANK!`n`n Message:`nYou can type your message here. For info about sending commands see the main window's Help. ) ;END of the text content of the 2Help gui's edit control Gui, 3:+owner2 Gui, 2:+Disabled Gui, 3:Add, Edit, w300 h200 ReadOnly, %help2_content% Gui, 3:Add, Button, Default w70 g3Back, %gui_sending_help_1% ;Back Gui, 3:Show, Autosize, %gui_sending_help_0% ;Help return 3GuiClose: 3Back: Gui, 3:Destroy Gui, 2:-Disabled Gui, 2:Show return ;/////////////////// ;Deleting messages Del: ;Context menu: Saving a file Pass_del = DelPass = ;Retrieving and encrypting the deletion password Gui, 1:+Owndialogs Inputbox, Pass_del, %gui_deleting_0%, %gui_deleting_1%, HIDE, 200, 100 ;Password for deletion, Enter the deletion password If ErrorLevel = 1 return DelPass := RC4txt2hex(Pass_del, Pass_del) DelPass := SubStr(DelPass, 1, 15) URL := "http://openpaste.org/en/" . post_id . "/" ;the current del url POSTDATA := "id_pbin=" . post_id . "&secret_key=" . Delpass . "&action=Erase" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) Goto, DL_messages return ;/////////////////// ;Saving messages SaveMsg: ;Context menu: Saving a file Gui, 1:+Owndialogs FileSelectFile, save_msg, S18, %A_Scriptdir%, %gui_saving_0%, %gui_saving_2% (*.txt) ;Select a folder to save the file to, Text files (*.txt) If save_msg = return SB_SetText(gui_saving_1) ;("Saving message...") LockPass := RC4txt2hex(Password, Password) LockPass := SubStr(LockPass, 1, 15) URL := "http://openpaste.org/en/secret/" . RowText . "/" POSTDATA := "lock_pass=" . LockPass . "&action=unlock" httpAgent := "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6pre) Gecko/2009011606 Firefox/3.1" httpQuery(HTML:="",URL,POSTDATA) VarSetCapacity(HTML,-1) outputvar := html StringGetPos, var, html, var := SubStr(var, 1, var2) var := RC4hex2txt(var,Password) FileDelete, %save_msg% FileAppend, %gui_saving_5% %RowDate%`n%var%, %save_msg% SB_SetText(gui_saving_4 . " " . save_msg . " - " . node_nr . " " . gui_main_15) ;("Message saved: " . save_msg . " - " . node_nr . " messages loaded") save_msg = return ;/////////////////// ;Main GUI Stuff ;/////////////////// Help: ;Main GUI--> Help ;Text content of the Help gui's edit control help1_content = (Join Table of contents:`n`nGeneral`nGroup messenger mode`n - General`n - Show the last N messages`n - Refresh list`n - Submit a message`n - Change group`n - Deleting a message`n`n Remote Control mode`n - General`n - Sending commands`n - Single line commands`n - Multiline commands`n - Receiving commands`n`n`n`nGroup messenger mode:`n`nGeneral:`n This mode is for sending messages to someone or a group and reading the ones others sent to you OR sending remote control commands to another app in remote control mode (more about this in the remote control section). You are using this mode now.`n`nShow the last N messages:`nYou can set the number of messages to be downloaded and shown. It shows the latest messages first. After you set the number you have to refresh the list with the Refresh list button.`n`nRefresh list:`nIf you'd like to check if there are any new messages, or you changed the number of messages to be shown, you can use this button.`n`nSubmit a message:`nIf you want to send a message to a person or a group or you want to send remote control commands, you can do it here. (more info in the Help section of the "Submit a message" window)`n`nChange group:`nIf you want to check the messages of another group (in which case you'll have to change the group name and the password too) or read a private message (coded with a private password, but sent to this group in this case you'll only have to change the password) you can do it here.`n`nDeleting a message:`nYou can permanently delete a message (it will not be shown on the list of any group member anymore) by right clicking on it in the list, and choosing Delete this message. IMPORTANT: If you want to delete a message you have to know the deletion password. Deletion passwords are set when you send the message to the group. If you don't remember the password, the message will automatically be deleted 6 months after you posted it.`n`n`nRemote control mode:`n`n General:`nFor the remote control thing to work you need two of this script: One in group messenger mode (remote control client, which sends the commands) and one in remote control server mode (a remote control server, which receives and executes the commands). You can send commands in group messanger mode. Further info below. If you start the script in remote control server mode (no GUI), the script will automatically looking for messages containing special commands. Once it has a message that contains a valid command, it executes it, and continues looking for further messages. You can activate this mode by choosing the "Remote control server" button when the program starts or by running the script with the comand line parameter "listen" optionally followed by the group name, group password, and message deletion password. Only those messages that are not older than 24 hours will be processed. E.g. If the script started listening on 2009.01.02. 15:23:10, only the messages sent after 2009.01.01. 15:23:10 will be processed for commands.`n`nSending commands:`nIf you want to send commands to a remote control server, you'll need to start the script in group messenger mode, then you'll have to select "Submit a message", and type the command in the message field. IMPORTANT: If you're sending a command, you must leave the Message by field Blank and you must specify a Deletion password in the topmost field! The Deletion password you type when sending a command and the Deltion password you specified when you launched the remote control server must be the same!n`nSingle line command:`nThe first row of the message must be "|Single|" without the quotation marks. The other rows can contain the AHK command in the following syntax: "Command|Parameter1|Parameter2|Parameter3|Etc." without the quotation marks. (Command and parameters are separated by pipe | characters.) By those command, when you have to specify an Output variable, you just leave the output variable out. You can omit a parameter by typing a "_" instead. E.g.: The AHK command: "Run, explorer.exe,, Hide" where you omit the working dir will look like this: "Run|explorer.exe|_|Hide" without quotation marks. As a last parameter by the Run command you can specify an OutputVarPID. This, being an output variable too, must NOT be included in the command in any case, likewise by the other commands. You can send more than one command at a time, you just have to write every new command to a new row. After the execution of the commands, the remote control server will send a message containing the current date, the executed commands and the return values of the commands. For the list of AHK commands see: http://www.autohotkey.com/`n`n Multiline commands:`nThe first row must be "|Multi|" without quotation marks. This method takes all the text (starting from the second row) you sent from a remote computer, writes it out to an .ahk file and runs it with autohotkey.exe. This way you can edit your script in your favourite editor, then copypaste it to the message and send it to execute. For the list of AHK commands see: http://www.autohotkey.com/`n`n Examples:`nA message containing four single line commands:`n`n|Single|`nRun|mspaint.exe`nFileDelete|c:\temp\temp.txt`n FileCopy|c:\temp.txt|h:\docs`nRun|cmd /k ipconfig/all`n`nA message containing a multiline command:`n`n|Multi|`nvar = 0`nIf var=0`nMsgBox, var = 0`nElse`nMsgBox, var != 0`nGosub, Subroutine`nMsgBox, Skip`nSubroutine:`nMsgBox, Sub`nreturn`n`n Receiving commands:`n`nIf you want to control your PC with another copy of this script remotely you have to start this app in remote control server mode. This way, until stopped it constantly looks for new commands and executes them. Some AHK commands such as MsgBox cannot be executed in Single line command mode, because they cause the script to stop. ) ;END of the text content of the Help GUI's edit control Gui, 4:+owner1 Gui, 1:+Disabled Gui, 4:Add, Tab2, w320 h390, %gui_sending_help_0%|%gui_main_19% Gui, 4:Add, Edit, w300 h300 ReadOnly, %help1_content% Gui, 4:Add, Button, Default w70 y+20 g4Back, %gui_sending_help_1% ;Back Gui, 4:Tab, About Gui, 4:Add, Text, y+20, GroupMsg v1.1.1 | Created by Gahks | 2009 Gui, 4:Add, Text, cBlue g4LaunchWebsite, http://www.autohotkey.net/~gahks Gui, 4:Add, Text,, %gui_main_20% Gui, 4:Add, Text, cBlue g4LaunchForum, http://www.autohotkey.com/forum/topic41997.html Gui, 4:Show, Autosize, %gui_sending_help_0% ;Help return 4GuiClose: 4Back: Gui, 4:Destroy Gui, 1:-Disabled Gui, 1:Show return 4LaunchForum: Run, http://www.autohotkey.com/forum/topic41997.html return 4LaunchWebsite: Run, http://www.autohotkey.net/~gahks return Change: ;Change group Gui, 1:Destroy Goto, Account_GUI return Change_mode: Gui, 1:Destroy modechanger = 1 Goto, Mode return Cancel: ;Exit GuiClose: ExitApp Return SetMaxMsg: ;Message download limit settings Gui, 1:Submit, Nohide mod := Mod(msg_max_nr, 5) msg_max_nr_c := msg_max_nr/5 StringSplit, msg_max_nr_c, msg_max_nr_c, . If mod <> 0 show_limit := msg_max_nr_c1+1 Else show_limit := msg_max_nr_c1 return CheckError: ;MsgBox, %html% ;DEBUG If html = { MsgBox, 68, %msg_error_7%, %msg_error_8% ;Connection error!, The couldn't connect to the internet. Would you like to try again? IfMsgBox, Yes { Run, %a_scriptfullpath% ExitApp } Else ExitApp } return ;/////////////////// ;Functions and includes uriEncode(str) { ; v 0.3 / (w) 24.06.2008 by derRaphael / zLib-Style release b_Format := A_FormatInteger data := "" SetFormat,Integer,H Loop,Parse,str if ((Asc(A_LoopField)>0x7f) || (Asc(A_LoopField)<0x30) || (asc(A_LoopField)=0x3d)) data .= "%" . ((StrLen(c:=SubStr(ASC(A_LoopField),3))<2) ? "0" . c : c) Else data .= A_LoopField SetFormat,Integer,%b_format% return data } Dec_XML(str) { ;Decode xml required characters, as well as numeric character references Loop If RegexMatch(str, "S)(&#(\d+);)", dec) ; matches: &#[dec]; StringReplace, str, str, %dec1%, % Chr(dec2), All Else If RegexMatch(str, "Si)(&#x([\da-f]+);)", hex) ; matches: &#x[hex]; StringReplace, str, str, %hex1%, % Chr("0x" . hex2), All Else Break StringReplace, str, str,  , %A_Space%, All StringReplace, str, str, ", ", All ;required predefined character entities &"<'> StringReplace, str, str, ', ', All StringReplace, str, str, <, <, All StringReplace, str, str, >, >, All StringReplace, str, str, &, &, All ;do this last so str doesn't resolve to other entities return, str } #include rc4.ahk ; by Laszlo http://www.autohotkey.com/forum/topic6804.html #include httpQUERY.ahk ; v0.3.4 (w) Sep, 8 2008 by Heresy & derRaphael / zLib-Style release #include dynamic.ahk ; by Jonny http://www.autohotkey.com/forum/topic3332.html