Leaderboard
Popular Content
Showing content with the highest reputation on 12/29/2017 in all areas
-
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 Jos2 points
-
Add an error handler (COMUtils.au3 section in DotNetAll.au3) in this way to get a little bit more information about the error: #include "DotNetAll.au3" Opt("MustDeclareVars", 1) Example() MsgBox(0, "Debug", "Click OK to end program") Func Example() ; Add these lines to a script to activate the error handler: Local $oComErrFunc = ObjEvent( "AutoIt.Error", "ComErrFunc" ) #forceref $oComErrFunc Local $oBrowser, $oCode = DotNet_LoadVBcode(FileRead("WebBrowser.vb"), "System.Windows.Forms.dll | System.Drawing.dll") If @error Then Return ConsoleWrite("DotNet_LoadVBcode ERR" & @CRLF) ConsoleWrite("DotNet_LoadVBcode OK" & @CRLF) Local $oForm1 = DotNet_CreateObject($oCode, "Form1") If IsObj($oForm1) Then $oForm1.Main() EndIf EndFunc SciTE output: DotNet_LoadVBcode OK zTest.au3(18): ==> COM Error intercepted! Err.number is: 0x80020006 Err.windescription: Unknown name. Err.description is: Err.source is: Err.helpfile is: Err.helpcontext is: Err.lastdllerror is: 0 Err.scriptline is: 18 Err.retcode is: 0x00000000 There is something related to the Main Sub that does not work. Since I've been playing with VB code, I know that there are some keywords that does not work in AutoIt. In this case, the keyword "Shared" in this line in the VB code (one of the last lines): Public Shared Sub Main() Delete the keyword "Shared" and the code will run. Complete code: WebBrowser.7z2 points
-
the field "Arnia_Name" seems to be a string, so you have to add quotes : Local $aLResult = _Sqlite3_Read(@ScriptDir & "\MaoDb.db", "SELECT * FROM Anagrafica_Arnie WHERE Arnia_Name = '" & $sLNomeArnia & "';") Also, look at _SQLite_FastEscape1 point
-
How to read control hint when created in Koda
argumentum reacted to BrewManNH for a topic
Sure it does. See the modifications I did below to @Danyfirex's script from above. Hit the hotkey "t" to have it display what the currently visible tooltip is displaying. #include <GUIConstantsEx.au3> #include <AutoItConstants.au3> #include <GUITooltip.au3> ; <<<<<<<<<<<<<<<<<<<<<<< Global $g_oToolTipDic = ObjCreate("Scripting.Dictionary") ;this for store all the Tooltips HotKeySet("t", "_GUICtrlGetTip2") ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Example() Func Example() GUICreate("My GUI control tip") ; will create a dialog box that when displayed is centered Local $idLabel1 = GUICtrlCreateLabel("my label 1 - click me to get the tip text", 10, 20) _GUICtrlSetTip(-1, "tip of my label 1") Local $idLabel2 = GUICtrlCreateLabel("my label 2 - click me to get the tip text", 10, 60) _GUICtrlSetTip(-1, "tip of my label 2") Local $idbtn = GUICtrlCreateButton("Change Tips of label 1 and label 2", 100, 200, 200, 30) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idLabel1 MsgBox(0, "", _GUICtrlGetTip($idLabel1)) Case $idLabel2 MsgBox(0, "", _GUICtrlGetTip($idLabel2)) Case $idbtn _GUICtrlSetTip($idLabel1, "tip of my label 1 is changed") _GUICtrlSetTip($idLabel2, "tip of my label 2 is changed") MsgBox(0, "", "labels' Tips changed", 2) EndSwitch WEnd EndFunc ;==>Example Func _GUICtrlGetTip($iControlID) Local $sTipText = "" If $g_oToolTipDic.Exists(String(GUICtrlGetHandle($iControlID))) Then $sTipText = $g_oToolTipDic.Item(String(GUICtrlGetHandle($iControlID))) EndIf Return $sTipText EndFunc ;==>_GUICtrlGetTip Func _GUICtrlSetTip($iControlID, $sTipText, $sTipTitle = "", $iIcon = $TIP_NOICON, $iOptions = 0) If Not $g_oToolTipDic.Exists(String(GUICtrlGetHandle($iControlID))) Then $g_oToolTipDic.Add(String(GUICtrlGetHandle($iControlID)), $sTipText) Else $g_oToolTipDic.Item(String(GUICtrlGetHandle($iControlID))) = $sTipText EndIf GUICtrlSetTip($iControlID, $sTipText, $sTipTitle, $iIcon, $iOptions) EndFunc ;==>_GUICtrlSetTip Func _GUICtrlGetTip2() ;<<<<<<<<<<<<<<<<<<<<<<<<<<<< Local $aTipList = WinList("[CLASS:tooltips_class32]") Local $aRet For $i = 1 To $aTipList[0][0] ; See which one is active $aRet = _GUIToolTip_GetCurrentTool($aTipList[$i][1]) ; If one is active then display it If $aRet[8] <> "" Then MsgBox(0, "Visible Tip", $aRet[8]) Next EndFunc ;==>_GUICtrlGetTip21 point -
How to read control hint when created in Koda
argumentum reacted to Danyfirex for a topic
Hello. If you set the value on the fly you could store in a variable. It's a known value. just for fun #include <GUIConstantsEx.au3> #include <AutoItConstants.au3> Global $g_oToolTipDic = ObjCreate("Scripting.Dictionary") ;this for store all the Tooltips Example() Func Example() GUICreate("My GUI control tip") ; will create a dialog box that when displayed is centered Local $idLabel1 = GUICtrlCreateLabel("my label 1 - click me to get the tip text", 10, 20) _GUICtrlSetTip(-1, "tip of my label 1") Local $idLabel2 = GUICtrlCreateLabel("my label 2 - click me to get the tip text", 10, 60) _GUICtrlSetTip(-1, "tip of my label 2") Local $idbtn= GUICtrlCreateButton("Change Tips of label 1 and label 2",100,200,200,30) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idLabel1 MsgBox(0, "", _GUICtrlGetTip($idLabel1)) Case $idLabel2 MsgBox(0, "", _GUICtrlGetTip($idLabel2)) Case $idbtn _GUICtrlSetTip($idLabel1, "tip of my label 1 is changed") _GUICtrlSetTip($idLabel2, "tip of my label 2 is changed") MsgBox(0,"","labels' Tips changed",2) EndSwitch WEnd EndFunc ;==>Example Func _GUICtrlGetTip($iControlID) Local $sTipText = "" If $g_oToolTipDic.Exists(String(GUICtrlGetHandle($iControlID))) Then $sTipText = $g_oToolTipDic.Item(String(GUICtrlGetHandle($iControlID))) EndIf Return $sTipText EndFunc ;==>_GUICtrlGetTip Func _GUICtrlSetTip($iControlID, $sTipText, $sTipTitle = "", $iIcon = $TIP_NOICON, $iOptions = 0) If Not $g_oToolTipDic.Exists(String(GUICtrlGetHandle($iControlID))) Then $g_oToolTipDic.Add(String(GUICtrlGetHandle($iControlID)), $sTipText) Else $g_oToolTipDic.Item(String(GUICtrlGetHandle($iControlID))) = $sTipText EndIf GUICtrlSetTip($iControlID, $sTipText, $sTipTitle, $iIcon, $iOptions) EndFunc ;==>_GUICtrlSetTip Saludos1 point -
SPLIT .CSV
Earthshine reacted to Jos for a topic
Just change the process to read a record at a time. This will take longer but will be independent of the filesize. Jos1 point -
How to read control hint when created in Koda
Earthshine reacted to argumentum for a topic
Save the hint in a variable yourself, to keep track of what you set it as. ... $chkOptions7 = GUICtrlCreateCheckbox("EA Field.", 88, 312, 425, 17) GUICtrlSetFont($chkOptions7, 10, 400, 0, "MS Sans Serif") $chkOptions7_hint = "/EA" GUICtrlSetTip($chkOptions7, $chkOptions7_hint) ... GuiCtrlGetTip() does not exist1 point -
Hi, I would like to try some VB code that makes use of the WebBrowser Class. at this link there is an example script that I've tryed to use, but had not success. I get this serror: "DotNet\Examples\6) DotNet_LoadVBcode\DotNet_LoadVB_WebBrowser.au3" (14) : ==> The requested action with this object has failed.: $oForm1.Main() $oForm1^ ERROR Here is the AutoIt code I've used. I've saved in the DotNet\Examples\6) DotNet_LoadVBcode directory. #include "..\..\Includes\DotNetAll.au3" Opt("MustDeclareVars", 1) Example() MsgBox(0, "Debug", "Click OK to end program") Func Example() Local $oBrowser, $oCode = DotNet_LoadVBcode(FileRead("WebBrowser.vb"), "System.Windows.Forms.dll | System.Drawing.dll") If @error Then Return ConsoleWrite("DotNet_LoadVBcode ERR" & @CRLF) ConsoleWrite("DotNet_LoadVBcode OK" & @CRLF) Local $oForm1 = DotNet_CreateObject($oCode, "Form1") If IsObj($oForm1) Then $oForm1.Main() EndIf EndFunc ;==>Example I've also saved a file named WebBrowser.vb in the same directory containing the VB listing from the above link. (https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-add-web-browser-capabilities-to-a-windows-forms-application) I would be glad if someone could try this code and say how to modify it so to be run successfully. Thanks on advance.1 point
-
Handle Dynamically Generating Title Text
Earthshine reacted to Babu16 for a topic
Thanks for your prompt response, my problem has been resolved, i have used this technique 'removed the text after this string "Case:" in a title to solve my issue and still i'm able to recognize the controls though the text has been removed, thank you all.1 point -
fast way to read excel range into array?
AnonymousX reacted to antonioj84 for a topic
hey Water, actually I can read everything, " I am not limited to a few columns"my range is from column A1 to AI Local $oExcel =_Excel_Open(false) ; instantiate and hide excel $datawb = _Excel_BookOpen($oExcel,@ScriptDir & "\s5315.xlsm", 0) ;assign data to $datawb $datawb.worksheets("info").select ; select info tab $LastRow = $datawb.ActiveSheet.UsedRange.Rows.Count ; determine last row $mydata = _Excel_RangeRead($datawb, Default, "A1:AI" & $LastRow) ; read range from A1 to AI ;If IsArray($mydata) Then _ArrayDisplay($mydata) ; display spreadsheet data in the array _Excel_BookClose($datawb,True) A1 to AI until the last row1 point -
fast way to read excel range into array?
AnonymousX reacted to water for a topic
Most of the participating users have been offline for years And a lot has changed in AutoIt - especially since I have rewritten the Excel UDF Your example needs a few comment lines so that users can see that you "only" read a few columns from a spcific worksheet.1 point -
Copy text betwen two html tags using website source code
AnonymousX reacted to Neutro for a topic
Hello orichec, AutoIT is able to get source code from a web page using embedded Internet Explorer without having to copy paste it from notepad Also there were 2 mistakes in your script: 1°) ; Set UNIQUE start and end points for your extract $sStart = "<div class="grid_28 mgtop_30">" $sEnd = "<div id="specifications" Since your strings contains double quotes signs: " you need to surround them with single quote signs ' otherwise autoit will think the string is between "<div class=" only! 2°) If you look in help file of autoit for _StringBetween function, you will see that it returns an array and not a string. So to display it, you need to do this: MsgBox(0, "Extract", $sExtract[0]) or this _arraydisplay($sExtract) Try this out, it's working for me Note that i changed '<div id="specifications' to '<div class="_tabpage tabpage hidden legible specifications" id="specifications">' because it is what is return by Internet Explorer in opposite to firefox! This is because all web browser translate php code into html their own way, so what your read with Firefox won't be the same as Internet Explorer and Chrome #include <IE.au3> #include <String.au3> #include <Array.au3> ;getting the page source code and storing it into text file for easy reading it and debugging $file = fileopen(@scriptdir & "\source.txt", 10) $IE = _IECreate("http://www.softpedia.com/get/Tweak/System-Tweak/Edge-Blocker.shtml", 0, 0) $source = _IEDocReadHTML($IE) FileWrite($file, $source) ;extracting source code between <div class="grid_28 mgtop_30"> and <div class="_tabpage tabpage hidden legible specifications" id="specifications"> $target_source = _StringBetween($source, '<div class="grid_28 mgtop_30">', '<div class="_tabpage tabpage hidden legible specifications" id="specifications">') msgbox("","",$target_source[0]) _IEQuit($IE) fileclose($file)1 point -
Notepad Save file in user desktop directory as HTML
AnonymousX reacted to confused2gether for a topic
Im guessing too that works behind the scenes and is silent which is million times better than what im doing right now lol. Although this is just a simple quickie program, silent would still be nice. Now im guessing that if I needed to have it input information it would be something like this: $htmlCode &= "<a href = {ASC 034}mailto:" & $emailAddress & "{ASC 034}>" & $emailAddress & "</a>" & @CRLF $emailAddress would be coming from an inputbox {ASC 034} is the double quote Does that seem correct?1 point