Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/09/2018 in all areas

  1. jesus40

    Get data from json

    Hello friends, I need help getting data from json. I read json from url into a variable. Is possible to get volume_USD value etc. where product_id= "ETH-BTC", ? So I want get "37421.69109185" as variable. I think is better keeping it in the memory as variable. Or easier to convert it to db or csv? #include <Inet.au3> #include <json.au3> $URL="https://api.abucoins.com/products/stats" $data = _INetGetSource($URL) MsgBox("","",$data) $object=json_decode($data) local $i=0 while 1 $message=json_get($object,'[product_id]');???????????????????????????????? MsgBox("","volume_USD",$message) $i=$i+1 WEnd the json structure is here: https://api.abucoins.com/products/stats [ { "product_id": "ETH-BTC", "last": "0.05202015", "open": "0.05009375", "high": "0.05250000", "low": "0.04872420", "volume": "47.77440456", "volume_BTC": 2.48523169, "volume_USD": 37421.69109185, "volume_7d": "364.40240341", "volume_30d": "3555.83377072", "change": "3.85" }, { "product_id": "LTC-BTC", "last": "0.01737490", "open": "0.01744636", "high": "0.01779000", "low": "0.01658091", "volume": "67.62762830", "volume_BTC": 1.17502328, "volume_USD": 17941.95920676, "volume_7d": "611.57893068", "volume_30d": "3881.57766044", "change": "-0.41" }, { "product_id": "ETC-BTC", "last": "0.00191846", "open": "0.00189001", "high": "0.00198000", "low": "0.00162741", "volume": "66.48327742", "volume_BTC": 0.12754551, "volume_USD": 1947.54976323, "volume_7d": "738.94495089", "volume_30d": "4090.74712156", "change": "1.51" }, { "product_id": "ZEC-BTC", "last": "0.03466163", "open": "0.03365452", "high": "0.03466163", "low": "0.03295811", "volume": "33.40101560", "volume_BTC": 1.15773364, "volume_USD": 17677.95599574, "volume_7d": "191.15953471", "volume_30d": "887.70158297", "change": "2.99" } ]
    1 point
  2. jaberwacky

    Themes for SciTE

    Note: This has been deprecated by >SciTE Customization GUI. I highly recommend SCG for all of your theme needs. Thank you. and your SciTE customization knowledge too. Here is a dark theme for SciTE for all you dark theme fans. I got this theme from Notepad++ which got the theme from the Dejavu font project (http://dejavu.sourceforge.net/wiki/index.php/Main_Page). Customized by hand because the original themese aren't perfect. They had black text on dark background. The line number margin, fold margin, editor, and console is themed! I encourage you to post your theme too. Also, if you have any knowledge that would enhance this and any other theme then I encourage you to post that too. Please post a fairly high quality screenshot too please. Instructions: (this works for me anyway. If you know a better method lemme know) 1) create the file named 'Twilight.SciTEConfig' in the 'SciTEConfig' folder found in the SciTE folder of your AutoIt installation 2) fire up SciTE and press 'Ctrl+1' 3) select the 'Color Settings' tab 4) click 'New Scheme' 5) select 'Twilight' from the drop down list 6) finally, click 'Update' Screenshot: Twilight.SciTEConfig -- Updated: November 26, 2010 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # START: DO NOT CHANGE ANYTHING AFTER THIS LINE #-#-#-#-# # Twilight -- 06/21/2011 #------------------------------------------------------------ find.close.on.find=1 proper.case=1 check.updates.scite4autoit3=1 indent.size.au3=4 highlight.current.word=1 highlight.current.word.colour=#CF6A4C highlight.current.word.by.style =1 autocomplete.*.ignorecase=1 autocomplete.*.start.characters=2 calltip.*.ignorecase=1 save.position=1 default.file.ext=au3 strip.trailing.spaces=1 ensure.final.line.end=1 ensure.consistent.line.ends=1 # Background style.au3.32=back:#141414 # Brace highlight style.au3.34=fore:#FCE94F,bold # Brace incomplete highlight style.au3.35=fore:#EF2929,bold #CaretLine Fore caret.fore=#DADADA #CaretLine Back caret.line.back=#F8F8F8 caret.line.back.alpha=0 #Selection selection.fore=#CF6A4C selection.back=#DADADA selection.alpha=25 #White Space style.au3.0=fore:#F8F8F8 #Comment line style.au3.1=fore:#5F5A60 #Comment block style.au3.2=fore:#5F5A60 #Number style.au3.3=fore:#CF6A4C #Function style.au3.4=fore:#DAD085 #Keyword style.au3.5=fore:#F9EE98 #Macro style.au3.6=fore:#DADADA #String style.au3.7=fore:#8F9D6A #Operator style.au3.8=fore:#CDA869 #Variable style.au3.9=fore:#7587A6 #Sent keys style.au3.10=fore:#DADADA #Pre-Processor style.au3.11=fore:#8996A8 #Special style.au3.12=fore:#DADADA #Abbrev-Expand style.au3.13=fore:#DADADA #Com Objects style.au3.14=fore:#DADADA #Standard UDFs style.au3.15=fore:#0080FF # Line Number Margin style.au3.33=$(font.monospaced),fore:#F8F8F8,back:#2E3436 # Fold Margin fold.margin.colour=#555753 fold.margin.highlight.colour=#2E3436 error.marker.fore=#DADADA error.marker.back=#2E3436 # Error Output style.errorlist.0=fore:#DADADA # Program Output style.errorlist.1=fore:#DADADA # Error Line style.errorlist.3=fore:#DADADA # command or return status style.errorlist.4=fore:#8F9D6A # diff changed ! style.errorlist.10=fore:#CF6A4C # # Diff addition + style.errorlist.11=fore:#7587A6 # diff deletion - style.errorlist.12=fore:#F9EE98 # Console Background style.errorlist.32=$(font.monospace),back:#141414 # END => DO NOT CHANGE ANYTHING BEFORE THIS LINE #-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    1 point
  3. Here is a simple example of hat I mean: FileDelete("file1.au3") ; create tempfile to monitor $Tempfile= @TempDir & "\demo.txt" FileWriteLine($Tempfile,"Dummy") ; create demo file1.au3 script FileWriteLine("file1.au3",'#RequireAdmin') FileWriteLine("file1.au3",'msgbox(0,"file1","file1")') FileWriteLine("file1.au3",'FileDelete(@TempDir & "\demo.txt")') ; run script elevated ShellExecuteWait(@ProgramFilesDir & '\AutoIt3\autoit3.exe', 'file1.au3') ; monitor file1.au3 is filished While FileExists($Tempfile) sleep(100) WEnd MsgBox(0, "", "file1 done") Jos
    1 point
  4. In your case BitOr resets @error to 0 because statements are evaluated from left to right (this is true for BitAnd as well). BitAnd won't work because: BitOr($MB_ICONERROR, $MB_TOPMOST) returns 262160 BitAnd($MB_ICONERROR, $MB_TOPMOST) returns 262144 You could solve this problem with the approach you use in your 2nd script or by: #include <MsgBoxConstants.au3> Local $bFlag = BitOR($MB_ICONERROR, $MB_TOPMOST) Local $sFileRead = FileRead("C:\temp\this file name doesn't exist.txt") If @error Then MsgBox($bFlag, "1st script", "@error = " & @error) or by #include <MsgBoxConstants.au3> Local $sFileRead = FileRead("C:\temp\this file name doesn't exist.txt") Local $iError = @error If $iError Then MsgBox(BitOR($MB_ICONERROR, $MB_TOPMOST), "1st script", "@error = " & $iError)
    1 point
  5. But that probably still means that the process is restarted to gain elevated rights thus terminated the original shelled process. What I normally do in this case is create a TempFIle before starting the elevated script and keep monitoring its existence. The shelled script will delete that tempfile at the end of it. Jos
    1 point
  6. try this Return StringLeft($sUsername,StringLen($sUsername)-1) when returning _GetUsername()
    1 point
  7. You already use a variable in the _Excel_RangeRead statement. Use the same approach for _Excel_RangeInsert.
    1 point
  8. Not exactly sure why you are using ShellExecute like you are? Have you also tried RunWait? With ShellExecute it would be more usual to run in the following manner ... or just use RunWait if wanting to provide all paths. ShellExecuteWait('C:\file1.au3') But like Jos said, it is hard to determine what is going on, without more information. What are each of those scripts doing? Can we see the code in them?
    1 point
  9. $ProgramToMute = "chrome" $hWnd = WinGetHandle("Volume Mixer", "") $close =False If Not HWnd($hWnd) Then Run("sndvol.exe", "", @SW_HIDE) $hWnd = WinWaitActive("Volume Mixer") $close = True EndIf $i = 0 Do $i += 1 If StringInStr(ControlGetText($hWnd, "", "[CLASS:ToolbarWindow32; INSTANCE:" & $i & "]"), $ProgramToMute) Then ControlClick($hWnd, "", "ToolbarWindow32" & $i, "", 1) ExitLoop EndIf Until Not HWnd(ControlGetHandle($hWnd, "", "[CLASS:ToolbarWindow32; INSTANCE:" & $i & "]")) If $close Then WinClose($hWnd, "")
    1 point
  10. Like you already speculated, I would agree that the cleanup is probably a good idea in order to avoid any leaks. Agreed, just uses the same parent gui for each InputBox. Probably less critical to clean up versus creating a new one each loop.
    1 point
  11. this snipet: $hGui = GUICreate("", 0, 0, 0, 0, Default, @SW_SHOWDEFAULT) Do $sNb_Quest = InputBox("Quiz", "How many questions to answer ? (1-99)", "10", " M2", _ 220, 140, Default, Default, 0, $hGui) If @error = 1 Then MsgBox(4096, "End of script", "You choosed to Quit") Exit EndIf $iNb_Quest = Number($sNb_Quest) Until $iNb_Quest > 0 And IsInt($iNb_Quest) = 1 MsgBox(4096, "Result", "Your choice : " & $iNb_Quest) do the same.
    1 point
  12. Anti-virus or shared folder issue.
    1 point
  13. Jos

    Get data from json

    This should be close: #include <Inet.au3> #include <json.au3> $URL = "https://api.abucoins.com/products/stats" $data = _INetGetSource($URL) $object = json_decode($data) Local $i = 0 While 1 $product_id = json_get($object, '[' & $i & '].product_id') If @error Then ExitLoop If $product_id = "ETH-BTC" Then $volume_USD = json_get($object, '[' & $i & '].volume_USD') ConsoleWrite('$volume_USD = ' & $volume_USD & @CRLF ) ;### Debug Console EndIf $i += 1 WEnd Jos
    1 point
  14. Yes with one notable exception. If you are running the script in a Windows PE environment (e.g., for deploying OS images), Windows PE x64 does not have WoW (Windows on Windows) execution, so an x86 executable can only run in WinPE x86 and not in WinPE x64. This is not commonly done but I wanted to post here in case someone who does use WinPE comes along and reads this and needs the information. There is also the consideration that if you need to write to certain keys in the registry a 64-bit exe is the best way to go, but that's a more advanced topic. x86 is the most widely compatible.
    1 point
  15. Concerning aes-128 try to search here http://sureshotsoftware.com/guides/locky/ . There should be details about this cipher.
    1 point
  16. Next version I hope to have better speed of the uiaWrappers but I am not sure If I cause 2 seconds delay. I know the logic in the wrappers is also if no treehierarchy is specified fallback to desktop and start searching the whole tree which can be huge and timeconsuming (when you turn logging on you can see what happens in detail and how many objects are traversed before finding the element) Func _UIA_getFirstObjectOfElement($obj, $str, $treeScope) is probably quicker as it does not do a findall I will put on my TODO some logic like if in UIA_Action 1 property is used for finding an element directly call directly something like below ;- Change Func _UIA_getFirstObjectOfElement $propertyID = $UIA_NamePropertyId ;- Or automation id property or ..... $tVal= ..... ;- property value $UIA_oUIAutomation.createPropertyCondition($propertyID, $tval, $pCondition) $oCondition = ObjCreateInterface($pCondition, $sIID_IUIAutomationPropertyCondition, $dtagIUIAutomationPropertyCondition) $t = $obj.Findfirst($treeScope, $oCondition, $UIA_pUIElement) $UIA_oUIElement = ObjCreateInterface($UIA_pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement)
    1 point
  17. Hello, It is the second time i am facing this problem in a project and it is starting pissing me off because i can't seem to find a good solution. By saying a good solution i mean keep using MsgBox and not an alternative GUI and set state to non focus. I had the same problem with the InputBox. I can't seem to find a solution on google or forum. Any ideas people? Thank you in advance.
    1 point
  18. Frix, You must have a very strange machine to miss clicks using that code - I need to use additional code to wait until the mousebutton is released to prevent multiple hits even when I try to make the fastest click I can manage: #include <Misc.au3> HotKeySet("{ESC}", "Terminate") $dll = DllOpen("user32.dll") While 1 Sleep(10) ; This enough to prevent CPU overload <<<<<<<<<<<<<<<<<<<<<<<< If _IsPressed("01", $dll) Then $MousePos = MouseGetPos() ConsoleWrite("Mouse Button Pressed" & @CRLF & "X=" & $MousePos[0] & @CRLF & "Y=" & $MousePos[1] & @CRLF) While _IsPressed("01", $dll) Sleep(10) WEnd EndIf WEnd Func Terminate() DllClose($dll) Exit 0 EndFunc Are you sure you are missing clicks - are they perhaps being eaten by the GUI on which you are clicking? M23
    1 point
×
×
  • Create New...