ViSiToR
Silver Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору
Код: -------------------------------------------------------------------------------- -- DebugMsgBoxAdd() -- -- Add debug MsgBox to the selected text (original by Jos van der Zande). -- -- Tool: AutoItTools.DebugMsgBoxAdd $(au3) savebefore:no,groupundo:yes Alt+D Debug: Add MsgBox -------------------------------------------------------------------------------- function AutoItTools:DebugMsgBoxAdd() local word = self:GetWord2() if word == "" then print("Cursor not on any text.") return end local word2 = word:gsub("'", "''") -- replace quote by 2 quotes local line = editor:LineFromPosition(editor.CurrentPos) + 1 editor:LineEnd() editor:NewLine() --~ editor:AddText("MsgBox(262144,'debug line ~" .. line .. "' , \'" .. word2 .. "\:' & @CRLF & " .. word .. ") ;### Debug MSGBOX" ) local option = tonumber(props['debug.msgbox.option']) if option == 2 then editor:AddText("SetError(@Error, @Extended, MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @LF & \'" .. word2 .. "\' & @LF & @LF & 'Return:' & @LF & " .. word .. " & @LF & @LF & '@Error:' & @LF & @Error & @LF & @LF & '@Extended:' & @lf & @Extended)) ;### Debug MSGBOX" ) elseif option == 1 then editor:AddText("SetError(@Error, @Extended, MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @LF & \'" .. word2 .. "\' & @LF & @LF & 'Return:' & @LF & " .. word .. " & @LF & @LF & '@Error:' & @LF & @Error)) ;### Debug MSGBOX" ) elseif option == 0 then editor:AddText("SetError(@Error, @Extended, MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @LF & \'" .. word2 .. "\' & @LF & @LF & 'Return:' & @LF & " .. word .. ")) ;### Debug MSGBOX" ) elseif option == -1 then editor:AddText("SetError(@Error, @Extended, MsgBox(262144,'debug line ~' & @ScriptLineNumber, \'" .. word2 .. "\:' & @LF & " .. word .. ")) ;### Debug MSGBOX" ) end editor:LineDown() editor:Home() end -- DebugMsgBoxAdd() -------------------------------------------------------------------------------- -- DebugConsoleWriteAdd() -- -- Add debug ConsoleWrite to the selected text (original by Jos van der Zande). -- -- Tool: AutoItTools.DebugConsoleWriteAdd $(au3) savebefore:no,groupundo:yes Ctrl+D Debug: Add ConsoleWrite -------------------------------------------------------------------------------- function AutoItTools:DebugConsoleWriteAdd() local word = self:GetWord2() if word == "" then print("Cursor not on any text.") return end local word2 = word:gsub("'", "''") -- replace quote by 2 quotes local line = editor:LineFromPosition(editor.CurrentPos) + 1 editor:LineEnd() editor:NewLine() --~ editor:AddText("ConsoleWrite('@@ (" .. line .. ") :(' & @min & ':' & @sec & ') " .. word2 .. " = ' & " .. word .. " & @CRLF) ;### Debug Console") local option = tonumber(props['debug.console.option']) if option == 3 then editor:AddText("SetError(@Error, @Extended, ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : " .. word2 .. " = ' & " .. word .. " & @CRLF & '>Error code: ' & @Error & ' Extended code: ' & @Extended & ' SystemTime: ' & @HOUR & ':' & @MIN & ':' & @SEC & @CRLF)) ;### Debug Console" ) elseif option == 2 then editor:AddText("SetError(@Error, @Extended, ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : " .. word2 .. " = ' & " .. word .. " & @CRLF & '>Error code: ' & @Error & ' Extended code: ' & @Extended & @CRLF)) ;### Debug Console" ) elseif option == 1 then editor:AddText("SetError(@Error, @Extended, ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : " .. word2 .. " = ' & " .. word .. " & @CRLF & '>Error code: ' & @Error & @CRLF)) ;### Debug Console" ) elseif option == 0 then editor:AddText("SetError(@Error, @Extended, ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : " .. word2 .. " = ' & " .. word .. " & @CRLF)) ;### Debug Console" ) elseif option == -1 then editor:AddText("SetError(@Error, @Extended, ConsoleWrite('@@ (' & @ScriptLineNumber & ') :(' & @MIN & ':' & @SEC & ') " .. word2 .. " = ' & " .. word .. " & @CRLF)) ;### Debug Console" ) end editor:LineDown() editor:Home() end -- DebugConsoleWriteAdd() |
| Всего записей: 3251 | Зарегистр. 01-04-2006 | Отправлено: 22:40 29-05-2010 | Исправлено: ViSiToR, 23:03 29-05-2010 |
|