1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. BugFix

Beiträge von BugFix

  • Incorrect number of parameters in function call.

    • BugFix
    • 12. Juni 2013 um 08:36
    Zitat von EinfachSö

    Ich denke du willst auf das "Bot" hinaus.
    nunja, bot ist die Abkürzung für robot, wie du denke ich einmal weißt. Er automatisiert eine Handlung.


    Wie schön. Und wenn du die Forenregeln gelesen hast, solltest du wissen, dass derartige "Automatisierungen" nicht zulässig sind. Du willst automatisch Werbebanner klicken (vermutlich um irgendwelche Bonuspunkte od. Cash zu sammeln). Klarer Verstoß gegen die AGB des Seitenbetreibers. Das erlaubt niemand.

    [CLOSED]

  • Performance von SQLite optimieren?

    • BugFix
    • 8. Juni 2013 um 17:42

    Muß es denn unbedingt eine Datenbank sein? Wenn das Ergebnis eh wieder zurückgewandelt werden muß?
    Vielleicht bist du mit einer anderen Datenstruktur besser bedient, z.B. JSON.

  • Performance von SQLite optimieren?

    • BugFix
    • 8. Juni 2013 um 16:59

    Probier Folgendes:
    - SQL-Rückgabe als Array
    - Listview befüllen mit _GUICtrlListView_AddArray()

  • Performance von SQLite optimieren?

    • BugFix
    • 8. Juni 2013 um 05:21

    Du schreibst jeden Datensatz einzeln in die DB, das ist schonmal eine Bremse. Und dann fehlt dir noch der "Beschleuniger": BEGIN TRANSACTION; --- COMMIT;
    Dein Skript sollte etwa so gestaltet werden:

    [autoit]

    $sSQL = "BEGIN TRANSACTION;"
    For .....
    $sSQL &= "INSERT.... ;"
    Next
    $sSQL &= "COMMIT;"

    [/autoit][autoit][/autoit][autoit]

    _SQLite_Exec(-1, $sSQL)

    [/autoit]


    Dann benötigt dein Skript nur noch einige Millisekunden.

    Edit:
    Wenn ich mich recht erinnere, ist _SQLite_FetchData() auch nicht gerade der Renner. Lies dir die Daten gleich in ein Array ( _SQLite_GetTable2d ), das dürfte die Erstellung des Listview beschleunigen.

  • Treiber, DIFxAPI.dll, DllCall

    • BugFix
    • 7. Juni 2013 um 09:55

    Es wäre sinnvoll, wenn du
    a) die Beschreibung der Funktionsparameter lesen würdest und
    b) zumindest darauf verlinkst (nicht jeder - z.B. ich - hat Lust extra einen Anhang herunterzuladen)

    Hier mal die Parameter (Quelle:(

    Spoiler anzeigen
    Code
    DriverPackageInfPath [in]
    A pointer to a NULL-terminated string that supplies the fully qualified path of a driver package's INF file. DIFx uses this string to retrieve the corresponding INF file within the DIFx driver store. The INF file cannot be in the system INF file directory. For more information about how to specify an INF file path for a driver package, see Specifying a Driver Package INF File Path.
    pDestInfPath [out, optional]
    A pointer to a buffer that receives a NULL-terminated string that contains the fully qualified path of the INF file within the DIFx driver store. This string corresponds to the driver package's INF file that is supplied by DriverPackageInfPath. This pointer is optional and can be NULL.
    pNumOfChars [in, out]
    A pointer to a DWORD-typed variable that receives the buffer size, in characters, of the buffer that is pointed to by pDestInfPath. If the pDestInfPath buffer is large enough to hold the requested INF file path within the DIFx driver store, DriverPackageGetPath returns ERROR_SUCCESS and sets *pNumOfChars to the size, in characters, of the INF file path. If the buffer is not large enough to retrieve the requested INF file path, the function returns ERROR_INSUFFICIENT_BUFFER. Also, the function sets *pNumOfChars to the buffer size, in characters, that is required to retrieve the requested INF file path in addition to the NULL terminator.

    - Parameter "DriverPackageInfPath" ist ein Pointer auf einen Null-terminierten String!
    - Parameter "pDestInfPath" (optional, wenn nicht gebraucht: 0 übergeben) ist ebenfalls ein Pointer auf einen Buffer (String) zur Aufnahme des Null-terminierten Rückgabestrings
    - Parameter "pNumOfChars" ist der Pointer auf eine DWORD-Variable, die setzt du auf den Wert: Länge InPath +1 (Nullterminator). Ist der Wert zu klein schlägt die Funktion fehl und du kannst aus diesem Parameter die erforderliche Größe ablesen.

    Mit diesen Angaben solltest du jetzt den korrekten Aufruf erstellen können.

  • Große txt Dateien ändern mit StringRegExpReplace

    • BugFix
    • 6. Juni 2013 um 11:30

    Bist du mit dieser Arbeit ausschließlich an einem PC? Dann würde ich dir dazu raten, die Datei mit Lua oder Python zu bearbeiten. Beide Skriptsprachen schlagen AutoIt in der Textverarbeitung um Welten (Zeitbedarf 1/10 oder noch geringer). Das resultiert vor allem daraus, dass RegExp in AutoIt keine generische Verarbeitung implementiert hat. Und bei Dateien dieser Größe vermute ich, würde es Probleme mit rekursiven Aufrufen geben.


    Edit
    Ich habe dir mal die Lua-Lösung erstellt. Kannst du dann aus SciTE heraus starten (die zu bearbeitende Datei mußt du nicht im Editor öffnen, nur das Lua-Skript). Beachte den notwendigen Eintrag für SciTEUser.properties:

    Spoiler anzeigen
    PHP
    -------------------------------------------------------------------------
    --[[   	Damit das Skript aus SciTE mit "F5" gestartet werden kann:
    		• in SciTEUser.properties eintragen
    		  command.go.*.lua=dofile $(FilePath)
    ]]
    -------------------------------------------------------------------------
    
    
    
    
    -------------------------------------------------------------------------
    local Clock = function() local datetable = os.date("*t", os.time())
    	return string.format('%02d:%02d:%02d', datetable.hour, datetable.min, datetable.sec)
    end
    -------------------------------------------------------------------------
    
    
    
    
    -------------------------------------------------------------------------
    EditFile = function(_sFile, _sFileOut)
    	print('--> ' .. Clock() .. ' Dateibearbeitung Start')
    	_sFileOut = _sFileOut or _sFile   -- wenn "_sFileOut" nicht übergeben, wird "_sFile" überschrieben
    	local fh = io.open(_sFile)
    	local s = fh:read('*a')
    	fh:close()
    	local p1, p2 = "(%-?%d+%.%d+)", "(%s%d%d%s%d%d%s%d%d)"
    	local repl = function(_s) _s = _s*100 len = #tostring(_s) if _s < 0 then n = 11-len else n = 10-len end return tostring(_s)..('0'):rep(n) end
    	local s1 = s:gsub(p1, repl):gsub(p2, "")
    	fh = io.open(_sFileOut, "w+")
    	fh:write(s1)
    	fh:close()
    	print('+-> ' .. Clock() .. ' Dateibearbeitung Ende')
    end
    -------------------------------------------------------------------------
    
    
    local sFile = "C:\\Users\\BugFix\\Downloads\\test_focus.txt" -- Doppel-Backslash beachten!
    local sFileOut = "C:\\Users\\BugFix\\Downloads\\test_focus_out.txt" -- Doppel-Backslash beachten!
    
    
    
    
    EditFile(sFile, sFileOut)
    Alles anzeigen

    Dateien

    EditFile.lua 1,66 kB – 212 Downloads
  • Tür-Überwachung

    • BugFix
    • 5. Juni 2013 um 17:54

    Die notwendige Software hast du bei jeder Web-Cam mit dabei ( schon seit 10 Jahren ;) ).
    Du gibst ein Bewegungslevel als Trigger ein, und dann startet die Aufzeichnung, sonst ist die Cam im Leerlauf.

  • "Buttontext" <> "Buttonwert"

    • BugFix
    • 5. Juni 2013 um 13:07

    Ich würde auch Arrays als Speicher für die (beliebig viel möglichen) Daten zu einem Control verwenden.
    Duch Enumeration der Indizes ist auch ein jederzeit verständlicher Zugriff gewährleistet.

    Spoiler anzeigen
    [autoit]

    Enum $bt1, $bt2, $lb1, $lb2
    Enum $ID, $Text1, $Text2, $EinWeitererParam

    [/autoit] [autoit][/autoit] [autoit]

    Global $aCtrl[4][4] = [ _
    [GUICtrlCreateButton(...), 'Text 1', 'Text 2', 'Irgendwas'], _
    [GUICtrlCreateButton(...), 'Text 1', 'Text 2', 'Irgendwas'], _
    [GUICtrlCreateLabel(...), 'Text 1', 'Text 2', 'Irgendwas'], _
    [GUICtrlCreateLabel(...), 'Text 1', 'Text 2', 'Irgendwas']]

    [/autoit] [autoit][/autoit] [autoit]

    ;...
    ;...

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($aCtrl[$bt1][$ID], $aCtrl[$bt1][$Text2])

    [/autoit]
  • "Buttontext" <> "Buttonwert"

    • BugFix
    • 4. Juni 2013 um 09:24

    Du schreibst ja nicht was du machen willst (sehr schlecht, wenn man Hilfe bekommen möchte).
    Es klingt so, als wolltest du die Buttonbeschriftung abwechselnd ändern (Aus/Ein etc.)
    Das ginge so am einfachsten:

    [autoit]

    GUICreate('Test')
    $bt = GUICtrlCreateButton('Test', 20,20,80,22)
    GUISetState()

    [/autoit][autoit][/autoit][autoit]

    Global $aText[2] = ['Test', 'Sonstwas']
    $iSwap = 0

    [/autoit][autoit][/autoit][autoit]

    While 1
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $bt
    $iSwap = Not $iSwap
    GUICtrlSetData($bt, $aText[$iSwap])
    EndSwitch
    WEnd

    [/autoit]
  • "Buttontext" <> "Buttonwert"

    • BugFix
    • 3. Juni 2013 um 21:14
    Zitat von metaljojo

    Beim klick auf den Button soll der Schriftzug "Text" zu "Neuer Text" werden aber die Variable $Button soll immer noch den Wert "Text" haben.


    Das ist quatsch. Die Variable $Button hat niemals den Wert "Text" - sie hat eine ID (Zahl) die vom System beim Erstellen vergeben wird.
    Den Text kannst du ändern, wie ich bereits geschrieben habe, mit GuiCtrlSetData.

  • "Buttontext" <> "Buttonwert"

    • BugFix
    • 3. Juni 2013 um 15:11

    Du mußt grundlegend unterscheiden:
    Buttonwert == der Wert, mit dem der Button identifiziert wird (die ID) -- unveränderlich!
    Buttontext == der Text des Buttons -- kann jederzeit geändert werden mit GuiCtrlSetData()

  • FOLDING in Scite mit space, yaml lexer fuer *.txt oder andere files verwenden

    • BugFix
    • 3. Juni 2013 um 13:50

    Auch wenn du die *.properties sicherst: Es ist nicht sinnvoll darin herumzubasteln. Für eigene Änderungen gibt es die SciTEUser.properties. In dieser Datei gesetzte properties überschreiben Werte aus Globale.properties und FILE.properties.
    Somit brauchst du die Originale niemals ändern, sondern schreibst alles in die SciTEUser.

  • MS System-Error-Codes

    • BugFix
    • 1. Juni 2013 um 14:35

    Falls ihr in Skripten die LastError-Abfrage benutzt und gerne die Zuordnung von Fehlernummer und Beschreibung hättet, hier eine Liste mit den Fehler Codes (Quelle).
    Aufbau je Zeile:
    FehlerNr_Integer;FehlerNr_Hex;Fehler_Tag;Fehler_Beschreibung

  • WM_NOTIFY macht eine falsche CaseZuordnung

    • BugFix
    • 29. Mai 2013 um 16:49

    Also der Case-Zweig arbeitet völlig korrekt. Wenn idOld -Wert sich nicht ändert, wird Case den zugehörigen Wert (ich nehme an, "0" ist der Wert von $hToolbarButtonOpen) anwählen.
    Lass dir doch erst mal die $hToolbarButtonOpen usw. in die Konsole ausgeben (Wieso eigentlich "$h.." wenn es ID sind? - Das verwirrt.) und prüfe deren Wert.

  • Problem mit langsamen PING

    • BugFix
    • 29. Mai 2013 um 11:26

    Das ist meines Wissens kein Fehler. Es wird der Systembefehl Ping verwendet und dem ist jedes Timeout völlig schnurz. Insofern ist mir der Timeout-Parameter rätselhaft.
    Vielleicht solltest du den Timeout über eine AdlibRegister-Funktion realisieren. Ruf einfach im Intervall des Timeouts die Pingfunktion mit der nächsten Adresse auf. Probier es aus, vllt. bringt dich das weiter.

  • Problem mit _HexToString

    • BugFix
    • 27. Mai 2013 um 21:26
    Zitat von Texos

    Ich möchte mich in Wireshark vertiefen und teste ein paar Spiele durch. Derzeit Diablo 2 Lord of Destruction.


    Wozu soll das Sniffen bei Spielen dienen, wenn nicht einem bösen Unterfangen. :evil:
    Und dabei wird dir unter Hinweis auf die Forenregeln niemand Support geben.

    [CLOSED]

    PS: Ich vermute nicht, dass ich da falsch liege, denn "rein aus Interesse" Spiele sniffen... Ich schlaf doch nicht an der Wand!

  • SciTE - Hotkeys unlimited, Neue Funktionen (Run selected Code, Move selection left/right/up/down u.a.)

    • BugFix
    • 27. Mai 2013 um 18:20

    • Hotkeys
    SciTE hat ja bereits alle Sequenzen von Ctrl+Key vorbelegt. Das ist natürlich unschön, da man für eigene Hotkeys dann auf umständliche Kombinationen zurückgreifen muss, die einem fast die Finger brechen. Oder man muss die voreingestellten Hotkeys ummappen.

    Aber das hat ein Ende. Die Lösung: Cascading Hotkeys
    Das funktioniert recht simpel. Ich habe mir als Trigger die Sequenz "Ctrl+Win" ausgewählt. Das beißt sich mit keinem anderen Hotkey und läßt sich schön mit 2 Fingern einer Hand erledigen. Ist dieser Hotkey gedrückt, läßt man die Win-Taste wieder los aber hält die Ctrl-Taste weiterhin gedrückt und wählt nun die beliebige Taste für die zweite Ctrl+Key-Sequenz. Somit ergeben sich Hotkeys der Form: "Ctrl+Win, Ctrl+X" oder "Ctrl+Win, Ctrl+F2" usw..

    Alle Tasten der Standardtastatur, ohne Sonderzeichen, habe ich vorbereitet in der angehängten Datei. Will man eine Sequenz nutzen, muss nur der Kommentar aus der entsprechenden Zeile entfernt und die gewünschte Aktion hinterlegt werden. Was in SciTEUser.properties an command-Befehlen für Hotkeys hinterlegt ist, kann man ebenso in diesem Skript aufrufen. Wenn es Probleme bei der Umsetzung gibt, einfach melden.

    • Markierten Code ausführen
    Mir passiert es öfter mal, dass ich aus einem Projekt einzelne Codesequenzen ausführen möchte ohne jedoch das Skript selbst zu starten. Bisher habe ich dann immer eine Testdatei geöffnet, den entsprechenden Code hineinkopiert, auf fehlende Includes geprüft und dann ausgeführt.
    Das habe ich nun automatisiert. Per Hotkey wird:
    - markierter Code in eine separate Datei geschrieben ( __TMP__RunSelected.au3 im Ordner des aktuellen Skripts )
    - aus dem offenen Skript werden die Includes ausgelesen und mit in die Datei geschrieben
    - die Datei wird im Editor geöffnet und sofort ausgeführt
    - bei erneuter Nutzung wird die Datei überschrieben, somit nur diese eine zusätzliche Datei im entsprechenden Skript-Ordner

    • Markierten Inhalt aus einer Zeile verschieben
    Ich hatte ja bereits in der Version 0.1 das Verschieben von kpl. Zeilen auf Hotkeys gelegt.
    Nun habe ich zusätzlich integriert, dass selektierter Text in alle Richtungen verschoben werden kann. Sequenz: "Ctrl+Alt+ [Pfeil li/ re/ auf/ ab]"

    • Kommentar in Zeile anspringen
    Setzt den Cursor vor das Zeichen für den Kommentarstart, sofern die Zeile einen Kommentar enthält.

    • Markierungen
    - Variable unter Cursor ohne "$" markieren (markiert auch jede andere Zeichenkette ohne NonWordCharacter)
    - Variable unter Cursor mit "$" markieren
    - kpl. Zeile markieren

    Einbinden in SciTE, wie in Post #1 beschrieben.

    Ausgabe einer Auflistung der Hotkeys in die Konsole mit "Ctrl+Win, Ctrl+0"


    EditProcessing (v0.2)
    [autoit]


    -- TIME_STAMP 2013-05-27 18:02:39 v 0.2
    -- by BugFix

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EditKey = EventClass:new(Common)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local fOwnMode = false
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local Clock = function() local datetable = os.date("*t", os.time())
    return string.format('%02d:%02d:%02d', datetable.hour, datetable.min, datetable.sec) end
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local SelectionMoveH = function(_fLeft)
    local moveText = function(_s, _a, _e, _val)
    editor:SetSelection(_a, _e) editor:Clear()
    if _val == -1 then editor:CharLeft() else editor:CharRight() end
    editor:InsertText(editor.CurrentPos, _s)
    editor:SetSelection(_a +(_val), _e +(_val))
    end
    output:ClearAll()
    local sErr = "!>> "..Clock().." [Error SelectionMoveH] >> "
    local caret = editor.CurrentPos
    local line = editor:LineFromPosition(caret)
    local selText, selLen = editor:GetSelText()
    local selStart, selEnd = editor:GetLineSelStartPosition(line), editor:GetLineSelEndPosition(line)
    editor:SetSelection(selStart, selEnd) -- now the cursor is on left side of selection
    if selLen == 0 then print(sErr..'Nothing selected!') return end
    local lineStart = editor:PositionFromLine(line)
    editor:LineEnd()
    local lineEnd = editor.CurrentPos
    if _fLeft then
    if caret > lineStart then moveText(selText, selStart, selEnd, -1) else
    print(sErr..'First position was already reached!') editor:SetSelection(selStart, selEnd) end
    else
    if selStart +selLen -1 < lineEnd then moveText(selText, selStart, selEnd, 1) else
    print(sErr..'Last position was already reached!') editor:SetSelection(selStart, selEnd) end
    end
    end --> SelectionMoveH
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local SelectionMoveV = function(_fUp)
    local moveText = function(_i, _txt, _len, _line)
    editor:Clear()
    local lineNext = _line +(_i)
    local lenNext = editor:LineLength(lineNext)
    local lineNextStart = editor:PositionFromLine(lineNext)
    local insertPos = lineNextStart + editor.Column[editor.CurrentPos]
    if lenNext < editor.Column[editor.CurrentPos] then insertPos = lineNextStart end
    editor:InsertText(insertPos, _txt)
    editor:SetSelection(insertPos, insertPos +_len-1)
    editor:EnsureVisible(lineNext)
    end
    output:ClearAll()
    local sErr = "!>> "..Clock().." [Error SelectionMoveV] >> "
    local line = editor:LineFromPosition(editor.CurrentPos)
    local lineLast = editor.LineCount -1
    local selStart, selEnd = editor:GetLineSelStartPosition(line), editor:GetLineSelEndPosition(line)
    local selText, selLen = editor:GetSelText()
    editor:SetSelection(selStart, selEnd) -- now the cursor is on left side of selection
    if selLen == 0 then print(sErr..'Nothing selected!') return end
    if _fUp then
    if line == 0 then print(sErr..'No line before this!') return else moveText(-1, selText, selLen, line) end
    else
    if line == lineLast then print(sErr..'No line after this!') return else moveText(1, selText, selLen, line) end
    end
    end --> SelectionMoveV
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local SkipToComment = function()
    local IsComment = function(_pos)
    local tComment = {1,2} if tComment[editor.StyleAt[_pos]] == nil then return false
    else return true end
    end
    output:ClearAll()
    local caret = editor.CurrentPos
    local iStart = caret
    local iLine = editor:LineFromPosition(iStart)
    local iLineStart = editor:PositionFromLine(iLine)
    if IsComment(iStart) then
    while (iStart-1 >= iLineStart) and IsComment(iStart-1) do
    iStart = iStart-1
    end
    else
    while (iStart+1 < iLineStart +editor:LineLength(iLine)) and not IsComment(iStart+1) do
    iStart = iStart+1
    end
    iStart = iStart+1
    end
    if not IsComment(iStart) then editor.CurrentPos = caret
    print("!>> "..Clock().." [Error SkipToComment] >> No comment in this line!") return end
    editor:SetSelection(iStart, iStart)
    end --> SkipToComment
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local SetSelection = function(_part)
    local isWordChar = function(_char)
    if string.char(_char):find('[a-zA-Z0-9_]') then return true end
    return false
    end
    local iStart = editor.CurrentPos
    local iEnd = iStart
    while isWordChar(editor.CharAt[iStart-1]) do
    iStart = iStart - 1
    end
    if not _part and string.char(editor.CharAt[iStart-1]) == "$" then iStart = iStart - 1 end
    while isWordChar(editor.CharAt[iEnd]) do
    iEnd = iEnd + 1
    end
    if iStart ~= iEnd then editor:SetSelection(iStart, iEnd) end
    end --> SetSelection
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local RunSelectedCode = function()
    local writeTmpFile = function(_path, _s)
    local file = io.open(_path, 'w+')
    file:write(_s) file:close()
    end
    output:ClearAll()
    local sErr = "!>> "..Clock().." [Error RunSelectedCode] >> "
    local fileExt = props["FileExt"]
    if fileExt:upper() ~= 'AU3' then output:ClearAll() print(sErr..'Attempting to run code from a non-au3 file!') return end
    local fileDir = props["FileDir"]
    local sSel = editor:GetSelText()
    if sSel == '' then print(sErr..'No code selected!') return end
    local text = editor:GetText()
    local sWrite = ''
    for incl in text:gmatch("[\n]?(#[iI][nN][cC][lL][uU][dD][eE]%s-<[%w%s_.]+>)") do sWrite = sWrite..incl..'\n' end
    for incl in text:gmatch("[\n]?(#[iI][nN][cC][lL][uU][dD][eE]%s-([\"'])[%w%s_.:\\]+%2)") do sWrite = sWrite..incl..'\n' end
    local newPath = fileDir..'\\'..'__TMP__RunSelected.au3'
    writeTmpFile(newPath, sWrite..'\n'..sSel)
    scite.Open(newPath)
    scite.MenuCommand(IDM_GO)
    end --> RunSelectedCode
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------
    local GetHotkeyList = function()
    local tKeys = {}
    tKeys['Ctrl+Win, Ctrl+C'] = ' Skip to |C|omment in line if any'
    tKeys['Ctrl+Win, Ctrl+F'] = ' |F|ull selection, expand selection to full word with Wordcharacters and leading "$"'
    tKeys['Ctrl+Win, Ctrl+L'] = ' |L|ine selection'
    tKeys['Ctrl+Win, Ctrl+P'] = ' |P|artial selection, expand selection to full word with only Wordcharacters'
    tKeys['Ctrl+Win, Ctrl+R'] = ' |R|un Selected Code'
    tKeys['Ctrl+Win, Ctrl+S'] = ' Reload SciTE |S|tartup script'
    tKeys['Ctrl+Win, Ctrl+T'] = ' |T|oggle adjacent characters'
    tKeys['Ctrl+Win, Ctrl+U'] = ' |U|nselect any selections'
    tKeys['Ctrl+Win, Ctrl+Z'] = ' Run Testscript "LUA_TEST.lua"'
    tKeys['Ctrl+Win, Ctrl+0'] = ' Print HotkeyList to console'
    tKeys['Ctrl+Alt+ArrowLeft'] = ' Move selection in line to Left'
    tKeys['Ctrl+Alt+ArrowRight'] = ' Move selection in line to Right'
    tKeys['Ctrl+Alt+ArrowUp'] = ' Move selection in line Up'
    tKeys['Ctrl+Alt+ArrowDown'] = ' Move selection in line Down'
    tKeys['Ctrl+Shift+ArrowDown'] = ' Move line/selected-lines Down'
    tKeys['Ctrl+Shift+ArrowUp'] = ' Move line/selected-lines Up'

    [/autoit] [autoit][/autoit] [autoit]

    local pairsSortByKeys = function(t, f)
    local a = {}
    for n in pairs(t) do table.insert(a, n) end
    table.sort(a, f)
    local i = 0
    local iter = function ()
    i = i + 1 if a[i] == nil then return nil
    else return a[i], t[a[i]] end
    end
    return iter
    end
    local lenMax, s = 0, '.'
    for k, _ in pairs(tKeys) do if k:len() > lenMax then lenMax = k:len() end end
    lenMax = lenMax +4
    output:ClearAll()
    print('--> KeyList in alphabetical order')
    for k, v in pairsSortByKeys(tKeys) do print('+-> '..k..s:rep(lenMax-k:len())..v) end
    end --> GetHotkeyList
    -------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    --- Event: OnKey --------------------------------------------------------
    function EditKey:OnKey(_keycode, _shift, _ctrl, _alt)
    --~ print('_keycode: '..tostring(_keycode)..', _shift: '..tostring(_shift)..', _ctrl: '..tostring(_ctrl)..', _alt: '..tostring(_alt)) -- DebugToConsole

    [/autoit] [autoit][/autoit] [autoit]

    if not fOwnMode and _ctrl and not _shift and not _alt and _keycode == 91 then --- Ctrl+Win activates OwnMode
    fOwnMode = true return true
    end
    if fOwnMode then --- processing own commands
    -- Ctrl+Win, Ctrl+A
    --~ if _ctrl and not _shift and not _alt and _keycode == 65 then
    -- Ctrl+Win, Ctrl+B
    --~ if _ctrl and not _shift and not _alt and _keycode == 66 then

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+C ##== Skip to |C|omment in line if any ==##
    if _ctrl and not _shift and not _alt and _keycode == 67 then SkipToComment() end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+D
    --~ if _ctrl and not _shift and not _alt and _keycode == 68 then
    -- Ctrl+Win, Ctrl+E
    --~ if _ctrl and not _shift and not _alt and _keycode == 69 then

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+F ##== |F|ull selection, expand selection to full word with Wordcharacters and leading "$" ==##
    if _ctrl and not _shift and not _alt and _keycode == 70 then SetSelection(false) end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+G
    --~ if _ctrl and not _shift and not _alt and _keycode == 71 then
    -- Ctrl+Win, Ctrl+H
    --~ if _ctrl and not _shift and not _alt and _keycode == 72 then
    -- Ctrl+Win, Ctrl+I
    --~ if _ctrl and not _shift and not _alt and _keycode == 73 then
    -- Ctrl+Win, Ctrl+J
    --~ if _ctrl and not _shift and not _alt and _keycode == 74 then
    -- Ctrl+Win, Ctrl+K
    --~ if _ctrl and not _shift and not _alt and _keycode == 75 then

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+L ##== |L|ine selection ==##
    if _ctrl and not _shift and not _alt and _keycode == 76 then
    editor:Home() editor:LineEndExtend() end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+M
    --~ if _ctrl and not _shift and not _alt and _keycode == 77 then
    -- Ctrl+Win, Ctrl+N
    --~ if _ctrl and not _shift and not _alt and _keycode == 78 then
    -- Ctrl+Win, Ctrl+O
    --~ if _ctrl and not _shift and not _alt and _keycode == 79 then

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+P ##== |P|artial selection, expand selection to full word with only Wordcharacters ==##
    if _ctrl and not _shift and not _alt and _keycode == 80 then SetSelection(true) end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+Q
    --~ if _ctrl and not _shift and not _alt and _keycode == 81 then

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+R ##== |R|un Selected Code ==##
    if _ctrl and not _shift and not _alt and _keycode == 82 then RunSelectedCode() end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+S ##== Reload SciTE |S|tartup script ==##
    if _ctrl and not _shift and not _alt and _keycode == 83 then
    dofile( props["SciteDefaultHome"] .. "\\Lua\\SciTEStartup.lua" ) output:ClearAll() print('++> '..Clock()..' SciTE StartUp script reloaded.')
    end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+T ##== |T|oggle adjacent characters ==##
    if _ctrl and not _shift and not _alt and _keycode == 84 then
    caret = editor.CurrentPos editor:SetSel(caret-1, caret) charLeft = editor:GetSelText()
    editor:SetSel(caret, caret+1) charRight = editor:GetSelText() editor:ReplaceSel(charLeft)
    editor:SetSel(caret-1, caret) editor:ReplaceSel(charRight) editor.CurrentPos = caret end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+U ##== |U|nselect any selections ==##
    if _ctrl and not _shift and not _alt and _keycode == 85 then caret = editor.CurrentPos editor:SetSel(caret, caret) end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+V
    --~ if _ctrl and not _shift and not _alt and _keycode == 86 then
    -- Ctrl+Win, Ctrl+W
    --~ if _ctrl and not _shift and not _alt and _keycode == 87 then
    -- Ctrl+Win, Ctrl+X
    --~ if _ctrl and not _shift and not _alt and _keycode == 88 then
    -- Ctrl+Win, Ctrl+Y
    --~ if _ctrl and not _shift and not _alt and _keycode == 89 then

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+Z ##== Run Testscript "LUA_TEST.lua" ==## Hiermit starte ich immer mein Lua-Testscript, da mit "Run" eine Ausführung nicht möglich ist
    if _ctrl and not _shift and not _alt and _keycode == 90 then
    dofile( props["Lua.User.Scripts.Path"] .. "\\LUA_TEST.lua" ) -- ich habe eine eigene Propertie definiert mit dem Pfad meiner Skripte
    end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+0 ##== Print HotkeyList to console ==##
    if _ctrl and not _shift and not _alt and _keycode == 48 then GetHotkeyList() end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Win, Ctrl+1
    --~ if _ctrl and not _shift and not _alt and _keycode == 49 then
    -- Ctrl+Win, Ctrl+2
    --~ if _ctrl and not _shift and not _alt and _keycode == 50 then
    -- Ctrl+Win, Ctrl+3
    --~ if _ctrl and not _shift and not _alt and _keycode == 51 then
    -- Ctrl+Win, Ctrl+4
    --~ if _ctrl and not _shift and not _alt and _keycode == 52 then
    -- Ctrl+Win, Ctrl+5
    --~ if _ctrl and not _shift and not _alt and _keycode == 53 then
    -- Ctrl+Win, Ctrl+6
    --~ if _ctrl and not _shift and not _alt and _keycode == 54 then
    -- Ctrl+Win, Ctrl+7
    --~ if _ctrl and not _shift and not _alt and _keycode == 55 then
    -- Ctrl+Win, Ctrl+8
    --~ if _ctrl and not _shift and not _alt and _keycode == 56 then
    -- Ctrl+Win, Ctrl+9
    --~ if _ctrl and not _shift and not _alt and _keycode == 57 then
    -- Ctrl+Win, Ctrl+Backspace
    --~ if _ctrl and not _shift and not _alt and _keycode == 8 then

    [/autoit] [autoit][/autoit] [autoit]

    -- ##== N U M P A D ==##
    -- Ctrl+Win, Ctrl+NUMPAD_0
    --~ if _ctrl and not _shift and not _alt and _keycode == 96 then
    -- Ctrl+Win, Ctrl+NUMPAD_1
    --~ if _ctrl and not _shift and not _alt and _keycode == 97 then
    -- Ctrl+Win, Ctrl+NUMPAD_2
    --~ if _ctrl and not _shift and not _alt and _keycode == 98 then
    -- Ctrl+Win, Ctrl+NUMPAD_3
    --~ if _ctrl and not _shift and not _alt and _keycode == 99 then
    -- Ctrl+Win, Ctrl+NUMPAD_4
    --~ if _ctrl and not _shift and not _alt and _keycode == 100 then
    -- Ctrl+Win, Ctrl+NUMPAD_5
    --~ if _ctrl and not _shift and not _alt and _keycode == 101 then
    -- Ctrl+Win, Ctrl+NUMPAD_6
    --~ if _ctrl and not _shift and not _alt and _keycode == 102 then
    -- Ctrl+Win, Ctrl+NUMPAD_7
    --~ if _ctrl and not _shift and not _alt and _keycode == 103 then
    -- Ctrl+Win, Ctrl+NUMPAD_8
    --~ if _ctrl and not _shift and not _alt and _keycode == 104 then
    -- Ctrl+Win, Ctrl+NUMPAD_9
    --~ if _ctrl and not _shift and not _alt and _keycode == 105 then
    -- Ctrl+Win, Ctrl+NUMPAD_Dot
    --~ if _ctrl and not _shift and not _alt and _keycode == 110 then
    -- Ctrl+Win, Ctrl+NUMPAD_Add
    --~ if _ctrl and not _shift and not _alt and _keycode == 107 then
    -- Ctrl+Win, Ctrl+NUMPAD_Sub
    --~ if _ctrl and not _shift and not _alt and _keycode == 109 then
    -- Ctrl+Win, Ctrl+NUMPAD_Mul
    --~ if _ctrl and not _shift and not _alt and _keycode == 106 then
    -- Ctrl+Win, Ctrl+NUMPAD_Div
    --~ if _ctrl and not _shift and not _alt and _keycode == 111 then

    [/autoit] [autoit][/autoit] [autoit]

    -- ##== F - K e y s ==##
    -- Ctrl+Win, Ctrl+F1
    --~ if _ctrl and not _shift and not _alt and _keycode == 112 then
    -- Ctrl+Win, Ctrl+F2
    --~ if _ctrl and not _shift and not _alt and _keycode == 113 then
    -- Ctrl+Win, Ctrl+F3
    --~ if _ctrl and not _shift and not _alt and _keycode == 114 then
    -- Ctrl+Win, Ctrl+F4
    --~ if _ctrl and not _shift and not _alt and _keycode == 115 then
    -- Ctrl+Win, Ctrl+F5
    --~ if _ctrl and not _shift and not _alt and _keycode == 116 then
    -- Ctrl+Win, Ctrl+F6
    --~ if _ctrl and not _shift and not _alt and _keycode == 117 then
    -- Ctrl+Win, Ctrl+F7
    --~ if _ctrl and not _shift and not _alt and _keycode == 118 then
    -- Ctrl+Win, Ctrl+F8
    --~ if _ctrl and not _shift and not _alt and _keycode == 119 then
    -- Ctrl+Win, Ctrl+F9
    --~ if _ctrl and not _shift and not _alt and _keycode == 120 then
    -- Ctrl+Win, Ctrl+F10
    --~ if _ctrl and not _shift and not _alt and _keycode == 121 then
    -- Ctrl+Win, Ctrl+F11
    --~ if _ctrl and not _shift and not _alt and _keycode == 122 then
    -- Ctrl+Win, Ctrl+F12
    --~ if _ctrl and not _shift and not _alt and _keycode == 123 then

    [/autoit] [autoit][/autoit] [autoit]

    fOwnMode = false
    -- avoids default processing
    return true
    end
    fOwnMode = false

    [/autoit] [autoit][/autoit] [autoit]

    -- ##== MOVE LINES ==##
    -- Ctrl+Shift+ArrowUp ##== Move line/selected-lines Up ==##
    if _ctrl and _shift and not _alt and _keycode == 38 then editor:MoveSelectedLinesUp() end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Shift+ArrowDown ##== Move line/selected-lines Down ==##
    if _ctrl and _shift and not _alt and _keycode == 40 then editor:MoveSelectedLinesDown() end

    [/autoit] [autoit][/autoit] [autoit]

    -- ##== MOVE SELECTIONS IN LINE ==##
    -- Ctrl+Alt+ArrowUp ##== Move selection in line Up ==##
    if _ctrl and not _shift and _alt and _keycode == 38 then SelectionMoveV(true) end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Alt+ArrowDown ##== Move selection in line Down ==##
    if _ctrl and not _shift and _alt and _keycode == 40 then SelectionMoveV(false) end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Alt+ArrowLeft ##== Move selection in line to Left ==##
    if _ctrl and not _shift and _alt and _keycode == 37 then SelectionMoveH(true) end

    [/autoit] [autoit][/autoit] [autoit]

    -- Ctrl+Alt+ArrowRight ##== Move selection in line to Right ==##
    if _ctrl and not _shift and _alt and _keycode == 39 then SelectionMoveH(false) end

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    return nil
    end --> EditKey
    -------------------------------------------------------------------------

    [/autoit]

    Dateien

    EditProcessing[0.2].lua 17,42 kB – 629 Downloads
  • Frage zu SciTE 3.2.0

    • BugFix
    • 27. Mai 2013 um 17:12

    Mach dir ein AutoIt-Skript, dass alle 10 Minuten
    aufruft:

    [autoit]

    _MenuCmd($IDM_SAVE)

    [/autoit]


    aus der SciTE-Interface UDF

  • SciTE: Lua - Selection Problem

    • BugFix
    • 24. Mai 2013 um 23:49

    Ich stehe hier vor einem sehr seltsamen Verhalten beim Setzen von Selektionen.
    Das folgende Skript bewirkt, dass das unter dem Cursor stehende Wort selektiert wird. Dies kann entweder für die Wordcharacter gelten (mit Strg+Shift+E) oder zusätzlich mit führendem "$" für Variablen (mit Strg+E).
    Das funktioniert auch tadellos - solange rechts neben dem Begriff ein Leerzeichen steht. Ist dies jedoch nicht so, Dann werden Bereiche selektiert, die nicht mit den Markern übereinstimmen.
    Es spielt übrigens keine Rolle, wie ich die Selektion ausführe ( SelectionStart/-Stop; SetSel(); CharRightExtend() ), immer dasselbe Verhalten.
    Vielleicht hat jemand eine Idee..

    [Ich habe das Problem auch im EN-Forum gepostet.]

    Edit: Problem gelöst! Ursache war, dass SciTe als Standard den HotKey "Strg+E" nutzt um die nächste Klammer zu finden.

    Spoiler anzeigen
    PHP
    -------------------------------------------------------------------------
    EditKey = EventClass:new(Common)
    -------------------------------------------------------------------------
    
    
    -------------------------------------------------------------------------
    -- expand selection to full variable ($variable) or only the word characters (variable)
    ---------------- SetSelection( ) -----------------------------------------
    function SetSelection(_part)
    	local isWordChar = function(_char)
    		if string.char(_char):find('[a-zA-Z0-9_]') then return true end
    		return false
    	end
        local iStart = editor.CurrentPos
    	local iEnd = iStart
        while isWordChar(editor.CharAt[iStart-1]) do
            iStart = iStart - 1
        end
    	if string.char(editor.CharAt[iStart-1]) == "$" and _part == false then iStart = iStart - 1 end
        while isWordChar(editor.CharAt[iEnd]) do
            iEnd = iEnd + 1
        end
        if iStart ~= iEnd then
            editor.SelectionStart = iStart
            editor.SelectionEnd   = iEnd
        end
    end -->SetSelection
    -------------------------------------------------------------------------
    
    
    ----------------- Event: OnKey -----------------------------------------
    function EditKey:OnKey(_keycode, _shift, _ctrl, _alt)
    	if _ctrl and     _shift and not _alt and _keycode == 69 then SetSelection(true) end   --- expand selection to full word with only Wordcharacters
    	if _ctrl and not _shift and not _alt and _keycode == 69 then SetSelection(false) end  --- expand selection to full word with Wordcharacters and leading "$"
    	return nil
    end  --> EditKey
    -------------------------------------------------------------------------
    Alles anzeigen
  • Vorzeitiges Verlassen einer Funktion/Schleife mit Return - Guter Programmierstil oder nicht?

    • BugFix
    • 24. Mai 2013 um 14:36
    Zitat von James1337

    Naja, Variablen wie $i verwende ich zum Beispiel für fast jede For-Schleife...


    Zählervariablen gehören natürlich nicht in die Betrachtung und haben i.A. nur die geplante Lebensdauer des Schleifendurchlaufs. Leider bestehen sie in AutoIt auch ausserhalb der jeweiligen Schleife weiter, was ich als wenig sinnvoll betrachte. Mir würde eine Scopeabgrenzung für jeden Scriptblock (If..EndIf; Do..Until, For..Next usw.) wesentlich besser gefallen.

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™