Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/04/2019 in all areas

  1. Here's a very simple example of validating that json is well-formed and extracting a value from well-formed JSON: #include <SQLite.au3> example() Func example() Const $TEST_JSON = _ '{' & _ ' "manifest_version": 2,' & _ ' "name": "Google Apps Certification app",' & _ ' "description": "Link to Google Apps Certification website",' & _ ' "version": "1.1",' & _ ' "icons": {' & _ ' "128": "128.png"' & _ ' },' & _ ' "app": {' & _ ' "urls": [' & _ ' "http://certification.googleapps.com/app-info/"' & _ ' ],' & _ ' "launch": {' & _ ' "web_url": "http://certification.googleapps.com/"' & _ ' }' & _ ' },' & _ ' "permissions": [' & _ ' "unlimitedStorage",' & _ ' "notifications"' & _ ' ]' & _ '}' Const $SQLITE_DLL = "c:\program files\sqlite\sqlite3.dll" ;<-- Change to the location of your sqlite dll Local $aRow Local $hQuery ;Init sqlite and create a memory db _SQLite_Startup($SQLITE_DLL, False, 1) If @error Then Exit MsgBox($MB_ICONERROR, "SQLite Error", "Unable to start SQLite. Check existence of DLL") _SQLite_Open() ;Example of validating json (Good return means JSON is well-formed) If _SQLite_Query(-1, "select json('" & $TEST_JSON & "');", $hQuery) = $SQLITE_OK Then While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK ConsoleWrite("Minimized JSON = " & $aRow[0] & @CRLF) WEnd EndIf ;Example of extracting data If _SQLite_Query(-1, "select json_extract('" & $TEST_JSON & "', '$.version');", $hQuery) = $SQLITE_OK Then While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK ConsoleWrite("version = " & $aRow[0] & @CRLF) WEnd EndIf ;Close db and shutdown sqlite _SQLite_Close() _SQLite_Shutdown() EndFunc
    3 points
  2. A funny workaround #include <Array.au3> $strString = "/function?fax=12345&phone=67890&mobile=0123456" IniWriteSection(@scriptdir &"\tmp.ini", "tmp", StringReplace(StringReplace($strString, "/function?", ""), "&", @LF)) $array = IniReadSection(@scriptdir &"\tmp.ini", "tmp") FileDelete(@scriptdir &"\tmp.ini") _ArrayDisplay($array)
    2 points
  3. @YouDontKnowMe, Great first post to get attention.
    2 points
  4. 1/02/2018: Uploaded a new SciTe4AutoIt3.exe v19.102.1901.0 installer. This version contains the bugfix release for SciTE 4.1.2. There has been a major update for Tidy allowing now inline comments without them being shifted to the left by default. See this thread for the total story about the new behavior and the added options ==> SciTE4AutoIt3 v19.102.1901.0 Enjoy, Jos Addition/Changes/Fixes in the current installer: -------------------------------------------------------------------------------------------------- 2-1-2019 *** Merged the SciTE v 4.1.2 by Neil Hodgson with our own version of SciTE. (Jos) - Fixed regex issue for Alt+F in AutoItTools.lua - Fixed another regex issue for several functions in AutoItTools.lua - Fixed Header parameters now showing None when none are - Fixed jump to function to also jump to the right Column again. - Restored AutoItTools:Copy_BookMarks() functionality *** Updated AutoIt3Wrapper v19.102.1901.0 (Jos) - 18.703.1808.1 renamed "#AutoIt3Wrapper_Au3Stripper_Stop_OnError" to "#AutoIt3Wrapper_Au3Stripper_OnError" with now as options S,C,F,Stop,Continue,ForceUse - 18.708.1148.1 Added #include <WinAPIFiles.au3> back in the included file list to ensure backward compatibility. - 18.708.1148.2 Added "Tidy_Stop_OnError" support to the AutoIt3Wrapper.INI file. Changed HiDPI settings for Win 10 compatibility. - 18.708.1148.4 Added logic to be able to display Console Output of script that have #RequireAdmin while SciTE runs at normal level. - 18.708.1148.5 Added support to allow to Stop Execution or Restart for scripts with #RequireAdmin while SciTE runs at normal level. It won't hang anymore when you reply No on the UAC and detect the elevated process didn;t start. - 18.708.1148.6 Reverted HiDPI changes made in 18.708.1148.2 as problems are reported. needs investigation. - 18.708.1148.7 Changed check for RequireAdmin AutoIt3Wrapper startup. - 18.708.1148.8 Added #include <APIResConstants.au3> for backwards compatibility with AutoIt3 v3.3.14.x. *** Updated Au3Stripper v19.102.1901.0 (Jos) - 18.708.1148.1 Fixed issue finding variable names on multiline statements - 18.708.1148.2 Added check for ending \ in the AutoIt3Dir, and remove it when there, to avoid duplication of includes. - recompiled with PellesC 6 to make it compatible with WinXP again. *** Updated SciTEConfig v19.102.1901.0 (Jos) - 18.708.1148.1 Update to allow comments in *.SciTEConfig file lines. (JPM) This update includes the updated shemes to allow changing between them. *** Updated Tidy v19.102.1901.0 (Jos) - 18.708.1148.1: Fix bug handling Directivelines ending with continuation character - 18.708.1148.2: Fixed indentation when a "None breaking space"(C2A0) character is used in a UTF file. - 18.708.1148.3: Fix bug when a continuation line starts with +x, where is would add a space between +- and number. - 18.708.9999.x: Rewrite of some internal code to allow inlinecomments to remain at their current position. Details can be found in this post: https://www.autoitscript.com/forum/topic/196221-tidy-major-update-27-10-requesting-help-with-testing/ - 18.708.9999.22: Released to Beta. - 18.708.9999.23: Added option to totally skip commentblocks so now the options are: #Tidy_Parameters=/tcb=0 =>only indent the whole commentblock (default) /tcb or /tcb=1 =>Tidy inside commentblock /tcb=-1 =>leave whole commentbock alone Tidy.INI:#--> Tidy commentblock 0=only indent the whole commentblock (default=0) # 1=Tidy inside commentblock # -1=leave whole commentbock alone Tidy_commentblock=0 - 18.708.9999.24: Added check for ending \ in the AutoIt3Dir and remove it when there. - recompiled with PellesC 6 to make it compatible with WinXP again. -------------------------------------------------------------------------------------------------- ==> ScitillaHistory page containing all SciTE-Scintilla updates. ==> Visit the SciTE4AutoIt3 Download page for the latest versions ==> Check the online documentation for an overview of all extra's you get with this installer.
    1 point
  5. This is what I used as a guide for the script: https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/determining-whether-a-leak-exists basically look at: PoolNonpagedBytes, PoolPagedBytes, PageFileBytes
    1 point
  6. Sorry my bad, just delete that variable its not required.
    1 point
  7. Just add Local $sResult to the top of the function Func DeleteCourseBegin() Local $sResult ... EndFunc
    1 point
  8. No The error means you've called SearchCourse without any parameter, so look for the following and remove it since its been called within the loop. SearchCourse()
    1 point
  9. Can you try changing: SearchCourse($aSearchResult) To SearchCourse($_sSearchResult) And change: _IEFormElementSetValue($oSearchString, $aSearchResult) To _IEFormElementSetValue($oSearchString, $_sSearchResult)
    1 point
  10. My new program GetGOG Wishlist, has been updated to v1.1. See previous post. (v1.1) Bugfix for faulty number comparison. Added a 'CLEAR LAST PRICE' button and process. Finally remembered to add code to clear the list before Loading or Updating. Made all loading slicker and therefor faster (NOTE - This can be turned off in the 'Options.ini' file manually, by setting 'slick=1' to another number. Thus allowing you to see the ListView being populated ... much slower though.). Fair speed improvement on my slow Netbook.
    1 point
  11. jchd

    parsing html parameters

    Beware that [D] doesn't do what you seem to expect: it means the 'D' character. You probably meant \D instead (no need of the square brackets either).
    1 point
  12. jchd

    JSON as AutoIt data type

    FYI SQLite JSON1 functions work like a charm. I know you're using SQLite a lot so this may be a decent solution. Just store your JSON source in a temp table and peek-poke in from there. You can as well issue a direct query without having to store it first in case the desired operation (creation, extraction, modification) isn't repetitive.
    1 point
  13. It would be faster to just grab all of A:A into an array and loop through the results and create a second array to hold the "Yes/No" here is an example untested: #include <Array.au3> #include <Excel.au3> Global $sChosenFileName = "Filename.xlsx" Global $aBBTableData Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookOpen($oExcel, $sChosenFileName) ;~ Get all used cells in column A:A Global $aSearchItems = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A")) ;~ Duplicate the $aSearchItems Array Global $aSearchResult = $aSearchItems ;~ Loop through $aSearchItems ;~ Since Excel_RangeRead returns a 0-based Array and since we only captured one column it is a 1 dimension array ;~ Loop through the array starting at 0 until the end of the array which is (Ubound($aSearchItems) - 1) For $i = 0 To UBound($aSearchItems) - 1 $aSearchResult[$i] = SearchCourse($aSearchItems[$i]) Next _ArrayDisplay($aSearchItems, "Search Items") _ArrayDisplay($aSearchResult, "Search Results") ;~ Paste the results back to Excel in column B1 _Excel_RangeWrite($oWorkbook, Default, $aSearchResult, "B1") Func SearchCourse($_sSearch) _IENavigate($oIE, $urlBBCourseSearch) ;~ Change the search criteria to "Course ID" _bbCourseSearchCategoryChange("Course ID") ;~ Paste whats copied into the search text box and click submit Local $oForm = _IEGetObjByName($oIE, "courseManagerFormSearch") Local $oSearchString = _IEFormElementGetObjByName($oForm, "courseInfoSearchText") _IEFormElementSetValue($oSearchString, $_sSearch) _IEFormSubmit($oForm) ;~ Lets see what we got from the search Local $oBBTable = _IETableGetCollection($oIE, 2) $aBBTableData = _IETableWriteToArray($oBBTable) _ArrayDisplay($aBBTableData) DeleteCourseBegin() EndFunc ;==>SearchCourse ;~ OK, we logged in and we searched for a course. Lets delete it! Func DeleteCourseBegin() $iSearchIndex = _ArraySearch($aBBTableData, "Course ID", 0, 0, 0, 1, 1, 0) ;~ If the course was not found, do this. If $iSearchIndex = -1 Then MsgBox(4096, "Search Error", "Item not found") $sResult = "No" ;~ Now go back to the Excel sheet and search for the next one....? ;~ If the course was found, begin the deletion process. Else MsgBox(4096, "Search Success", $aBBTableData[$iSearchIndex][0] & " = " & $aBBTableData[$iSearchIndex][1]) DeleteCourseNow() $sResult = "Yes" EndIf Return $sResult EndFunc ;==>DeleteCourseBegin ;~ The course search was successful. Delete the course now. Func DeleteCourseNow() ;~ Click the checkbox located beside the course that has been found. Local $CheckBox = _IEGetObjByName($oIE, "ckbox") _IEAction($CheckBox, "click") _IELoadWait($oIE) ;~ Click the Delete button. _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks If $oLink.href = "javascript:validateRemove();" Then _IEAction($oLink, "click") ExitLoop EndIf Next ;~ Click the "Delete course, including all of its files" radio button. Local $RadioButton = _IEGetObjById($oIE, "removeAllFiles_t") _IEAction($RadioButton, "click") _IELoadWait($oIE) ;~ Click the "Submit" button Local $Submit = _IEGetObjByName($oIE, "bottom_Submit") _IEAction($Submit, "click") _IELoadWait($oIE) ;~ Now go back to the Excel sheet and search for the next one....? EndFunc ;==>DeleteCourseNow
    1 point
  14. @XinYoung You can do this easily with _Excel_RangeWrite. Something like this should get you started: #include <Excel.au3> Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\Test1.xlsx") Local $oRange = _Excel_RangeRead($oWorkbook, Default, Default) For $a = 1 To UBound($oRange) ;Do other Stuff _Excel_RangeWrite($oWorkbook, Default, "This is cell B" & $a, "B" & $a) Next _Excel_BookClose($oWorkbook) _Excel_Close($oExcel) If your columns have headers, you'll have to adjust by one.
    1 point
  15. If you do this after you make your workbook object, you will get the size of the excel workbook (know what the last line of the excel file will be). #include <array.au3> $array = _Excel_RangeRead($oWorkbook) $size = Ubound($array) Give adding in a loop a try now that you know the size. If you are still struggling with it, let us know!
    1 point
  16. select * from sqlite_master returns all the DDL statements you need. You may need to first extract the rows having type = 'table', then 'index' then 'trigger' then 'view', then ... After that you may have to reorder CREATE TABLE statements so that foreign keys work in the correct order.
    1 point
  17. UPDATE: The issue got solved. I incorrectly compiled the median.dll. It seems that despite me using MinGQ-W64, I somehow messed up the install and the compiled DLL ended up being 32bit (I'm using a 64bit SQLite DLL). I re-installed MinGQ-W64, recompiled the DLL and it works now. For all of you having issues with JCHD's SQLiteExtLoad.au3, replace '$g_hDll_SQLite' with '$__g_hDll_SQLite'. Thanks for you help mr. @user4157124
    1 point
  18. Yes you can include coordinates and other information, such keys Ctrl Shift etc. held down. If you want to learn the details check out this link. http://msdn.microsoft.com/en-us/library/ms645607(v=vs.85).aspx #include <SendMessage.au3> #include <WindowsConstants.au3> Local $hWndControl = 0 ; Set to handel of the control Local $x = 50 ; X coord for Mouse click Local $y = 20 ; Y coord for Mouse click Local $wParam = 0 Local $lParam = BitRotate($x,16,"D") $lParam = BitXOR($lParam,$y) _SendMessage($hWndControl, $WM_LBUTTONDOWN,$wParam,$lParam) _SendMessage($hWndControl, $WM_LBUTTONUP,$wParam,$lParam)
    1 point
  19. You could try sending windows messages directly #include <SendMessage.au3> #include <WindowsConstants.au3> _SendMessage($hWndControl, $WM_LBUTTONDOWN) _SendMessage($hWndControl, $WM_LBUTTONUP)
    1 point
  20. Hi Lilbert, the line endings (used) to be different with all the operating systems. UNIX uses @LF to mark a line end, WINDOWS @CRLF (I think MAC and @CR). So if you use Notepad you'll see that some of the line ends are not recognized. As you use @CRLF it creates two characters and that's by design. You could replace @CRLF with a "@CR & @LF". So for your question: When you want to work with the files in Windows use @CRLF.
    1 point
×
×
  • Create New...