Jump to content

Leaderboard

Popular Content

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

  1. and anytime you are dealing with quoted things within a quoted string, you can always set them to a var to ensure that quotes are not the issue. e.g. $spath = "'C:\Users\GOD\Desktop\New Folder'" $dpath = "'C:\Users\GOD\Desktop\test.zip'" Run("powershell Compress-Archive -Path " & $spath & " -DestinationPath " & $dpath)
    2 points
  2. [NEW VERSION] - 2 Aug 18 Added: When specifying the icon to use, if the $vIcon parameter is set to the name of an ico or exe file, the main icon within will be displayed, but if a trailing "|" followed by the icon index is added to the name, that icon from within the file is used New UDF and example in the zip below. Details of previous versions: Changelog.txt A forum query about the small pop-ups that some apps produce from the systray led me to create my version of how this can be done. By the way, I call these small GUIs "Toasts" for obvious reasons! A zip containing the UDF, an example script and my StringSize UDF (which is also required): Toast.zip As always, kind comments and constructive criticisms welcome - particularly the former! M23
    1 point
  3. 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
  4. How about: #include <Array.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> _bluePRINT3() Func _bluePRINT3() Local $iMsgBox, $sBP3Version ;~ Getting the latest version of bluePRINT3.exe in @LocalAppDataDir\Apps\2.0 Local $aBluePRINT3 = _FileListToArrayRec(@LocalAppDataDir & "\Apps\2.0", "bluePRINT3.exe", 1, 1, 1, 2) If @error Then Exit MsgBox(16, "bluePRINT3", "Unable to find bluePRINT3.exe files under " & @LocalAppDataDir & "\Apps\2.0") Local $aBP3Version[$aBluePRINT3[0]][2] For $i = 1 To $aBluePRINT3[0] $aBP3Version[$i-1][0] = $aBluePRINT3[$i] $aBP3Version[$i-1][1] = FileGetVersion($aBluePRINT3[$i]) Next _ArraySort($aBP3Version, 1, 0, 0, 1) ;~ $aBP3Version[0][0] is the latest version of bluePRINT3.exe in @LocalAppDataDir\Apps\2.0 ;~ Gui Information Local $hGUI = GUICreate("bluePRINT3", 490, 70) GUICtrlCreateLabel('Please enter the version number in this format: "0.0.0.0"', 10, 10, 300, 20, $SS_CENTERIMAGE) Local $idBP3Version = GUICtrlCreateInput("3.3.0", 310, 10, 170, 20) Local $idClose = GUICtrlCreateButton("Close", 310, 35, 85, 25) Local $idStart = GUICtrlCreateButton("Start", 395, 35, 85, 25) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idClose ExitLoop Case $idStart $sBP3Version = 'bluePRINT 3 - Version ' & GUICtrlRead($idBP3Version) $iMsgBox = MsgBox(36, "bluePRINT3 version you chose", "About to run: " & $sBP3Version & ". Do you want to continue?") Switch $iMsgBox Case 7 ContinueLoop Case 6 Run($aBP3Version[0][0]) AutoItSetOption('MouseCoordMode' , 0) WinWait($sBP3Version) WinActivate($sBP3Version) ;CLICKS CONTROL PANEL SETUP MouseClick('primary', 339,204, 1, 0) ;SELECTS CP PORT PANEL MouseClick('primary', 615,116, 1, 0) Send('{DOWN 2}', '{ENTER}') Sleep( 2000) EndSwitch EndSwitch WEnd GUIDelete($hGUI) Exit EndFunc
    1 point
  5. Hi Melba23, checked out the new version with the fixed include files - image copy now works fine. New versions always bring bugs with them, so no apologies needed (mea culpa, too - didn't recognize the "3.3.14.3 Fixes"-post from you). Thanks to you for your quick solution and greetings to you and all who keep AutoIt running. kara2004
    1 point
  6. Fr33b0w, AutoIt runs all directives (such as #include) before running the code, so the file is always included. Can you explain in more detail why you need to conditionally include this file? Then we might be able to offer some sensible workarounds. M23
    1 point
  7. I have now also added usage instructions for Add Book & All Formats To Calibre in the first post, spoiler sections. CELEBRATING - My good buddy TheDcoder has just advised me of my 9,999 post status. So I guess this will be number 10,000. TOP
    1 point
  8. @Simpel - your maths is squiffy. You were dividing everything by 1e28 (which should have been 1e14) including the terms that weren't scaled up. The two possible ways to do it are to scale everything up to be 14 orders of magnitude higher, or to only divide the parts that have been scaled up. I'd actually suggest using the 3rd version below, which leaves the value as an integer, scaled up by 1e14, as then no precision is lost in the conversion back to floating point. This style of calculation is termed "fixed point" as we keep all the values scaled up by a fixed amount. This gives you a smaller range than floating point calculations, but greater precision (as we don't need to use bits to store the exponent). Local $xn = 32767, $xn_1 = 3276, $xn_2 = 327, $yn_1 = 3276, $yn_2 = 327 Local $yn = $xn - 2 * $xn_1 + $xn_2 + 1.99004745483398 * $yn_1 - 0.99007225036621 * $yn_2 ConsoleWrite($yn & @CRLF) $yn = ( ($xn - 2 * $xn_1)*100000000000000 + $xn_2 + 199004745483398 * $yn_1 - 99007225036621 * $yn_2) / 100000000000000 ConsoleWrite($yn & @CRLF) $yn = $xn - 2 * $xn_1 + ($xn_2 + 199004745483398 * $yn_1 - 99007225036621 * $yn_2) / 100000000000000 ConsoleWrite($yn & @CRLF) $yn = ($xn - 2 * $xn_1)*100000000000000 + ($xn_2 + 199004745483398 * $yn_1 - 99007225036621 * $yn_2) ConsoleWrite($yn & @CRLF) ConsoleWrite(Log($yn)/Log(2) & @LF) You aren't that far away from the limits in this case, about 62 bits of precision (the last line of code above is the bit calculation). The limit will be hit depending on the value of $yn_1, if it was 2x higher then you might be in trouble. Tbh, I'm surprised to see such a big error in the floating point calculation.
    1 point
  9. david1337

    ControlSetText?

    Okay, well then you just call the function inside your While loop? HotKeySet("{ESC}", "End") ;~ HotKeySet("{F1}", "Get_Mouse_Pos") $GUI = GUICreate("Coords", 60, 30, 0, 0) $Label_x_y = GUICtrlCreateLabel("x=" & @CRLF & "y=", 1, 0, 15, 30) $Label_x_value = GUICtrlCreateLabel("", 17, 0, 50, 13) $Label_y_value = GUICtrlCreateLabel("", 17, 15, 50, 13) GUISetState(@SW_HIDE) While 1 Sleep(100) Get_Mouse_Pos() ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< WEnd Func Get_Mouse_Pos() GUISetState(@SW_SHOW) $Mpos = MouseGetPos() $Mpos_x = $Mpos[0] $Mpos_y = $Mpos[1] GUICtrlSetData($Label_x_value, $Mpos_x) GUICtrlSetData($Label_y_value, $Mpos_y) EndFunc Func End() Exit EndFunc
    1 point
×
×
  • Create New...