Leaderboard
Popular Content
Showing content with the highest reputation on 02/11/2018 in all areas
-
blasphemy! stone him! Also, apologies for claiming a false trophy. I thought i manufactured the most ridiculous edge cases, but I stand so very corrected by every single post in this thread. I'm not even top 5.2 points
-
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
-
StringRegExp issue
youtuber reacted to OldGuyWalking for a topic
@YouTuber - If you're doing things with RegEx and are looking for other examples or cheat sheets, a site I refer to is RexEgg.com. It has some tutorials, examples, and the aforementioned cheat sheet (which I refer to often). You might find it useful even if you only do regular expressions occassionally. Good luck.1 point -
StringRegExp issue
youtuber reacted to OldGuyWalking for a topic
#include <Array.au3> $sSource = "<title>»title-1 | wb1</title>" & @CRLF & _ "<title>®?tit-le2 – ; wb2</title>" & @CRLF & _ "<title>?tit@le3 – wb3</title>" & @CRLF & _ "<title>-title_4 _ wb4</title>" & @CRLF & _ "<title>_tit-le5 _ wb5</title>" & @CRLF & _ "<title> _ ti_tle6 _ wb6</title>" & @CRLF & _ "<title>title7 – ; wb2</title>" & @CRLF & _ "<title>title8 – wb3</title>" & @CRLF & _ "<title>title9 _ wb4</title>" ;$aRegEx = StringRegExp($sSource, "<title>.*?([a-zA-Z0-9]+).+<\/title>", 3) ;_ArrayDisplay($aRegEx) $aRegEx = StringRegExp($sSource, '<title>[\W\s\_]*([\S]+)', 3) _ArrayDisplay($aRegEx) I threw in the data you'd used earlier as well to show that this works for both. The first half of the pattern: '<title>[\W\s\_]* Capture (and then discard) \W nonword characters (the [^A-Za-z0-9_] characters), \s spaces, underscore (which is treated as a \w word character and in this instance would trigger the second half of the capture if not put in the list) * (if they exist) after the <title> The second half of the pattern: ([\S]+) Capture any \S non-space character until it reaches a \s space character. If there is a space in the data you want to capture you'll only get the characters up to the space. Say you wanted 'ti tle6' captured in the following example ("<title> _ ti tle6 _ wb6</title>" you would only get the ti part. For the set of data I got. title-1 tit-le2 tit@le3 title_4 tit-le5 ti_tle6 title7 title8 title9 Does this work for you? One of the more powerful features in Regular Expressions are the Character Classes that can be used to shorten code (depending on what you're trying to do of course). Below is a short list. There are times when using a single character class can replace alot of code. Not always, but it's a good idea to use them when possible. Character Classes \c Control character \s White space \S Not white space \d Digit \D Not digit \w Word \W Not word \x Hexadecimal digit \O Octal digit1 point -
$aRegEx = StringRegExp($sSource, '<title>[^[:alnum:]]*(.*?)(?:\s[^[:alnum:]]|<)', 3) This can continue for a long time... and necessarily it will end up failing The magic universal regex which gets anything you want whatever your requirements doesn't exist1 point
-
yea probably, It is also fixed by moving the Func Tray_HandleBridgeOption() after the Func GUI_BridgeHandler($iCtrlID = Default). With the changes made in AutoIt3 around the special function definitions we really opened a can of worms for au3check. I wish we had somebody around that really understands how it all works which is certainly not me. Jos1 point
-
This one works too - for this moment - thanks to posix classes #include <Array.au3> $sSource = "<title>»title-1 | wb1</title>" & @CRLF & _ "<title>®?tit-le2 – ; wb2</title>" & @CRLF & _ "<title>?tit@le3 – wb3</title>" & @CRLF & _ "<title>-title_4 _ wb4</title>" & @CRLF & _ "<title>_tit-le5 _ wb5</title>" & @CRLF & _ "<title> _ ti_tle6 _ wb6</title>" $aRegEx = StringRegExp($sSource, '<title>[^[:alnum:]]*(.*?)\s[^[:alnum:]]', 3) _ArrayDisplay($aRegEx) But if you add one requirement more, it will become hazardous/nearly impossible1 point
-
Then this will match: #include <Array.au3> $sSource = "<title>»title-1 | wb1</title>" & @CRLF & _ "<title>®?tit-le2 – ; wb2</title>" & @CRLF & _ "<title>?tit@le3 – wb3</title>" & @CRLF & _ "<title>-title_4 _ wb4</title>" & @CRLF & _ "<title>_tit-le5 _ wb5</title>" & @CRLF & _ "<title> _ ti_tle6 _ wb6</title>" $aRegEx = StringRegExp($sSource, "<title>.*?([a-zA-Z][a-zA-Z0-9\-_@]+).+<\/title>", 3) _ArrayDisplay($aRegEx) You have to fill in the allowed symbols like _, @ and - (this you have to mask with \, that's why \-). But you dont want these extra signs at the beginning. Therefor you have to look once for [a-zA-Z]. Conrad1 point
-
.... since _getip() returns your "public" IP address, in a network where clients are connected to internet over a proxy, all clients of the LAN should have the same public IP (that is the outer public IP of the proxy shared to all the clients of the LAN) perhaps in this case could be a better choice @IPAddress1 instead of _getip()1 point
-
if _GetIp() == "1.2.3.4" then ;do stuff endif Something like that.1 point
-
Simple Multi-GUI problem
Earthshine reacted to TheSaint for a topic
Only had a quick look at your code, but noticed none of your child windows has the parent window declared in the GUICreate statement. You also don't have any of the GUIs set as ON TOP, in the same GUICreate statement. $Form2 = GUICreate("Sample Loop Volume Calculator", 615, 438, 192, 124, -1, $WS_EX_TOPMOST, $Form1) Further to that, I find that setting the RESTORE state can sometimes be helpful, in place of WinActivate ... or use both. GUISetState(@SW_RESTORE, $Form2)1 point -
Or pattern like this: “<title>([a-zA-Z0-9]+).+<\/title>“ Regards, Conrad1 point
-
? $aRegEx = StringRegExp($sSource, '<title>(.*?)\W.*</title>', 3)1 point
-
Newbee to arrays
antonioj84 reacted to Subz for a topic
For a 2d Array I always think of it like $aArray[Row][Column] like in the table below: Col Col Col Col [0] [1] [2] [3] --------------------------- Row [0] | 0 1 2 3 Row [1] | 0 1 2 3 Row [2] | 0 1 2 3 Row [3] | 0 1 2 31 point -
There is [possibly] something very wrong with autoit
antonioj84 reacted to Earthshine for a topic
Sounds like something CCleaner would do to me. Wiping out valid stuff I would not be surprised if he ran something like it after I will also test it Monday and verify1 point -
There is [possibly] something very wrong with autoit
antonioj84 reacted to Melba23 for a topic
iamtheky, Thanks for testing. M231 point -
AutoIt v3.3.14.3 has been released. Thanks to everyone involved, both visible and behind the scenes. Download it here. Complete list of changes: History1 point