Jump to content

Search the Community

Showing results for tags 'debugging'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 6 results

  1. So far, I've stuck to MsgBox and ConsoleWrite to debug scripts (+some SciTE Syntax Checks), but looking for something a little better. It seems both Heron's Debugger: http://www.autoitscript.com/forum/index.php?showtopic=103142 and "Another Debugger for Autoit" have been abandoned. I'm curious what tools forum members are using to debug scripts?
  2. I find this useful as programs get big and I can't keep the whole program and variables and globals in myhead. It simply scans your program and spits out into separate Notepad files with line numbers for: #include Dim Global Local Cost Func $ Variables It's *NOT* a polished program with graphs or diagrams but it helps me and I'm submitting it as my first example script. #AutoIt3Wrapper_run_debug_mode=Y ;use this to debug in console window <--- LOOK ;recall ;debug toggles debug - so search for and change ;debug to ;;debug AutoItSetOption("MustDeclareVars", 1) #include <Debug.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <StaticConstants.au3> ;for $SS_CENTER #include <WindowsConstants.au3> Global $debug = 0 ;0=off 1=on If $debug > 0 Then Msgbox(0+262144,"Info","@AutoItVersion = " & @AutoItVersion) Global $Author = "ahha" ;v1a - original ;... ;v1j - changed Send to copy and paste ;v2a - adding checkboxes ;v2b - cleaning up some code ;v2c - setting up a Label to show the file drop zone ;v2d - adding $h_StatusWindow status window and display message - eventually got rid of this in favor of a scrolling window ;v2e - need to strip WS in front before any searches except for $Variable ; #include, Dim Global Local Const, Func - all need to be first after stripping leading whitespace (WS) ; $Variable can be anywhere - even in a comment ; this means commented out #include, Dim Global Local Const, Func will NOT be shown ; Perhaps have a Checkbox to include/exclude commented out ;v2f - add the checkbox for commented out ;v2g - cleaned up some code, program not perfect as it catches extra stuff like comment ;for $SS_CENTER as a variable ; also duplicates of the same line especially for Dim Global Local Const, Func ; gets the job done and useful ;v2h - adding info about hotkeyset so user can abort processing ;v2i - getting rid of duplicate lines from Dim Global Local Const, Func processing ;v2j - getting rid of extraneous code ;v2k - combining open and paste to Notepad, pop Program Status window to top to show processing (don't keep user in the dark) ;v2ka - setting window order so user knows we're processing ;v2kb - cleaning out more extraneous code ;v2kc - cleaning out even more extraneious code Global $version = "v2kc" ;released to AutoIt on 2023-02-11 ;possible future improvements/features ;on large files >10k lines it can be slow doing 4 iterations, may want to do a single pass of reading the array to speed it up ;program lists some stuff like #include "DateTimeConstants.au3" as a Const because we don't filter fully - but not harmful Global $hSTBEdit, $hSTBGUI ;for Scrolling Text Box __scrolling_text_box_init() ;set up box - to display text use: __scrolltext($text) Global $fPaused = False HotKeySet("^q", "TogglePause") ;Crtl+q Global $QUOTE = Chr(34) ;0x22 Global $hNP ;handle for NotePad Global $iColorBlack = 0x000000, $iColorRed = 0xff0000, $iColorGreen = 0x00ff00, $iColorBlue = 0x0000ff, $iColorYellow = 0xffff00, $iColorWhite = 0xffffff, $iColorReddish = 0xF57670 Global $hGUI = GUICreate("Program Listings " & $version & " >> USE: Crtl+q to Toggle/Pause/Abort", 700, 400, Default, Default, Default, $WS_EX_ACCEPTFILES) GUICtrlSetBkColor($hGUI, $iColorRed) ;;debug the background for width of field - remember ;debug toggles it so use ;;debug Global $id_Line1 = GUICtrlCreateLabel("Drop an .au3 file in the green region to automatically generate the Listings selected with line numbers.", 10, 10) Global $id_Line2 = GUICtrlCreateLabel("Each Listing will be in a separate Notepad file.", 10, 10+20) Global $id_Line3 = GUICtrlCreateLabel("As an example go to AutoIt3\Include and drag and drop in file Date.au3", 10, 10+20+20) Global $id_Line4 = GUICtrlCreateLabel("Listings:", 10, 10+20+20+50) ;Global $id_LabelDrop = GUICtrlCreateInput("Drop your .au3 file here.", 700-280, 400-350, 200, 100, Default, $WS_EX_ACCEPTFILES) ;<-- this screws up Global $id_LabelDrop = GUICtrlCreateInput("Drop your .au3 file here.", 700-280, 400-350, 200, 100) ;<-- this works GUICtrlSetBkColor($id_LabelDrop, $iColorGreen) ;;debug the background for width of field GUICtrlSetState($id_LabelDrop, $GUI_DROPACCEPTED) GUISetState(@SW_SHOW) Global $id_CheckboxComment, $id_CheckboxInclude, $id_CheckboxDimGlobalLocalConst, $id_CheckboxFunc, $id_CheckboxVariables CreateCheckboxComment() CreateCheckboxInclude() CreateCheckboxDimGlobalLocalConst() CreateCheckboxFunc() CreateCheckboxVariables() ;for use in While 1 Local $nMsg, $i = 0 Global $file, $aFile Opt("SendKeyDelay", 0) ;Alters the length of the brief pause in between sent keystrokes. A value of 0 removes the delay completely. Time in milliseconds to pause (default=5). Dim $aA[1] ;for debug Const $xA = 0 ;for debug While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Msgbox(0+262144,"Info","Exiting program", 1) Exit Case $GUI_EVENT_DROPPED ;Pause("In: Case $GUI_EVENT_DROPPED") $file = @GUI_DragFile Msgbox(0+262144,"Info","Dropped filename = '" & $file & "'") _FileReadToArray($file, $aFile, $FRTA_COUNT) ;_DebugArrayDisplay($aFile, "Array of: '"& $file & "'") ;NOTA BENE - _DebugArrayDisplay STRIPS leading WS !!! for display only ; #include processing If GUICtrlRead($id_CheckboxInclude) = $GUI_CHECKED Then ;proceed to generate #include listing Msgbox(0+262144,"Info","Proceeding to generate #include listing", 1) __scrolltext(@CRLF & "Info: Proceeding to generate #include listing" & @CRLF) Local $sTitle = "#include list for: '" & $file & "'" & @CRLF & _ "Line number #include" & @CR & _ "----------- --------" & @CRLF _SetWindowOrder($hSTBGUI, $hGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Local $sString = "" Local $sLineStr = "" ;operational string without WS in front ;v2e Local $sSkip = "no" If GUICtrlRead($id_CheckboxComment) = $GUI_CHECKED Then $sSkip = "yes" ;Pause("$sSkip = '" & $sSkip & "'") For $i = 1 to $aFile[0] ;[0] has count __scrolltext("Reading line " & $i & "/" & $aFile[0] & " = '" & $aFile[$i] & "'" & @CRLF) $sLineStr = StringStripWS($aFile[$i], $STR_STRIPLEADING) ;v2e need to strip WS in front If ( (StringLeft($sLineStr, 1) = ";") AND ($sSkip = "yes") ) Then ;2f - skip line if commented out Else ;process it if line is not commented out ;v2f - include anywhere in line !! not just left justified ;convert string to lower case If StringInStr(StringLower($aFile[$i]), "#include") Then $sString = $sString & $i & " " & $aFile[$i] & @CR ;just look for "#include" EndIf Next $hNP = _OpenAndPasteToNotepad($sTitle & $sString) _SetWindowOrder($hNP, $hGUI, $hSTBGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Beep(500, 1000) ;to indicate done EndIf ; Dim Global Local Const processing If GUICtrlRead($id_CheckboxDimGlobalLocalConst) = $GUI_CHECKED Then ;proceed to generate Dim Global Local Const listing Msgbox(0+262144,"Info","Proceeding to generate Dim Global Local Const listing", 1) __scrolltext(@CRLF & "Info: Proceeding to generate Dim Global Local Const listing" & @CRLF) Local $sTitle = "Dim Global Local Const list for: '" & $file & "'" & @CRLF & _ "Line number Dim Global Local Const" & @CR & _ "----------- ----------------------" & @CRLF _SetWindowOrder($hSTBGUI, $hGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Local $sString = "" Local $sLineStr = "" ;operational string without WS in front ;v2e Local $sSkip = "no" If GUICtrlRead($id_CheckboxComment) = $GUI_CHECKED Then $sSkip = "yes" Local $flag = 0 For $i = 1 to $aFile[0] ;[0] has count __scrolltext("Reading line " & $i & "/" & $aFile[0] & " = '" & $aFile[$i] & "'" & @CRLF) $sLineStr = StringStripWS($aFile[$i], $STR_STRIPLEADING) ;v2e need to strip WS in front $flag = 0 If ( (StringLeft($sLineStr, 1) = ";") AND ($sSkip = "yes") ) Then ;2f - skip line if commented out Else ;process it if line is not commented out ;v2f - include anywhere in line !! not just left justified ;convert string to lower case ;probably could do this with a Case or Switch If StringInStr(StringLower($aFile[$i]), "dim") Then $flag = 1 If StringInStr(StringLower($aFile[$i]), "global") Then $flag = 1 If StringInStr(StringLower($aFile[$i]), "local") Then $flag = 1 If StringInStr(StringLower($aFile[$i]), "const") Then $flag = 1 If $flag = 1 Then $sString = $sString & $i & " " & $aFile[$i] & @CR EndIf Next $hNP = _OpenAndPasteToNotepad($sTitle & $sString) _SetWindowOrder($hNP, $hGUI, $hSTBGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Beep(500, 1000) ;to indicate done EndIf ; Func processing If GUICtrlRead($id_CheckboxFunc) = $GUI_CHECKED Then ;proceed to generate Func listing Msgbox(0+262144,"Info","Proceeding to generate Func listing", 1) __scrolltext(@CRLF & "Info: Proceeding to generate Func listing" & @CRLF) Local $sTitle = "Func list for: '" & $file & "'" & @CRLF & _ "Line number Func" & @CR & _ "----------- ----" & @CRLF _SetWindowOrder($hSTBGUI, $hGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Local $sString = "" Local $sLineStr = "" ;operational string without WS in front ;v2e Local $sSkip = "no" If GUICtrlRead($id_CheckboxComment) = $GUI_CHECKED Then $sSkip = "yes" For $i = 1 to $aFile[0] ;[0] has count __scrolltext("Reading line " & $i & "/" & $aFile[0] & " = '" & $aFile[$i] & "'" & @CRLF) $sLineStr = StringStripWS($aFile[$i], $STR_STRIPLEADING) ;v2e need to strip WS in front If ( (StringLeft($sLineStr, 1) = ";") AND ($sSkip = "yes") ) Then ;2f - skip line if commented out Else ;process it if line is not commented out ;v2f - include anywhere in line !! not just left justified If StringInStr(StringLower($aFile[$i]), "func") Then $sString = $sString & $i & " " & $aFile[$i] & @CR ;just look for "Func" EndIf Next $hNP = _OpenAndPasteToNotepad($sTitle & $sString) _SetWindowOrder($hNP, $hGUI, $hSTBGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Beep(500, 1000) ;to indicate done EndIf ; $ Variables processing If GUICtrlRead($id_CheckboxVariables) = $GUI_CHECKED Then ;proceed to generate $ Variables listing Msgbox(0+262144,"Info","Proceeding to generate $ Variables listing", 1) __scrolltext(@CRLF & "Info: Proceeding to generate $ Variables listing" & @CRLF) Local $sTitle = "$ Variables list for: '" & $file & "'" & @CRLF & _ "Line number $ Variables" & @CR & _ "----------- -----------" & @CRLF _SetWindowOrder($hSTBGUI, $hGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Local $sString = "" Local $sLineStr = "" ;operational string without WS in front ;v2e Local $sSkip = "no" If GUICtrlRead($id_CheckboxComment) = $GUI_CHECKED Then $sSkip = "yes" For $i = 1 to $aFile[0] ;[0] has count __scrolltext("Reading line " & $i & "/" & $aFile[0] & " = '" & $aFile[$i] & "'" & @CRLF) $sLineStr = StringStripWS($aFile[$i], $STR_STRIPLEADING) ;v2e need to strip WS in front If ( (StringLeft($sLineStr, 1) = ";") AND ($sSkip = "yes") ) Then ;2f - skip line if commented out Else ;process it if line is not commented out ;v2f - include anywhere in line !! not just left justified ;convert string to lower case If StringInStr(StringLower($aFile[$i]), "$") Then $sString = $sString & $i & " " & $aFile[$i] & @CR ;just look for "$" EndIf Next $hNP = _OpenAndPasteToNotepad($sTitle & $sString) _SetWindowOrder($hNP, $hGUI, $hSTBGUI) ;sets windows in order leftmost top, etc. Paints back (right) to front (left) Beep(500, 1000) ;to indicate done EndIf Beep(200, 1000) ;to indicate done processing Case $id_LabelDrop ;Pause("In: Case $id_LabelDrop") ;comment out so don't process as checkbox activation/deactivation somethimes triggers to here EndSwitch WEnd Exit ;should never hit this ;------------------------------ Functions ------------------------- Func _SetWindowOrder($hWin1, $hWin2 = "", $hWin3 = "", $hWin4 = "", $hWin5 = "", $hWin6 = "", $hWin7 = "", $hWin8 = "") ;sets windows in order leftmost top, etc. Paints back (right) to front (left) ;handles at most 8 windows WinSetOnTop($hWin8, "", $WINDOWS_ONTOP) WinSetOnTop($hWin8, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin7, "", $WINDOWS_ONTOP) WinSetOnTop($hWin7, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin6, "", $WINDOWS_ONTOP) WinSetOnTop($hWin6, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin5, "", $WINDOWS_ONTOP) WinSetOnTop($hWin5, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin4, "", $WINDOWS_ONTOP) WinSetOnTop($hWin4, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin3, "", $WINDOWS_ONTOP) WinSetOnTop($hWin3, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin2, "", $WINDOWS_ONTOP) WinSetOnTop($hWin2, "", $WINDOWS_NOONTOP) WinSetOnTop($hWin1, "", $WINDOWS_ONTOP) WinSetOnTop($hWin1, "", $WINDOWS_NOONTOP) ; Local $i ; For $i = 8 to 1 Step - 1 ;using Assign() and Eval() commands EndFunc ;Func _SetWindowOrder($hWin1, $hWin2 = "", $hWin3 = "", $hWin4 = "", $hWin5 = "", $hWin6 = "", $hWin7 = "", $hWin8 = "") Func _OpenAndPasteToNotepad($sString) Run("notepad.exe") $hNP = WinWaitActive("Untitled - Notepad") ;Global above ClipPut($sString) ;put to clipboard for faster pasting WinActivate($hNP) WinWaitActive($hNP) Send("^v") ;Ctrl+v to paste it in Return($hNP) ;so can use it if needed EndFunc ;Func _OpenAndPasteToNotepad($sString) Func CreateCheckboxComment() $id_CheckboxComment = GUICtrlCreateCheckbox("Exclude if line commented out (i.e. starts with ; )", 30+100, 10+20+20+50-5, 280, 25) ;Global above GUICtrlSetState($id_CheckboxComment, $GUI_CHECKED) GUICtrlSetTip($id_CheckboxComment, "UNCheck this if you want to have a listing that includes commented out lines in the program file.") ;GUICtrlSetBkColor($id_CheckboxComment, $iColorYellow) ;;debug the background for width of field EndFunc ;Func CreateCheckboxComment() Func CreateCheckboxInclude() $id_CheckboxInclude = GUICtrlCreateCheckbox("#include", 30, 100+25, 200, 25) ;Global above GUICtrlSetState($id_CheckboxInclude, $GUI_CHECKED) GUICtrlSetTip($id_CheckboxInclude, "Check this if you want to have a listing of #includes in the program file.") ;GUICtrlSetBkColor($id_IncludeCheckbox, $iColorYellow) ;;debug the background for width of field EndFunc ;Func CreateCheckboxInclude() Func CreateCheckboxDimGlobalLocalConst() $id_CheckboxDimGlobalLocalConst = GUICtrlCreateCheckbox("Dim Global Local Const", 30, 100+25+25, 200, 25) ;Global above GUICtrlSetState($id_CheckboxDimGlobalLocalConst, $GUI_CHECKED) GUICtrlSetTip($id_CheckboxDimGlobalLocalConst, "Check this if you want to have a listing of Dim Global Local and Const in the program file.") ;GUICtrlSetBkColor($id_CheckboxDimGlobalLocalConst, $iColorYellow) ;;debug the background for width of field EndFunc ;Func CreateCheckboxInclude() Func CreateCheckboxFunc() $id_CheckboxFunc = GUICtrlCreateCheckbox("Func", 30, 100+25+25+25, 200, 25) ;Global above GUICtrlSetState($id_CheckboxFunc, $GUI_CHECKED) GUICtrlSetTip($id_CheckboxFunc, "Check this if you want to have a listing of Func in the program file.") ;GUICtrlSetBkColor($id_CheckboxFunc, $iColorYellow) ;;debug the background for width of field EndFunc ;Func CreateCheckboxFunc() Func CreateCheckboxVariables() $id_CheckboxVariables = GUICtrlCreateCheckbox("$ Variables", 30, 100+25+25+25+25, 200, 25) ;Global above GUICtrlSetState($id_CheckboxVariables, $GUI_CHECKED) GUICtrlSetTip($id_CheckboxVariables, "Check this if you want to have a listing of $ Variables in the program file.") ;GUICtrlSetBkColor($id_CheckboxVariables, $iColorYellow) ;;debug the background for width of field EndFunc ;Func CreateCheckboxVariables() Func __scrolling_text_box_init() Local $limit, $x ;from http://www.autoitscript.com/forum/topic/110948-add-text-to-edit-box-and-scroll-it-down/page__p__971158__hl___guictrledit_scroll__fromsearch__1#entry971158 ;Global $hSTBEdit, $hSTBGUI ;for Scrolling Text Box $hSTBGUI = GUICreate("Program Status - Program listings " & $version, 750, 500) $hSTBEdit = GUICtrlCreateEdit("", 10, 10, 730, 480, BitOr($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) ;$limit = 9223372036854775807 ;2^63 $limit = 1000000000 ;works $x = GUICtrlSetLimit($hSTBEdit, $limit) ;~ If $x = 0 Then ;~ MsgBox(0, "ERROR", "Limit of " & $limit & " is too large.") ;~ Else ;~ MsgBox(0, "Okay", "Limit of " & $limit & " is okay.") ;~ EndIf ;$hButton = GUICtrlCreateButton("Add", 10, 250, 80, 30) GUISetState() EndFunc ;Func __scrolling_text_box_init() Func __scrolltext($text) GUICtrlSetData($hSTBEdit, $text, 1) EndFunc ;Func __scrolltext($text) Func TogglePause() Local $ans = MsgBox(0 + $MB_YESNO + $MB_ICONQUESTION + $MB_TOPMOST + $MB_DEFBUTTON1, "Program paused.", "Do you want to Quit the program?") ;make Yes the default If $ans = $IDYES Then ;MsgBox(0 + $MB_OK + $MB_ICONQUESTION + $MB_TOPMOST, "Program quitting", "Please wait as program finishes the operation and then exits.") Exit ;exit entire program EndIf EndFunc ;Func TogglePause() Func Pause($text="") ;__scrolltext("Debug: Paused " & $text & @CRLF) MsgBox(262144, "DEBUG", "Paused: " & $text) EndFunc ;Func Pause($text="")
  3. Hi! I'm using Maps (and I love 'em!), so I have to use the latest AutoIt Beta. I've switched to Beta mode, and the graphical debugger doesn't even show up in the Explorer context menu (not surprising). So I'd like to use _Dbug (rather than a large number of MsgBox statements), but it fails when it encounters a Map function (such as MapExists). I've made a request for a version that will work with the Beta, but going on past history, I don't expect an answer anytime soon. I'm not necessarily asking for someone else to modify _Dbug, because I can probably do it myself, as long as I know how to adapt it to use the Beta. Can someone please enlighten me as to how to adapt a UDF or other function to use AutoIt Beta? Thanks!
  4. Hey guys, So we recently moved our company Knowledge Base to an in-house solution rather than paying a monthly subscription for someone else to host it and use their features. Either way, we have moved from one KB (Knowledge Base) site to another but there is an issue. No one restricted access to the original KB site which meant anyone was able to edit the site as they pleased. This means that some of the old KB's features (picture/video/internal links) are still be utilized and I need to find out which pages have links that inevitably go dead once we stop sending them money. So, I feel like in 90% of the way to getting this working correctly. Steps are fairly simple: Log into the KB Load a list of URL's Pull the HTML and search for "helpjuice" Log the URL has been checked Check for links on this page and check it against the list of URL's Log any new URL's that are missing from the list Now, I have no idea if this is the best way of doing this process but, again, I've made it 90% of the way so far and I would like to figure this specific problem out and if anyone has a better/more effective method of doing this, please point me in the right direction! Here is the Code i have so far. #include <File.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <IE.au3> #include <MsgBoxConstants.au3> #include <Array.au3> Global $aGlobalLinks[1][3] = [["Link", "Checked", "Hit"]] ;Create Array with Headers ;//Load KB and login by submit the login form. Local $oIE = _IECreate ("https://website.com/kb/") Local $oForm = _IEFormGetObjByName($oIE, "login-form") Local $oEmail = _IEFormElementGetObjByName($oForm, "email") Local $oPassword = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oEmail, "email@email.com") _IEFormElementSetValue($oPassword, "password") Sleep(500) _IEFormSubmit($oForm) ;_IEQuit($oIE) ;//Load a second window to confirm it shows we are logged in. Grab a list of links as a jumping off point if the KB_URL.txt is empty ;//Mainly used for Debugging Local $oIE = _IECreate ("https://website.com/kb/") $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks _ArraySearch($aGlobalLinks, $oLink.href) If @error = 6 Then Local $aFill[1][3] = [[$oLink.href, "No", "No"]] _ArrayAdd($aGlobalLinks, $aFill) EndIf Next ;//Close second window of IE _IEQuit($oIE) ;//Attempt to load the KB_URL.txt LoadFile() ;//Setting $r to 1 since the txt file and the $aGlobalLinks will have a header in index 0 Global $r = 1 Do If $aGlobalLinks[$r][1] = "No" Then ;Skip Entries that have already been checked Local $oIE = _IECreate($aGlobalLinks[$r][0], 0, 1, 0) ;Create new window with the first 'unchecked' link entry _IELoadWait($oIE, 100, 2500) ;Wait 2.5 seconds for page to load If @error = 6 Then ;@error = 6 means the Timeout was met..Send {ESC} to stop the loading ConsoleWrite("Webpage timed out...Sending ESC..." & @CRLF) Send("{ESC}") Sleep(500) EndIf Local $sHTML = _IEDocReadHTML($oIE) ;Read the HTML and look for any trace of 'helpjuice' Local $result = StringRegExp($sHTML, ".*?helpjuice.*?", 0) ConsoleWrite("RegExt result: " & $result & @CRLF) If $result = 1 Then ;A result of 1 means there is a match $aGlobalLinks[$r][1] = "Yes" ;Set 'Checked' to 'Yes' $aGlobalLinks[$r][2] = "Yes" ;Set 'Hit' to 'Yes' ConsoleWrite("~~~~~~~~~~~~~ H I T ~~~~~~~~~~~~~ " & $aGlobalLinks[$r][0] & @CRLF) Else $aGlobalLinks[$r][1] = "Yes" ;Set 'Checked' to 'Yes' EndIf $oLinks = _IELinkGetCollection($oIE) ;Grab a list of links from the existing site ;_ArrayDisplay($oLinks) For $oLink In $oLinks ;Loop through all the links found and add any new links to the end of $aGlobalLinks ConsoleWrite("String: " & String($oLink) & @CRLF) ConsoleWrite("Looking for: " & $oLink.href & @CRLF) _ArraySearch($aGlobalLinks, $oLink.href) If @error = 6 Then Local $aFill[1][3] = [[$oLink.href, "No", "No"]] ;Set 'Checked' and 'Hit' to 'No' because this link has not been checked yet _ArrayAdd($aGlobalLinks, $aFill) EndIf Next _IEQuit($oIE) ;This next part is to reduce the amount times we write to the file ;Changing the '10' to '100' means the script will save the changes every 100 entries If IsInt($r/10) = 1 Then SaveFile() ConsoleWrite("File Saved: " & $r & "/" & UBound($aGlobalLinks) & @CRLF) EndIf ConsoleWrite("Completed " & $r & "/" & UBound($aGlobalLinks) & @CRLF) EndIf $r += 1 Until $r > UBound($aGlobalLinks) ;_ArrayDisplay($aGlobalLinks) Func SaveFile() $oFile = FileOpen(@ScriptDir & "\KB_URLs.txt", 2) FileClose($oFile) _FileWriteFromArray(@ScriptDir & "\KB_URLs.txt", $aGlobalLinks, 0, UBound($aGlobalLinks), ",") EndFunc Func LoadFile() _FileReadToArray(@ScriptDir & "\KB_URLs.txt", $aGlobalLinks, $FRTA_NOCOUNT, ",") _ArrayDisplay($aGlobalLinks) EndFunc The error I'm getting has to do with the function _IELinkGetCollection. I used the examples in the AutoIT Help section and there is multiple uses of $oLink.href. I haven't been able to find much on when/how to use the .href. Here is the Console Output of the error: RegExt result: 0 Looking for: https://website.com/kb/ Looking for: https://website.com/kb/207557-abc-bank-homepage# Looking for: https://website.com/kb/ Looking for: https://website.com/kb/19011-partners-and-isos Looking for: https://website.com/kb/46470-onsite-install-partners Looking for: https://website.com/en/small-business/payments-and-processing/abc-merchant-services.html Looking for: https://website.com/Clover Looking for: https://website.com/screens/signup/?integrations_id=12345 Looking for: https://website.com/instruction/import-an-inventory-menu-spreadsheet/?userDevice=web Looking for: https://website.com/instruction/import-an-inventory-menu-spreadsheet/?userDevice=web Looking for: https://website.com/instruction/import-an-inventory-menu-spreadsheet/?userDevice=web Looking for: https://website.com/appmarket/apps/Z6GMBJ5HCBEQA?clientCountry=US Looking for: https://website.com/kb/207557-abc-bank-homepage#panel3a Looking for: https://website.com/kb/207557-abc-bank-homepage#panel4a Looking for: https://website.com/kb/207557-abc-bank-homepage#panel5a "C:\Users\Jon\Desktop\KB Scrub\HTMLDOC_Test.au3" (65) : ==> The requested action with this object has failed.: ConsoleWrite("Looking for: " & $oLink.href & @CRLF) ConsoleWrite("Looking for: " & $oLink^ ERROR Any insight is appreciated!
  5. Hi, I wonder if AutoIt3Wrapper_run_debug_mode = Y can include run information about functions which are called within the main code. So far I noticed in the console that the function itself is called but no specific run information from inside the function is provided. Is there a chance to show the entire debug log including functions in the console? I furthermore noticed a stop of information when a loop is entered. What could be the reason for that? Thanks for help.
  6. Here is just some usefull script analyzer: #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <Array.au3> ; just put a FileFullPath to one of your project _UsedInclude_API() _GetAllDependencies("c:\Program Files (x86)\AutoIt3\SciTE\SciTE Jump\SciTE Jump.au3") _UsedInclude_API() _GetAllDependencies("c:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3") _UsedInclude_API() _GetAllDependencies("c:\Program Files (x86)\AutoIt3\SciTE\SciTEConfig\SciteConfig.au3" ) _UsedInclude_API() _GetAllDependencies(@ScriptFullPath) Func _GetAllDependencies($sFileToCheck) GUICreate("My GUI with treeview", 500, @DesktopHeight - 40) Local $idTreeview = GUICtrlCreateTreeView(6, 6, 488, @DesktopHeight - 40 - 12, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) Local $idDisplayitem = GUICtrlCreateTreeViewItem($sFileToCheck, $idTreeview) GUICtrlSetColor(-1, $COLOR_GREEN) __UsedIncludeToTreeView($sFileToCheck, $idDisplayitem) Local $hItem = GUICtrlGetHandle($idDisplayitem) GUICtrlSendMsg($idTreeview, $TVM_EXPAND, $TVE_TOGGLE, $hItem) GUISetState(@SW_SHOW) Local $idMsg ; Loop until the user exits. While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc ;==>_GetAllDependencies Func _GetUsedIncludeToArray($sAU3Content) Local $aIncludes = StringRegExp($sAU3Content, '(?im)^\s*#include\s?[''""<](.*)\.au3[''"">]', 3) If @error Then Return SetError(@error, @extended, '') Else Return SetError(0, 0, $aIncludes) EndIf EndFunc ;==>_GetUsedIncludeToArray Func __UsedIncludeToTreeView($sFileToCheck, $idTreeview_ref) $hFile = FileOpen($sFileToCheck, $FO_READ) $sAU3Content = FileRead($hFile) FileClose($hFile) Local $aIncludes = _GetUsedIncludeToArray($sAU3Content) If @error Then Return SetError(@error, @extended, '') Else Local $idDisplayitem, $iNumberOfOccurrences = 0 For $iInclude_Idx = 0 To UBound($aIncludes) - 1 $iNumberOfOccurrences = _UsedInclude_API($aIncludes[$iInclude_Idx]) If $iNumberOfOccurrences = 0 Then $idDisplayitem = GUICtrlCreateTreeViewItem($aIncludes[$iInclude_Idx], $idTreeview_ref) __UsedIncludeToTreeView(_GetDir($sFileToCheck) & $aIncludes[$iInclude_Idx] & '.au3', $idDisplayitem) ElseIf $iNumberOfOccurrences = 1 Then $idDisplayitem = GUICtrlCreateTreeViewItem($aIncludes[$iInclude_Idx] & ' (Was used before: once)', $idTreeview_ref) GUICtrlSetColor(-1, $COLOR_RED) ElseIf $iNumberOfOccurrences = 2 Then $idDisplayitem = GUICtrlCreateTreeViewItem($aIncludes[$iInclude_Idx] & ' (Was used before: twice)', $idTreeview_ref) GUICtrlSetColor(-1, $COLOR_PURPLE) ElseIf $iNumberOfOccurrences > 2 Then $idDisplayitem = GUICtrlCreateTreeViewItem($aIncludes[$iInclude_Idx] & ' (Was used before more then twice)', $idTreeview_ref) GUICtrlSetColor(-1, $COLOR_BLUE) EndIf Next EndIf EndFunc ;==>__UsedIncludeToTreeView Func _UsedInclude_API($sIncludeFileName = Default) Local Static $sIncludeAPI_Static = '|' ; reset If $sIncludeFileName = Default Then $sIncludeAPI_Static = '|' Return EndIf StringReplace($sIncludeAPI_Static, '|' & $sIncludeFileName & '|', '|' & $sIncludeFileName & '|') Local $iNumberOfReplacements = @extended $sIncludeAPI_Static &= $sIncludeFileName & '|' Return SetError(0, 0, $iNumberOfReplacements) EndFunc ;==>_UsedInclude_API Func _GetDir($sFileFullPath) Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "" Local $aPathSplit = _PathSplit($sFileFullPath, $sDrive, $sDir, $sFileName, $sExtension) Return $sDrive & $sDir EndFunc ;==>_GetDir Have fun. mLipok
×
×
  • Create New...