Leaderboard
Popular Content
Showing content with the highest reputation on 01/10/2017 in all areas
-
Hi! I wrote an UDF that can simplify the way you can control Telegram Bot with AutoIt. If you don't know what is a Telegram Bot, maybe you should read their official website here. All about this UDF is on my GitHub: what is, how it work, how to use and also a Test.au3 to see the script in action. But... let's talk about this UDF. What is: It's an UDF that contain functions to control a Telegram Bot. Send messages, photo, video, stickers, wait for incoming messages and answer to them. How it works: Insert you Token given from BotFather, initialize your bot with _InitBot() function and... you're ready! All functions are commented: You will find a description of what it does, an explanation for every argument that function has need and what it return. This is the test script, that initialize your bot, run all functions and write the return value. #include "Telegram UDF.au3" $ChatID = "Your_Chat_ID_For_Test" _InitBot("Bot_ID","Bot_Token") ConsoleWrite("Test _GetUpdates -> " & @TAB & _GetUpdates() & @CRLF) ConsoleWrite("Test _GetMe -> " & @TAB & _GetMe() & @CRLF) ConsoleWrite("Test _SendMsg -> " & @TAB & _SendMsg($ChatID,"Test _SendMsg") & @CRLF) ConsoleWrite("Test _ForwardMsg -> " & @TAB & _ForwardMsg($ChatID,$ChatID,'MsgID') & @CRLF) ConsoleWrite("Test _SendPhoto -> " & @TAB & _SendPhoto($ChatID,"C:\image.jpg","Test _SendPhoto") & @CRLF) ConsoleWrite("Test _SendVideo -> " & @TAB & _SendVideo($ChatID,"C:\video.mp4","Test _SendVideo") & @CRLF) ConsoleWrite("Test _SendAudio -> " & @TAB & _SendAudio($ChatID,"C:\audio.mp3","Test _SendAudio") & @CRLF) ConsoleWrite("Test _SendDocument -> " & @TAB & _SendDocument($ChatID,"C:\document.txt","Test _SendDocument") & @CRLF) ConsoleWrite("Test _SendVoice -> " & @TAB & _SendVoice($ChatID,"C:\voice.ogg","Test _SendVoice") & @CRLF) ConsoleWrite("Test _SendSticker -> " & @TAB & _SendSticker($ChatID,"C:\sticker.webp") & @CRLF) ConsoleWrite("Test _SendLocation -> " & @TAB & _SendLocation($ChatID,"74.808889","-42.275391") & @CRLF) ConsoleWrite("Test _SendContact -> " & @TAB & _SendContact($ChatID,"0123456789","Josh") & @CRLF) ConsoleWrite("Test _SendChatAction -> " & @TAB & _SendChatAction($ChatID,"typing") & @CRLF) ConsoleWrite("Test _GetUserProfilePhotos -> " & @TAB & _GetUserProfilePhotos($ChatID) & @CRLF) ConsoleWrite("Test _GetChat -> " & @TAB & _GetChat($ChatID) & @CRLF) While 1 $msgData = _Polling() _SendMsg($msgData[2],$msgData[3]) WEnd Last part of the script (While cycle) use Polling function to put the script in a wait-state for incoming messages: _Polling() function return an array ($msgData in this case) that contain information about the received message (for example, $msgData[2] is the Chat ID of the user that send the message, important to send a reply. See GitHub page for other info. So, finally, here you can find and download the library -> https://github.com/xLinkOut/telegram-udf-autoit <- UPDATE: Thanks to @mLipok to added my Telegram UDF on AutoItScript Wiki! UPDATE 2: Functions that send files to Telegram Servers (photos, videos..) don't need anymore cURL executable file. Thanks to @Jos that suggested how to use WinHttp UDF by trancexx. If you have question, bug report or anything else just contact me or reply to this Thread Don't forget to follow me on GitHub for future updates. Bye!2 points
-
WMI date codes look like this: '20170101091020.000000-500' StringRegExpReplace($str, '(....)(..)(..)(..)(..)(..).*', '$1/$2/$3 - $4:$5:$6') What we want is the first 14 numbers. One dot . represents one character. Put braces around the dot (.) becomes a capture group. (....) is capturing 4 characters in the first group. (..) is capturing 2 characters in the second group. and so on... until all 14 characters are captured in 6 groups. group 1: Year group 2: Month group 3: Day group 4: Hour group 5: Minutes group 6: Seconds $1 is the first group (Year) / is the date divider You can figure out the rest. So basically, THIS regex is grouping 14 numbers and formats them into something more friendly. If you wish, you can change the order of the format by rearranging $1, $2 and $3 to like an American standard date: $2/$3/$1 It's better to use the original date format, when sorting dates.1 point
-
rootx, Try this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" $Form1 = GUICreate("Form1", 615, 437, 192, 124) $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($idListview, $LVS_EX_FULLROWSELECT) $idButton = GUICtrlCreateButton("Value?", 75, 170, 70, 20) $idItem1 = GUICtrlCreateListViewItem("item1|col22|col23", $idListview) $idItem2 = GUICtrlCreateListViewItem("item2|col12|col13", $idListview) $idItem3 = GUICtrlCreateListViewItem("item3|col32|col33", $idListview) $idItem4 = GUICtrlCreateListViewItem("item4|col32|col33", $idListview) $idItem5 = GUICtrlCreateListViewItem("item5|col32|col33", $idListview) $idItem9 = GUICtrlCreateListViewItem("item6|col32|col33", $idListview) $aLVArray = _GUIListViewEx_ReadToArray($idListview) $iLV_Index = _GUIListViewEx_Init($idListview, $aLVArray, 0, 0, True, 32 + 512) ; Set required colours for ListView elements - change = pink field when selected Local $aSelCol[4] = [Default, Default, Default, "0xFFCCCC"] _GUIListViewEx_SetDefColours($iLV_Index, $aSelCol) _GUIListViewEx_MsgRegister(False) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) ; Struct = $tagNMHDR and "int Item;int SubItem" from $tagNMLISTVIEW Local $tStruct = DllStructCreate("hwnd;uint_ptr;int_ptr;int;int", $lParam) If Not @error Then Local $hLV = DllStructGetData($tStruct, 1) Local $iItem = DllStructGetData($tStruct, 4) Local $iSubItem = DllStructGetData($tStruct, 5) Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) If $iCode = $NM_CLICK Then $sText = _GUICtrlListView_GetItemText($hLV, $iItem, $iSubItem) ConsoleWrite($sText & @CRLF) EndIf EndIf $iRet = _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) Return $iRet EndFunc M231 point
-
If you want to do this, I suggest you do it through the API of the site you're trying to pull data from. Navigating using a webpage is going to be complicated, and a lot of these sites will let you directly access your messages through an API. For example, a quick Google search gave me this documentation for Facebook and Facebook Messenger.1 point
-
Event logs putting the information into 2d array
larksp reacted to anthonyjr2 for a topic
If you need some help with regex, and don't mind some hands-on learning, https://regexone.com/ is a good website that I've personally used. It covers the basics and also allows you to go more in depth if you desire.1 point -
Applying styles to RichEdit
AndreyS reacted to InunoTaishou for a topic
@orbs You can change the styles of windows after a window has been created (richedit is a window) and you can change the styles of any control after it's been created too Here's how you would add a the $WS_EX_TRANSPARENT to your richedit control #include <GuiRichEdit.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> $hGUI = GUICreate("RichEdit Style", 500, 500, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "Test", 20,40,460,400) GUISetState(@SW_SHOW, $hGUI) MsgBox("", "", "Default") _WinAPI_SetWindowLong($hRichEdit, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hRichEdit, $GWL_EXSTYLE), $WS_EX_TRANSPARENT)) MsgBox("", "", "WS_EX_TRANSPARENT") If you wanted to change the Style property, not ExStyle, you use $GWL_STYLE.1 point -
#include 'array.au3' #RequireAdmin Opt('MustDeclareVars', 1) ; Local $rtn = _WMIC_GET('Win32_NTLogEvent Where EventCode="6008"', 'ComputerName,EventCode,EventIdentifier,TimeGenerated') If IsArray($rtn) Then _ArrayDisplay($rtn) Else MsgBox(0, '', $rtn) EndIf Exit ; Func _WMIC_GET($sClass, $sProperty) Local $pid = Run('WMIC /NAMESPACE:\\root\CIMV2 PATH ' & $sClass & ' GET ' & $sProperty & ' /format:LIST', '', @SW_HIDE, 2) If @error Or Not $pid Then Return -1 Local $s = '' ; Do Sleep(10) $s &= StdoutRead($pid) Until @error ; $s = StringReplace($s, @CRLF, '') $s = StringStripWS($s, 7) If StringLen($s) = 0 Then Return -2; no data ; Local $a = StringSplit($s, @CR) Local $array[101][5] = [['Log No', 'ComputerName','EventCode','EventIdentifier','TimeGenerated (UTC)']] Local $x, $icount = 0, $n = 0 ; For $i = 1 To $a[0] Step 4 $n += 1 $icount += 1 $array[$n][0] = $icount For $j = 0 To 3 $x = StringSplit($a[$i + $j], '=') $array[$n][$j + 1] = $x[2] If $j = 3 Then; <- format DateTime $array[$n][$j + 1] = StringRegExpReplace($array[$n][$j + 1], '(....)(..)(..)(..)(..)(..).*', '$1/$2/$3 - $4:$5:$6') EndIf Next If $n = 10 Then; <- number of records to get ExitLoop EndIf Next ReDim $array[$n + 1][5] Return $array EndFunc ;1 point
-
Noob need help with script
Hamminnamm reacted to water for a topic
Welcome to AutoIt and the forum! Seems you missed to read the forum rules on your way in. Game automation of any kind is not permitted here. That's why you won't get any help on this subject. Hope to see you with a regitimate question quite soon1 point -
Seems this attribute still istn't used by MS. How to record the last logoff date/time is described here: https://www.ldapsoft.com/adlogoffreport.html Edit: And it does not get replicated. This means you need to query all DCs to get the "real" lastlogoff date/time.1 point
-
Add "lastLogoff" to this line in function _AD_GetObjectProperties: If $sPropertyName = "pwdLastSet" Or $sPropertyName = "accountExpires" Or $sPropertyName = "lastLogonTimestamp" Or $sPropertyName = "badPasswordTime" Or $sPropertyName = "lastLogon" Or $sPropertyName = "lockoutTime" Or $sPropertyName = "lastLogoff" Then ; "lastLogoff" already added at the end of the line1 point
-
You mean something like this? #include <Excel.au3> Local $Column Local $oExcel = _Excel_Open(False) Local $oWorkbook = _Excel_BookOpen($oExcel, "C:\Temp\Test.xls") $Lines = $oWorkbook.ActiveSheet.UsedRange.Rows.Count If $Lines <= 1 Then MsgBox(0, '', 'Blank cell.') Else For $k = $Lines To 2 Step - 1 $Column = _Excel_RangeRead($oWorkbook, Default, "A" & $k) If $Column = '' Then ; If A2 is blank MsgBox(0, '', 'Blank cell.') Else MsgBox(0, '', $Column) _Excel_RangeDelete($oWorkbook.ActiveSheet, $k & ":" & $k, 1) Endif Next EndIf _Excel_Close($oExcel)1 point
-
Do you know where it hangs? There are several possible reasons like working dirs or some incorrect macro use like @scriptdir or hard coded paths. It may be anything - we need more information.1 point