Jump to content

Leaderboard

Popular Content

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

  1. Hello. Welcome to AutoIt forum. Here is an implemetation that I've written for you. #include <Crypt.au3> #include <Base64.au3> #include <SHA224_256.au3> Global Const $CALG_SHA_512 = 0x0000800e #Region Kraken Const Global $g_sKrakenURL = "https://api.kraken.com" Global $g_sKrakenAPIVersion = "0" #EndRegion Kraken Const #Region keys Global Const $g_sAPIKey = "a8/dt1+Sjw6a8/OspaeKgTvQXjVGDa7MTwtkE8U85oJpX+OThqMjLcSf" ;you can use this for testing, it uses a test account Global Const $g_sAPISecret = "gmJASh6IR57seYYJE5z6qEU5sT7OBm+QPzDBp8/89OnaTNydM7rbsKo0hHbHAfMEW1zcPrN6EPDc0PD2hMEWyQ==" ;you can use this for testing, it uses a test account #EndRegion keys #Region API Test _TestAPI() Func _TestAPI() ;Query Public Local $sResult = KrakenQueryPublic("Time") ;Server Time ConsoleWrite("Time: " & $sResult & @CRLF & @CRLF) ;Query Private $sResult = KrakenQueryPrivate("TradeVolume", "&pair=XXBTZUSD,XXBTZEUR") ;Trade Volume ConsoleWrite("TradeVolume: " & $sResult & @CRLF & @CRLF) $sResult = KrakenQueryPrivate("Balance") ;Get Balance ConsoleWrite("Balance: " & $sResult & @CRLF & @CRLF) EndFunc ;==>_TestAPI #EndRegion API Test #Region Kraken Query Func KrakenQueryPublic($sMethod, $sParameters = "") Local $sURL = StringFormat("/%s/public/%s", $g_sKrakenAPIVersion, $sMethod) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $g_sKrakenURL & $sURL, False) $oHTTP.Send(Binary($sParameters)) Local $sReceived = $oHTTP.ResponseText Return $sReceived EndFunc ;==>KrakenQueryPublic Func KrakenQueryPrivate($sMethod, $sParameters = "") Local $sNONCE = _GetNonce() $sParameters = "nonce=" & $sNONCE & $sParameters Local $sURL = StringFormat("/%s/private/%s", $g_sKrakenAPIVersion, $sMethod) Local $sSecretDecoded = _Base64Decode($g_sAPISecret) Local $sNonceParams = $sNONCE & $sParameters Local $bURLBytes = Binary($sURL) Local $sHashNonceParams = _SHA256($sNonceParams) Local $bMessage = $bURLBytes & $sHashNonceParams Local $sSignature = HMACSHA512($sSecretDecoded, $bMessage) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", $g_sKrakenURL & $sURL, False) $oHTTP.SetRequestHeader("API-Key", $g_sAPIKey) $oHTTP.SetRequestHeader("API-Sign", _Base64EncodeMod($sSignature)) $oHTTP.Send(Binary($sParameters)) Local $sReceived = $oHTTP.ResponseText Return $sReceived EndFunc ;==>KrakenQueryPrivate #EndRegion Kraken Query Func _GetNonce() ;~ Return @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC Return 9 & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC ;added 9 at start due while testing I added a big nonce number > (@YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC). With another APIkey Use line above (and comment this) EndFunc ;==>_GetNonce Func _Base64EncodeMod($sData) Return StringReplace(_Base64Encode($sData), @LF, "") EndFunc ;==>_Base64EncodeMod Func HMACSHA512($bKey, $bMessage) Local Const $iBlockSize = (512 / 8) Local Const $oconst = 0x5C, $iconst = 0x36 Local $a_opad[$iBlockSize], $a_ipad[$iBlockSize] Local $opad = Binary(''), $ipad = Binary('') If BinaryLen($bKey) > $iBlockSize Then $bKey = _Crypt_HashData($bKey, $CALG_SHA_512) For $i = 1 To BinaryLen($bKey) $a_ipad[$i - 1] = Number(BinaryMid($bKey, $i, 1)) $a_opad[$i - 1] = Number(BinaryMid($bKey, $i, 1)) Next For $i = 0 To $iBlockSize - 1 $a_opad[$i] = BitXOR($a_opad[$i], $oconst) $a_ipad[$i] = BitXOR($a_ipad[$i], $iconst) Next For $i = 0 To $iBlockSize - 1 $ipad &= Binary('0x' & Hex($a_ipad[$i], 2)) $opad &= Binary('0x' & Hex($a_opad[$i], 2)) Next Local $bRet = _Crypt_HashData($ipad & ($bMessage), $CALG_SHA_512) $bRet = _Crypt_HashData($opad & $bRet, $CALG_SHA_512) Return $bRet EndFunc ;==>HMACSHA512 Includes: Includes.zip Saludos
    2 points
  2. Better, but still confusing. You have an IF with no EndIF. So, if $Error is checked, do you want to perform one of the actions below, or all of them? GUICtrlSetData($FinalIcon,16) GUICtrlRead($FinalIcon) $FinalTitle = GUICtrlRead($Title) $FinalMessage = GUICtrlRead($Message) MsgBox($FinalIcon,$FinalTitle,$FinalMessage)
    1 point
  3. @ju4711 it is a bit difficult to ascertain what you are trying to do from such a small non-runnable snippet. You appear to be trying to read from a control on your GUI named $Error, but you're leaving us to guess whether this is an input, a combo box, etc. How about helping us help you and posting your code, or at least a runnable reproducer?
    1 point
  4. My application is an applet running in browser. It got an SunAwtCanvas1 control under Internet Explorer_Server control. I want to click it while it is running in the background. I have tried using ControlClick() to it in the background. But it seems that it is not responding. Does anyone have similiar experience with SunAwtCanvas1 control ? Can I ControlClick() it in the background?
    1 point
  5. This is the first result on google, so I'm posting it here. I'll also link here from a few other posts I've found. So from my learnings, what happens is the JavaScript behind the button registers an event handler, that looks specifically for the proper browser events to click the button, then fires the code. the IE functions don't use this (they must use some standard non-JavaScript way of doing it) so we have to create the event ourselves. ;Create an event $oClickEvent = $oIE.document.createEvent('MouseEvents') ;Event types are 'mouseover', 'mousedown', 'mouseup', and 'click' $oClickEvent.initEvent('click', true, true) ;Now that we have the event, we send it to the control we want $oElement.dispatchEvent ($oClickEvent) ;If need be, do this multiple times for mouseover, mousedown, mouseup, and click to simulate a more natural click source information: https://stackoverflow.com/questions/24025165/simulating-a-mousedown-click-mouseup-sequence-in-tampermonkey https://stackoverflow.com/questions/27176983/dispatchevent-not-working-in-ie11 Hope someone found this helpful, I've been looking for this for a loooooooong time. Edit: I also found out there is an easy way to see what events a button/link/element handles! Press F12 to open the developer tools, and select the element in the DOM Explorer, then check the Events tab in the right pane. This is SUPER useful! No need to guess what it's expecting!
    1 point
  6. Thats because you provide not a lot of information in your first post. You seem to be on an android emulator and as such you will get not much initially when you read FAQ 31 see link below from simplespy, inspect or au3inf. Most likely you have to get much more thru the android debugger and have to switch to other tools like UIAutomator Viewer or Appium inspector Catching events under windows from an android emulator i doubt if thats possible without deeply hooking into an emulator. (and then over here is not the correct forum) like https://github.com/android/platform_external_qemu but if you understand this part then you probably would not have had your initial question. Maybe a screenshot of what you try to catch?
    1 point
  7. You can try using _GUIToolTip_GetText, the second example might be a good start. If it doesn't work, then there might not be a standard Windows tooltip being displayed.
    1 point
  8. Hi jriker1 Something like this? What my script does: 1. Waits for the USB stick to be inserted 2. Deletes all contents of C:\Videos 3. Moves all contents (including folders etc.) from your USB stick to C:\Videos 4. Waits for you to remove the USB stick again, and when you do, the script continues.. Just set the script to start up with windows. #NoTrayIcon $USB_Drive = 'E:\' ; <-- change to match the drive letter of your USB stick :-) $Videos_Folder = 'C:\Videos' While 1 $Check_drive = FileExists($USB_Drive) Sleep(500) If $Check_drive = 1 Then ConsoleWrite("USB Stick is active..." & @CRLF) DirRemove($Videos_Folder, 1) DirCreate($Videos_Folder) SplashTextOn("", "Copying files...", 300, 55, -1 , -1, 1, "@calibri", "16","600") FileMove($USB_Drive & "\*.*", $Videos_Folder, 1) ;Move all source files first $hSearch = FileFindFirstFile($USB_Drive & "\*.*") ;Now find any remaining (in this case: folders) if $hSearch = -1 then exit ;No folders While 1 $hFilename = FileFindNextFile($hSearch) if @ERROR then exitloop ;No more files DirMove($USB_Drive & "\" & $hFilename, $Videos_Folder,1);move subdir and all contents to new location WEnd SplashOff() Sleep(500) SplashTextOn("", "Copy complete", 300, 55, -1 , -1, 1, "@calibri", "16","600") Sleep(5000) SplashOff() Do $Check_drive = FileExists($USB_Drive) ConsoleWrite("Waiting for USB Stick to be removed again..." & @CRLF) Sleep(500) Until $Check_drive = 0 Else ConsoleWrite("USB Stick is NOT active..." & @CRLF) EndIf WEnd /David
    1 point
  9. Use AutoIT window info in order to get class window name/other required stuff...
    1 point
  10. I tried this many times with different variation but is having no luck so far. I need to send mouse click to the background browser running a Java Applet. I tried MouseClick() and the click is okay. But I need the automated browser running in the background so I've to used ControlClick(). But so far, all I can do with ControlClick() is to cause the Applet to click on the current position of the cursor even I've explicitly specified another x,y coordinate in the ControlClick() call. A click can be simulated but always on the wrong location. Is it a limitation of Java Applet ? Here is my test code: WinActivate("ShowApplet") WinWaitActive("ShowApplet") sleep(1500) ; no click done at all if using Internet Explorer_Server control ;ControlFocus ( "ShowApplet", "", "[CLASSNN:Internet Explorer_Server1]") ;ControlClick ("ShowApplet", "", "[CLASSNN:Internet Explorer_Server1]","left", 1, 11,290) ; For SunAwtCanvas control. only clicks on the current cursor position, not the 216,390 I specified ControlFocus ( "ShowApplet", "", "[CLASSNN:SunAwtCanvas1]") ControlClick ("ShowApplet", "", "[CLASSNN:SunAwtCanvas1]","left", 1, 216,390)
    1 point
  11. Yes, you're probably right when you thought this was a limitation of Java applet. A lot of work has been done with Java already. Maybe you will find it of use: http://www.autoitscript.com/forum/index.php?showtopic=87956
    1 point
  12. machalla

    Send ALT F4

    Based on the documentation for Send in the help file I put this together Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("Untitled -") Send("!+{F4}",0) It seems to work fine for me. Good luck with it.
    1 point
×
×
  • Create New...