Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/04/2018 in all areas

  1. 1. Description. oAuth 2.0 is security system implemented by Google a few years ago. You are able to connect into your Google accounts and manage documents. In this UDF i show you how to pass first authorization process., this allow you to automate most of functions using API interface. 2. Requirements. Google account. oAuth.au3 Download 3. Possibilities ;============================================================================================================ ; Date: 2018-02-10, 14:21 ; ; Description: UDF for authorize your app with oAuth 2.0 Google. ; ; Function(s): ; oAuth2GetAuthorizationCode() -> Get Code for "grant". ; oAuth2GetAccessToken() -> Get "access_token" and "refresh_token" first time. ; oAuth2RefreshAccessToken() -> Get current "access_token" using "refresh_token". ; ; Author(s): Ascer ;============================================================================================================ 4. Enable your Google API. 4.1. Video Tutorial not mine! YouTube 4.2 Screenshots from authorization process (Polish language) Go to https://console.developers.google.com/apis/dashboard and accept current rules. Next create an new project Enter name of you new project and click Create Google will working now, please wait until finish. Next go to enable your API interface, we make if for Google Take "Gmail" in search input and after click in found result. Click Enable interface, Google will working now. Create your login credentials Select Windows Interface (combobox), User credentials (radio) and click button what is need bla bla Type name of a new client id for oAuth 2.0 and click Create a new Client ID. Next configure screen aplication, type some name and click Next. Google will working now. Last step on this website is download source with your credentials in *Json format. Now you received a file named client_id.json, it's how it look in Sublime Text: 5. Coding. Now we need to call a some function to get access code. #include <oAuth.au3> Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sRedirectUri = "http://localhost" oAuth2GetAuthorizationCode($sClientId, $sRedirectUri) Function will execute default browser for ask you to permission. Next Google ask you to permission for access to your personal details by application Autoit Now you can thing is something wrong but all is ok, you need to copy all after code= . It your access code. Let's now ask Google about our Access Token and Refresh Token #include <oAuth.au3> Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sClientSecret = "cWalvFr3WxiE6cjUkdmKEPo8" Local $sAuthorizationCode = "4/AAAPXJOZ-Tz0s6mrx7JbV6nthXSfcxaszFh_aH0azVqHkSHkfiwE8uamcabn4eMbEWg1eAuUw7AU0PQ0XeWUFRo#" Local $sRedirectUri = "http://localhost" Local $aRet = oAuth2GetAccessToken($sClientId, $sClientSecret, $sAuthorizationCode, $sRedirectUri) If Ubound($aRet) <> 4 then ConsoleWrite("+++ Something wrong with reading ResponseText." & @CRLF) Exit EndIf ConsoleWrite("Successfully received data from Google." & @CRLF) ConsoleWrite("access_token: " & $aRet[0] & @CRLF) ConsoleWrite("expires_in: " & $aRet[1] & @CRLF) ConsoleWrite("refresh_token: " & $aRet[2] & @CRLF) ConsoleWrite("token_type: " & $aRet[3] & @CRLF) Important! When you received error 400 and output says: Invalid grant it means that your previous generated access_code lost validity and you need to generate new calling previus code. When everything is fine you should received a 4 informations about your: access_token, expires_in, refresh_token and token_type. Access_Token time is a little short so you need to know fuction possible to refresh it (tell Google that he should generate a new Token for you) #include <oAuth.au3> Local $sRefreshToken = "1/ba8JpW7TjQH3-UI1BvPaXhSf-oTQ4BmZAbBfhcKgKfY" Local $sClientId = "167204758184-vpeues0uk6b0g4jrnv0ipq5fapoig2v8.apps.googleusercontent.com" Local $sClientSecret = "cWalvFr3WxiE6cjUkdmKEPo8" Local $sRedirectUri = "http://localhost" Local $aRet = oAuth2RefreshAccessToken($sRefreshToken, $sClientId, $sClientSecret) If Ubound($aRet) <> 3 then ConsoleWrite("+++ Something wrong with reading ResponseText." & @CRLF) Exit EndIf ConsoleWrite("Successfully received data from Google." & @CRLF) ConsoleWrite("access_token: " & $aRet[0] & @CRLF) ConsoleWrite("expires_in: " & $aRet[1] & @CRLF) ConsoleWrite("token_type: " & $aRet[2] & @CRLF) 6. Finish words If you followed all this above steps im sure that you received all informations required for coding your Google API (Gmail, Dropbox, YouTube, Calender etc. See next thread: [UDF] Gmail API - Email automation with AutoIt!
    1 point
  2. quick look here https://docs.microsoft.com/en-us/windows/desktop/taskschd/taskfolder-getfolders https://docs.microsoft.com/en-us/windows/desktop/taskschd/taskfoldercollection https://docs.microsoft.com/en-us/windows/desktop/taskschd/taskfoldercollection-count https://docs.microsoft.com/en-us/windows/desktop/taskschd/taskfoldercollection-item and you can try to use this not tested concept: Local $GFS = $GFolder.GetFolders(0) ReDim $GFL[$GFS.count] For $iItem_idx =0 To $GFS.count ; For $iItem_idx =0 To $GFS.count -1 ; I'm not sure $GFL[$iItem_idx] $GFS.Item($iItem_idx) Next
    1 point
  3. xtcislove, Thanks for that - it sounds like it could well be a similar problem. I will be investigating the CFF problem further over the weekend - I will keep an eye open for any ListView problems at the same time. M23
    1 point
  4. Sounds like an awesome idea, enough whining and mewling for one thread.
    1 point
  5. The point is only moot of your own volition, and only for yourself. I maintained and hardened 25k tactical systems, i may not know the burdens of small business and 1-hour drives, but putting soldiers lives at risk and getting in a bird to go fix shit on a FOB half the world away is probably a close second. You seem to think people are dissuading you from your intent, when we are only conveying that your method chosen is both lacking structure and not extensible. The premise in your statement is flawed, not the suggestions from knowledgeable users. But since no one here can force feed you the usefulness, you might rather enjoy the walk instead.
    1 point
  6. Again, I don't have a problem installing the updates, we simply do not work on the same schedule as what MS wants. For MS to simply say your pc gets updated by us IS NOT acceptable. This is why I am so upset with everyone's response cause you all are assuming that I will NEVER install these updates which is NOT TRUE. If these updates are of a critical nature due to some flaw that was being exploited at the time, we would rush to install the update(s) as needed. But these updates are NOT critical. They are important, sure, but NOT critical. You are simply bowing down to how MS does business and don't care about your own client's PCs. You simply are shrugging your shoulders and have the "Whatever" attitude which is wrong. You think MS has the best solution which is clearly not true. MS has a LONG history of issues with their updates breaking things and I WILL NOT!! ... WILL NOT!!! ... allow MS to continues to manage my systems their way when the end result cripples PCs and businesses suffer. How there isn't a class act against this form of tyranny is beyond me. So since no one can offer me anything useful, I'm just going to close this thread and walk away. I can't wait till the next flawed update cripples your systems. Thanks for nothing
    1 point
  7. qwert

    Checkbox Size

    The short answer is "no". But here are solutions I've used since 2014: link
    1 point
  8. How about _WinAPI_GetProcessFileName ? It needs the PID but returns the fully-qualified path to the file. *EDIT* :L just realized you may need the actual shortcut as opposed to where the exe is located.
    1 point
  9. To get the extended file properties you can use @BrewManNH modified _FileGetProperty function...
    1 point
  10. @marko001 Maybe this could help a little bit
    1 point
  11. mLipok

    _StringToPDF

    @esneyder Using PDFCreator you can convert RTF to PDF You can also convert RTF > PDF using OOO And it would be the fastest, easies, and the cheapest solution. Finally you can use QuickPDF UDF (free) + ActiveX DLL (commercial == paid software) and using this you will be able to make PDF from scratch, without RTF / PDFCreatore / OOO You can also do the same using MPDF.au3 UDF To all this solution (excluding OOO) you was pointed above. If you have further problems you can ask more questions.
    1 point
  12. TheSaint

    Ini in memory

    Hello masvil, look at the last post date .... from 2008. AutoIt has changed a lot since then, so there could well be compatibility issues. So you have revived an essentially dead topic, which is called necro posting ... and seriously frowned upon here. The acceptable procedure, is to start a new topic of your own, and then if necessary, link back to the dead topic. That's if it is at all relevant to do so, considering the age of the code.
    1 point
  13. ISI360

    ISN AutoIt Studio

    Hi! Thanks for your feedback, and welcome to ISN About the fileextenstions: Yeah i know there are some problemes and i had to readjust that. It´s on the To-Do List... And the parameter Editor: This error message appears because the command is not finished. So GuiCreate() for example should work.
    1 point
  14. Version 2.0.0

    1,045 downloads

    On one/multiple big sheet(s) you get users (columns) and groups (rows). The list is sorted descending by number of members so you get the users with most groups and the groups with most members on top of the page. You can filter by (multiple) samaccountname(s), department or you can create your own LDAP query filter. You can filter the resulting list of groups using a Regular Expression. Version 2.0 uses maps so at the moment it requires the latest beta version of AutoIt! BTW: If you like this tool please click the "I like this" button. This tells me where to next put my development effort
    1 point
  15. Hello, just looked around and googled for a proper way to decode base64 utf8 encoded strings and did not find good examples. So created own. Additionally includes base64 utf8 encoder. Possibly some one finds it useful. Used https://www.base64encode.org/ to encode base64-utf8 Global $b64 = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", "", 2); Func _getBase64Num($a) $a = Asc($a) If $a > 47 And $a < 58 Then Return $a + 4; ElseIf $a > 64 And $a < 91 Then Return $a - 65; ElseIf $a > 96 And $a < 123 Then Return $a - 71; ElseIf $a = 43 Then Return 62 ElseIf $a = 47 Then Return 63 Else Return 64 EndIf EndFunc Func _base64dec_arr($r) While StringCompare(StringLeft($r, 1), " ", 1) = 0 $r = StringMid($r, 2) WEnd Local $a, $d, $t, $c, $n, $o, $h, $i, $b = 0, $f = 0; If(StringLen($r) < 1) Then Return $r; Local $rlen = StringLen($r) Local $g = [1] Redim $g[Ceiling($rlen * 0.75)] $r = StringSplit($r, "", 2); While $b < $rlen $c = _getBase64Num($r[$b]) $b = $b + 1; $n = _getBase64Num($r[$b]) $b = $b + 1; $o = _getBase64Num($r[$b]) $b = $b + 1; $h = _getBase64Num($r[$b]) $b = $b + 1; $i = BitOR(BitShift($c, -18), BitShift($n, -12), BitShift($o, -6), $h) $a = BitAND(BitShift($i, 16), 255) $d = BitAND(BitShift($i, 8), 255) $t = BitAND(255, $i) If $o = 64 Then $g[$f] = $a $f = $f + 1; ElseIf $h = 64 Then $g[$f] = $a $f = $f + 1; $g[$f] = $d $f = $f + 1; Else $g[$f] = $a $f = $f + 1; $g[$f] = $d $f = $f + 1; $g[$f] = $t $f = $f + 1; EndIf WEnd If UBound($g) <> $f Then Redim $g[$f] EndIf Return $g; returns array EndFunc; Func _utf8_decode($str_data) ;expects array Local $tmp_arr = "", $i = 0, $c1, $c2, $c3, $strlen = UBound($str_data); While $i < $strlen $c1 = $str_data[$i]; If $c1 < 128 Then $tmp_arr = $tmp_arr & ChrW($c1); $i = $i + 1; ElseIf $c1 > 191 And $c1 < 224 Then $c2 = $str_data[$i + 1]; $tmp_arr = $tmp_arr & ChrW(BitOR(BitShift(BitAND($c1, 31), -6), BitAND($c2, 63))); $i = $i + 2; Else $c2 = $str_data[$i + 1]; $c3 = $str_data[$i + 2]; $tmp_arr = $tmp_arr & ChrW(BitOR(BitShift(BitAND($c1, 15), -12), BitShift(BitAND($c2, 63), -6), BitAND($c3, 63))); $i = $i + 3; EndIf WEnd Return $tmp_arr; EndFunc; Func _base64_utf8_dec($a) Return _utf8_decode(_base64dec_arr($a)) EndFunc Func _utf8_base64_enc($a) Return _base64_enc(_utf8_encode($a)) EndFunc Func _utf8_encode($stringOr) Local $utftext = "", $start = 0, $end = 0, $n = 0, $c1, $enc; Local $string = StringSplit($stringOr, "", 2); Local $stringl = UBound($string) While $n < $stringl $c1 = AscW($string[$n]) If $c1 > 127 Then If $c1 < 2048 Then $enc = ChrW(BitOR(BitShift($c1, 6), 192)) & ChrW(BitOR(BitAND($c1, 63), 128)) Else $enc = ChrW(BitOR(BitShift($c1, 12), 224)) & ChrW(BitOR(BitAND(BitShift($c1, 6), 63), 128)) & ChrW(BitOR(BitAND($c1, 63), 128)) EndIf If $end > $start Then $utftext = $utftext & StringMid($stringOr, $start + 1, $end - $start) EndIf $utftext = $utftext & $enc; $n = $n + 1; $start = $n; Else $n = $n + 1; EndIf $end = $n; WEnd If $end > $start Then $utftext = $utftext & StringMid($stringOr, $start + 1, $stringl - $start) EndIf Return $utftext; EndFunc; Func _base64_enc($rOr) Local $e, $t, $h, $o, $d = 0, $b = ""; Local $r = StringSplit($rOr, "", 2); Local $rL = UBound($r) While $d < $rL $e = AscW($r[$d]) $d = $d + 1; If $d < $rL Then $t = AscW($r[$d]) Else $t = 0; EndIf $d = $d + 1; If $d < $rL Then $h = AscW($r[$d]) Else $h = 0; EndIf $d = $d + 1; $o = BitOR(BitShift($e, -16), BitShift($t, -8), $h) $b = $b & $b64[BitAND(BitShift($o, 18), 63)] & $b64[BitAND(BitShift($o, 12), 63)] & $b64[BitAND(BitShift($o, 6), 63)] & $b64[BitAND(63, $o)] WEnd $rL = Mod($rL, 3); If $rL = 1 Then $b = StringLeft($b, StringLen($b) - 2) & "=="; ElseIf $rL = 2 Then $b = StringLeft($b, StringLen($b) - 1) & "="; EndIf Return $b EndFunc; MsgBox(0, _utf8_base64_enc("your string"), _base64_utf8_dec("eW91ciBzdHJpbmc=")); base64_dec_enc_utf8.au3
    1 point
×
×
  • Create New...