Schau dir mal an:
[autoit]IniReadSectionNames()
IniReadSection()
Schau dir mal an:
[autoit]IniReadSectionNames()
IniReadSection()
Na dann mal einen kleinen PN-Dialog zum Thema von mir:
Zitat von BugFixDu wurdest verwarnt
Bot-Coding
Zitat von TERE: Du wurdest verwarnt
aha und wieso wurde dann der andere thread zugelassen? da ging es auch um cheat enging und die pointer...
Zitat von BugFixRE: RE: Du wurdest verwarnt
Weil ich nicht immer online bin und auch nicht alles lese. Wenn es auch die anderen Mods/Admins übersehen hane, rutscht sowas leider auch mal durch - aber unsere Forenregeln verweisen eindeutig darauf, dass sowas hier nicht erwünscht ist.
Zitat von TERE[3]: Du wurdest verwarnt
ich bin doch gar nicht an dem bot interessiert, es gibt 1000 mal bessere im netz zu finden, mich interessiert nur, es das alles funktioniert.
gibt mir einen kleinen tipp wie ich die base addresse finde, dann bin ich zufrieden und schreibe hier nix mehr rein
![]()
Nur besonders meine Umwandlung Hexadezimal in getrennte 0-255 Werte und zurück ist vermutlich ziemlich unprofessionell
Hier mal "rechnende" Versionen
Func _GetR($RGB)
Return BitAND(BitShift($RGB, 16), 0xFF)
EndFunc
Func _GetG($RGB)
Return BitAND(BitShift($RGB, 8), 0xFF)
EndFunc
Func _GetB($RGB)
Return BitAND($RGB, 0xFF)
EndFunc
Func _RGB2Hex($R, $G, $B)
Return '0x' & Hex($R, 2) & Hex($G, 2) & Hex($B, 2)
EndFunc
und dort dann die Farbe genau in der Mitte (50%) erhält
Ich bin gewiß kein Farbfreak, aber auch mir ist bekannt, dass das optische Empfinden der "Mitte" zwischen zwei Farben rein gar nix mit der "rechnerischen Mitte" zu tun hat.
Hier mußt du dich mal in die verschiedenen Farbraumberechnungen begeben (gibt hier bei Skripten einige Umrechner) und deren Funktionsprinzip ergründen. Mir war das auch immer zu viel. ![]()
Habs getestet, kann den Fehler aber nicht reproduzieren. Läuft wie es soll.
auf: Win 7 Pro 64 Bit
Es können 2 Arten von Bibliotheken verwendet werden: Dll- und Lua-Bibliotheken.
Der Aufruf im Skript erfolgt mit:
Die Funktionen lassen sich dann aufrufen mit:
• Registrieren von Bibliotheken
Damit die Bibliotheken von "require" gefunden werden, müssen die Speicherpfade in der "SciTEStartup.lua" registriert werden.
Dll-Dateien werden registriert in "package.cpath", Lua-Skripts in "package.path".
Damit die eigenen Skripte und Bibliotheken auch nach einem Update von SciTE noch vorhanden sind, darf man diese keinesfalls im Ordner "..\SciTE\LUA" speichern. Dieser wird bei einem Update ungefragt überschrieben. Es empfiehlt sich einen eigenen Ordner dafür anzulegen und diesen Pfad in den "SciTEUser.properties" zu speichern.
Ich habe dort z.B. eingetragen: "Lua.User.Scripts.Path=C:\Code_AutoIt\LUA". Wichtig: Ohne abschließenden Backslash! Nun kann man diesen Pfad überall innerhalb SciTE abfragen mit: "props['Lua.User.Scripts.Path']".
Es können leider nicht alle Dll auch in SciTE genutzt werden. progandy hatte das schon näher beschrieben.
Hier mal als Bsp., wie man sowohl Dll- als auch Lua-Dateien im eigenen Skriptpfad registriert. Die Art der Registrierung ermöglicht, dass die Dateien direkt im benannten Pfad gespeichert sind oder in einem Unterordner, der denselben Namen wie die Datei trägt.
local sUserLua = props["Lua.User.Scripts.Path"]
LUA_USER_PATH = sUserLua .. "\\?.dll;" .. sUserLua .. "\\?\\?.dll;"
package.cpath = LUA_USER_PATH .. package.cpath
LUA_USER_LUA = sUserLua .. "\\?.lua;" .. sUserLua .. "\\?\\?.lua;"
package.path = LUA_USER_LUA .. package.path
• Eigene Bibliotheken erstellen
Das Erstellen eigener Bibliotheken (Lua-Skript) ist eine einfache Sache. Wobei sich die Möglichkeit bietet innerhalb der Bibliothek eigene Funktionsnamen zu verwenden und für den Anwender andere Namen zur Verfügung zu stellen.
Man kann natürlich, wie bei den Includes in AutoIt, auch Bibliotheken in Bibliotheken einbinden.
do
----------------------------------------------------------------------------------------------------
local alien = require "alien"
------------------------------------------------------------------------- STRUCTURES ---------------
local POINT = alien.defstruct{{ 'X', 'int'}, { 'Y', 'int'}}
local RECT = alien.defstruct{{'left', 'long'}, {'top', 'long'}, {'right', 'long'}, {'bottom', 'long'}}
----------------------------------------------------------------------------------------------------
------------------------------------------------------------------------- CONSTANTS ----------------
local __MAXPATH = 260
-- DesiredAccess
local __GENERIC_ALL = 0x10000000
local __GENERIC_READ = 0x80000000
local __GENERIC_WRITE = 0x40000000
local __GENERIC_EXECUTE = 0x20000000
-- CreationDisposition
local __CREATE_NEW = 1
local __CREATE_ALWAYS = 2
local __OPEN_ALWAYS = 4
local __OPEN_EXISTING = 3
local __TRUNCATE_EXISTING = 5
-- FlagsAndAttributes
local __FILE_ATTRIBUTE_ARCHIVE = 0x20
local __FILE_ATTRIBUTE_ENCRYPTED = 0x4000
local __FILE_ATTRIBUTE_HIDDEN = 0x2
local __FILE_ATTRIBUTE_NORMAL = 0x80
local __FILE_ATTRIBUTE_OFFLINE = 0x1000
local __FILE_ATTRIBUTE_READONLY = 0x1
local __FILE_ATTRIBUTE_SYSTEM = 0x4
local __FILE_ATTRIBUTE_TEMPORARY = 0x100
local __FILE_FLAG_BACKUP_SEMANTICS = 0x02000000
local __FILE_FLAG_DELETE_ON_CLOSE = 0x04000000
local __FILE_FLAG_NO_BUFFERING = 0x20000000
local __FILE_FLAG_OPEN_NO_RECALL = 0x00100000
local __FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
local __FILE_FLAG_OVERLAPPED = 0x40000000
local __FILE_FLAG_POSIX_SEMANTICS = 0x0100000
local __FILE_FLAG_RANDOM_ACCESS = 0x10000000
local __FILE_FLAG_SESSION_AWARE = 0x00800000
local __FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000
local __FILE_FLAG_WRITE_THROUGH = 0x80000000
-- ShareMode
local __0 = 0x00000000
local __FILE_SHARE_DELETE = 0x00000004
local __FILE_SHARE_READ = 0x00000001
local __FILE_SHARE_WRITE = 0x00000002
----------------------------------------------------------------------------------------------------
------------------------------------------------------------------------- FUNCTIONS ----------------
WinAPI = {}
--[=[
GetLastError
RECTANGLE:
CopyRect
CreateRect
EqualRect
InflateRect
IntersectRect
IsRectEmpty
OffsetRect
PtInRect
SetRect
SetRectEmpty
SetRectLogic
SubtractRect
UnionRect
CURSOR:
GetCursorPos
DIRECTORY
CreateDirectory
GetCurrentDirectory
RemoveDirectory
SetCurrentDirectory
--]=]
----------------------------------------------------------------------------------------------------
--[[ Gets the last Windows System Error ]]
----------------------------------------------------------------------------------------------------
function WinAPI.GetLastError()
local GetLastError = assert(alien.kernel32.GetLastError)
GetLastError:types{ret = 'long', abi = 'stdcall'}
return GetLastError()
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The CopyRect function copies the coordinates of one rectangle to another.
in...: pointer to the rectangle struct, that should copied
out..: rectangle struct with coordinates from source
]]
----------------------------------------------------------------------------------------------------
function WinAPI.CopyRect(_ptRect)
local rectCopy = RECT:new()
local CopyRect = assert(alien.user32.CopyRect)
CopyRect:types{ret = 'int', abi = 'stdcall', 'pointer', 'pointer'}
CopyRect(rectCopy(), _ptRect)
return rectCopy
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Creates an empty Rectangle structure or fill them with values when they are given.
in...: (optional) coordinates of the rectangle
out..: rectangle struct, empty or with given coordinates
]]
----------------------------------------------------------------------------------------------------
function WinAPI.CreateRect(_iLeft, _iTop, _iRight, _iBottom)
local rect = RECT:new()
if _iLeft == nil then WinAPI.SetRectEmpty(rect())
else WinAPI.SetRect(rect(), _iLeft, _iTop, _iRight, _iBottom) end
return rect
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The EqualRect function determines whether the two specified rectangles are equal by comparing
the coordinates of their upper-left and lower-right corners.
in...: pointer to the rectangle structs
out..: non zero if rectangles are identical, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.EqualRect(_ptRect1, _ptRect2)
local EqualRect = assert(alien.user32.EqualRect)
EqualRect:types{ret = 'int', abi = 'stdcall', 'pointer', 'pointer'}
return EqualRect(_ptRect1, _ptRect2)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The InflateRect function increases or decreases the width and height of the specified rectangle.
The InflateRect function adds dx units to the left and right ends of the rectangle and dy units to
the top and bottom. The dx and dy parameters are signed values; positive values increase the width
and height, and negative values decrease them.
in...: pointer to the rectangle struct, x- and y- value for in-/ decreasing
out..: non zero if success, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.InflateRect(_ptRect, _idX, _idY)
local InflateRect = assert(alien.user32.InflateRect)
InflateRect:types{ret = 'long', abi = 'stdcall', 'pointer', 'long', 'long'}
if _idY == nil then _idY = 0 end
return InflateRect(_ptRect, _idX, _idY)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The IntersectRect function calculates the intersection of two source rectangles and places the
coordinates of the intersection rectangle into the destination rectangle. If the source rectangles
do not intersect, an empty rectangle (in which all coordinates are set to zero) is placed into the
destination rectangle.
in...: pointer to the rectangle structs
out..: non zero if intersect, otherwise zero; 2nd: destination rectangle struct
]]
----------------------------------------------------------------------------------------------------
function WinAPI.IntersectRect(_ptRect1, _ptRect2)
local rInter = RECT:new()
local IntersectRect = assert(alien.user32.IntersectRect)
IntersectRect:types{ret = 'int', abi = 'stdcall', 'pointer', 'pointer', 'pointer'}
return IntersectRect(rInter(), _ptRect1, _ptRect2), rInter
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The IsRectEmpty function determines whether the specified rectangle is empty. An empty rectangle
is one that has no area; that is, the coordinate of the right side is less than or equal to the
coordinate of the left side, or the coordinate of the bottom side is less than or equal to the
coordinate of the top side.
in...: pointer to the rectangle struct
out..: non zero if empty, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.IsRectEmpty(_ptRect)
local IsRectEmpty = assert(alien.user32.IsRectEmpty)
IsRectEmpty:types{ret = 'int', abi = 'stdcall', 'pointer'}
return IsRectEmpty(_ptRect)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The OffsetRect function moves the specified rectangle by the specified offsets.
in...: pointer to the rectangle struct, offset values for x and y
out..: non zero if success, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.OffsetRect(_ptRect, _iX, _iY)
local OffsetRect = assert(alien.user32.OffsetRect)
OffsetRect:types{ret = 'long', abi = 'stdcall', 'pointer', 'long', 'long'}
if _iY == nil then _iY = 0 end
return OffsetRect(_ptRect, _iX, _iY)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The PtInRect function determines whether the specified point lies within the specified rectangle.
A point is within a rectangle if it lies on the left or top side or is within all four sides.
A point on the right or bottom side is considered outside the rectangle.
in...: x and y coordinates from point, pointer to the rectangle struct
out..: non zero if point inside the rectangle, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.PtInRect(_iX, _iY, _ptRect)
local PtInRect = assert(alien.user32.PtInRect)
PtInRect:types{ret = 'int', abi = 'stdcall', 'pointer', 'pointer'}
local point = POINT:new()
point.X = _iX
point.Y = _iY
return PtInRect(point, _ptRect)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The SetRect function sets the coordinates of the specified rectangle. This is equivalent to
assigning the left, top, right, and bottom arguments to the appropriate members of the RECT structure.
in...: pointer to the rectangle struct, values to set (left, top, right, bottom)
out..: non zero if success, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.SetRect(_ptRect, _iLeft, _iTop, _iRight, _iBottom)
local SetRect = assert(alien.user32.SetRect)
SetRect:types{ret = 'long', abi = 'stdcall', 'pointer', 'long', 'long', 'long', 'long'}
return SetRect(_ptRect, _iLeft, _iTop, _iRight, _iBottom)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The SetRectEmpty function sets all coordinates are of the given rectangle to zero.
in...: pointer to the rectangle struct
out..: non zero if success, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.SetRectEmpty(_ptRect)
local SetRectEmpty = assert(alien.user32.SetRectEmpty)
SetRectEmpty:types{ret = 'long', abi = 'stdcall', 'pointer'}
return SetRectEmpty(_ptRect)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Swaps the values, if they were placed logically false.
in...: rectangle struct
out..: rectangle struct with swapped values, if required
]]
----------------------------------------------------------------------------------------------------
function WinAPI.SetRectLogic(_Rect)
if _Rect.left > _Rect.right then _Rect.left, _Rect.right = _Rect.right, _Rect.left end
if _Rect.top > _Rect.bottom then _Rect.top, _Rect.bottom = _Rect.bottom, _Rect.top end
return _Rect
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The SubtractRect function determines the coordinates of a rectangle formed by subtracting
one rectangle from another.
in...: pointer to the rectangle structs
out..: non zero if destination rectangle has values, otherwise zero; 2nd: destination rectangle struct
]]
----------------------------------------------------------------------------------------------------
function WinAPI.SubtractRect(_ptRect1, _ptRect2)
local SubtractRect = assert(alien.user32.SubtractRect)
SubtractRect:types{ret = 'int', abi = 'stdcall', 'pointer', 'pointer', 'pointer'}
local rectSub = RECT:new()
return SubtractRect(rectSub(), _ptRect1, _ptRect2), rectSub
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ The UnionRect function creates the union of two rectangles. The union is the smallest rectangle
that contains both source rectangles.
in...: pointer to the rectangle structs
out..: non zero if destination rectangle has values, otherwise zero; 2nd: destination rectangle struct
]]
----------------------------------------------------------------------------------------------------
function WinAPI.UnionRect(_ptRect1, _ptRect2)
local UnionRect = assert(alien.user32.UnionRect)
UnionRect:types{ret = 'int', abi = 'stdcall', 'pointer', 'pointer', 'pointer'}
local rectUnion = RECT:new()
return UnionRect(rectUnion(), _ptRect1, _ptRect2), rectUnion
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Retrieves the position of the mouse cursor, in screen coordinates.
in...: ---
out..: point structure of position; 2nd: x-coordinate; 3rd: y-coordinate
]]
----------------------------------------------------------------------------------------------------
function WinAPI.GetCursorPos()
local CursorPos = assert(alien.user32.GetCursorPos)
CursorPos:types{ret = 'int', abi = 'stdcall', "pointer"}
local pos = POINT:new()
CursorPos(pos())
return pos, pos.X, pos.Y
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Creates a new directory.
in...: full path to the directory, limited length 260 -12 to allow append an 8.3 file name
out..: non zero if success, otherwise zero
]]
----------------------------------------------------------------------------------------------------
function WinAPI.CreateDirectory(_sPath)
if _sPath:len() > __MAXPATH -12 then return nil end
local CreateDirectory = assert(alien.kernel32.CreateDirectoryA)
CreateDirectory:types{ret = 'int', abi = 'stdcall', 'string', 'pointer'}
return CreateDirectory(_sPath..string.char(0), 0)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Retrieves the current directory for the current process.
in...: ---
out..: directory full path; if path length > 260 returns nil
]]
----------------------------------------------------------------------------------------------------
function WinAPI.GetCurrentDirectory()
local GetCurrentDirectory = assert(alien.kernel32.GetCurrentDirectoryA)
GetCurrentDirectory:types{ret = 'long', abi = 'stdcall', 'long', 'string'}
local buff = alien.buffer()
local iRet = GetCurrentDirectory(__MAXPATH, buff)
if iRet > __MAXPATH then return nil end
return tostring(buff)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Deletes an existing empty directory.
in...: full path to the directory want to delete
out..: non zero if success, otherwise zero; if path length > 260 returns nil
]]
----------------------------------------------------------------------------------------------------
function WinAPI.RemoveDirectory(_sPath)
if _sPath:len() > __MAXPATH then return nil end
local RemoveDirectory = assert(alien.kernel32.RemoveDirectoryA)
RemoveDirectory:types{ret = 'int', abi = 'stdcall', 'string'}
return RemoveDirectory(_sPath)
end
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--[[ Changes the current directory for the current process.
in...: full path to the new directory
out..: non zero if success, otherwise zero; if path length > 260 -2 returns nil (path:len + '\' + char(0))
]]
----------------------------------------------------------------------------------------------------
function WinAPI.SetCurrentDirectory(_sPath)
if _sPath:len() > __MAXPATH -2 then return nil end
local SetCurrentDirectory = assert(alien.kernel32.SetCurrentDirectoryA)
SetCurrentDirectory:types{ret = 'int', abi = 'stdcall', 'string'}
return SetCurrentDirectory(_sPath..string.char(0))
end
----------------------------------------------------------------------------------------------------
return WinAPI
end
Alles anzeigen
NB: Da ich gerade erst die aktuelle Version von SciTE installiert habe, ist mir folgendes aufgefallen:
Um Lua Skripte in SciTE auszuführen war es bei der vorigen Version ausreichend, in der SciTEUser.properties einzutragen:
command.go.$(file.patterns.lua)=dofile $(FilePath).
In der aktuellen Version muss zusätzlich auch das Subsystem angegeben werden:
command.go.subsystem.$(file.patterns.lua)=3
AnMa:
Um dir wirklich helfen zu können, stelle bitte immer lauffähigen Code ein.
Also erstelle ein Bsp.-Skript, mit Bildquellen, die auf jedem Windows-PC vorhanden sind (bevorzugte Variante) oder liefere die Bilder als Anhang mit. Dieses Skript muss dann auch nachvollziehbar den geschilderten Fehler produzieren.
Ich behaupte nach wie vor, dass dein Programm falsch strukturiert ist. Sonst würdest du nie in solche Rekursionen gelangen.
Ausserdem kann doch die Verbindung zur Datenbank nur an einer Stelle erstellt werden, völlig egal in welcher Rekursionstiefe. Und genau an dieser Stelle läßt du eine Schleife laufen bis Verbindung steht oder definitiv keine Verbindung erstellbar -- und dann kannst du das Programm getrost beenden, da es ja diese Datenanbindung benötigt.
Sorry, aber ich kann da kein Problem sehen.
Was hindert dich denn, deinem Programm so eine Struktur zu verpassen, dass es wie von dir gewünscht reagiert?
Also du hast folgende Prämissen gesetzt:
- Datenbasis soll erreicht werden
- wenn das fehlschlägt, soll das Skript "von vorn" anfangen
Das kannst du doch ganz simpel mit einer Schleife lösen, in die du noch eine Sicherheit einbaust, damit sie sich nicht totlaufen kann. Etwa so:
[autoit]
$iZaehler = 1
While $iZaehler <= 10 ; == Anzahl der Versuche die Verbindung herzustellen
$Connection = _ConnectToDatabase() ; == im Fehlerfall am Besten 0 zurückgeben, bei Erfolg 1 od. anderen Wert <> 0
If $Connection Then ExitLoop
$iZaehler += 1
WEnd
; == Falls auch nach 10 Versuchen kein Erfolg, mit Meldung beenden
If Not $Connection Then Exit MsgBox(0, 'Fehler', 'Verbindung zur Datenbank auch nach mehreren Versuchen nicht erfolgreich. Ein schwerwiegendes Problem liegt vor.')
Fehler können nur dann abgefangen werden, wenn bekannt ist wo sie überhaupt entstehen können!
Genau so sehe ich das auch. Und dazu gehört meiner Meinung nach einfach, wenn es um eine Produktivumgebung geht, dass man halt jedes Datei Lesen/Schreiben, Array Laden etc. auch wirklich handelt. Damit bin ich bisher immer gut gefahren.
"Unerwartete Fehler" habe ich noch nicht erlebt (bei eigenen Skripten). Aber auch da kann man zumindest zur Auswertung vorbeugen, indem man einfach jede Aktion des Skripts mit Wertangaben loggt bevor der entsprechende Befehl ausgeführt wird. Somit ist der letzte Eintrag im Fehlerfall die Situation an der es gecrasht hat.
..Überleg mal, wieviel Zeit und Energie du inzwischen aufgewendet hast, um dich vorm Error-Handling zu drücken.
In der Zeit hättest du auch locker das Errorhandling geschrieben. ![]()
Dein Ansinnen ist schon klar. Aber genau dazu verwendet man doch nach JEDEM möglichen Fehlerquell eine Fehlerbehandlung.
In einem großen Programm hast du durchaus 30-40% Error-Handling. Das ist völlig normal. Und es macht wirklich keinen Sinn sich vor dieser Schreibarbeit drücken zu wollen... ![]()
Sorry fals ich mich irre
Du irrst. Wie du dem Code entnehmen kannst, wird die Funktion immer mit genau einem String der Länge 4 aufgerufen (erstellt mit der Codezeile:
$aNumber = StringRegExp($binary, "\d{4}", 3)
[/autoit]). ![]()
Du kannst Anführungszeichen mit sich selbst maskieren.
Folgende Zeilen ergeben denselben Output:
$s1 = "Das ist ein ""Text"" mit Selbstmaskierung"
$s2 = 'Das ist ein ''Text'' mit Selbstmaskierung'
$s3 = 'Das ist ein "Text" ohne Selbstmaskierung'
Wenn ich mich recht erinnere (Garantie geb ich keine :)), ist .Execute der falsche Ansatz. Du benötigst .Query um ein Result zu erhalten, das du wiederum mit .FetchRow auswertest.
Edit: Execute sollte doch gehen. Es wird ja ein Datensatz-Objekt zurückgeliefert dessen Inhalte mit .Fields zur Verfügung gestellt werden.
Ich habe dasselbe Ergebnis, wie Oscar:
AutoIt 3.3.8.1 = 3899
OS: Win7 - x64
Dann suchst du wohl eher einen SimpleExplorer um zu navigieren und auszuwählen.
Sowas hab ich vor Jahren mal gemacht. Kannst du ja als Basis nehmen:
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <File.au3>
Global $aFile, $aFolder, $aPath[1] = [@HomeDrive & '\'], $currPath, $sUp = '[ EBENE HÖHER ]'
Global $Safed = '[SHOC]' ; mit diesen Attributen gesperrt für: Ausführen, Umbenennen, Löschen
$GUI = GUICreate("Simple Explorer",400,300)
$label = GUICtrlCreateLabel('', 5, 5, 390, 53)
$List = GUICtrlCreateList( '', 2, 65, 396, 230, BitOR($WS_HSCROLL, $WS_VSCROLL, $WS_BORDER))
$hList = GUICtrlGetHandle($List)
$menu = GUICtrlCreateContextMenu($List)
$itemRun = GUICtrlCreateMenuItem('Ausführen', $menu)
$itemShape = GUICtrlCreateMenuItem('', $menu)
$itemCopy = GUICtrlCreateMenuItem('Kopieren', $menu)
$itemPaste = GUICtrlCreateMenuItem('Einfügen', $menu)
GUICtrlSetState(-1, $GUI_DISABLE)
$itemRen = GUICtrlCreateMenuItem('Umbenennen', $menu)
$itemShape = GUICtrlCreateMenuItem('', $menu)
$itemDel = GUICtrlCreateMenuItem('Löschen', $menu)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
[/autoit] [autoit][/autoit] [autoit]_WriteList($aPath[0])
[/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $itemRun
_RunFile()
Case $itemCopy
_CopyFile()
Case $itemPaste
_PasteFile()
Case $itemRen
_RenFile()
Case $itemDel
_DelFile()
EndSwitch
Wend
Func _WriteList($PATH)
_GUICtrlListBox_ResetContent($hList) ; alte Inhalte löschen
$aFolder = _FileListToArray($PATH, '*', 2)
$aFile = _FileListToArray($PATH, '*', 1)
If UBound($aPath) > 1 Then _GUICtrlListBox_AddString($hList, $sUp)
If IsArray($aFolder) Then
_GUICtrlListBox_AddString($hList, '--------------- ORDNER ---------------')
For $i = 1 To UBound($aFolder) -1
_GUICtrlListBox_AddString($hList, $aFolder[$i])
Next
EndIf
If IsArray($aFile) Then
_GUICtrlListBox_AddString($hList, '--------------- DATEIEN ---------------')
For $i = 1 To UBound($aFile) -1
_GUICtrlListBox_AddString($hList, $aFile[$i])
Next
EndIf
GUICtrlSetData($label, $PATH)
EndFunc
Func _ListDblClick()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
Local $tmpPath = ''
If $str = $sUp Then
ReDim $aPath[UBound($aPath)-1]
$currPath = $aPath[UBound($aPath)-1]
_WriteList($currPath)
Else
$currPath = $aPath[UBound($aPath)-1] & $str & '\' ; neuer Pfad = letzter Pfad + geklickter Pfad
If Not StringRegExp(FileGetAttrib($currPath), 'D') Then ; ist es kein Ordner ?
_RunFile()
Else
ReDim $aPath[UBound($aPath)+1]
$aPath[UBound($aPath)-1] = $currPath ; neuen Pfad hinzufügen
_WriteList($currPath)
EndIf
EndIf
EndFunc
Func _RunFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, $Safed) Then Return MsgBox(0, 'Geschützt!', $str & ' - Attribut: ' & $attrib)
ShellExecuteWait($aPath[UBound($aPath)-1] & $str)
EndFunc
Func _CopyFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, 'D') Then Return MsgBox(0, 'Achtung', $str & ' ist keine Datei')
ClipPut($aPath[UBound($aPath)-1] & $str)
GUICtrlSetState($itemPaste, $GUI_ENABLE)
EndFunc
Func _PasteFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If Not StringRegExp($attrib, 'D') Then Return MsgBox(0, 'Achtung', $str & ' - ist kein Ordner')
Local $tmp = ClipGet(), $pos = StringInStr($tmp, '\', -1)
Local $file = StringRight($tmp, StringLen($tmp)-$pos)
If FileExists($aPath[UBound($aPath)-1] & $str & '\' & $file) Then $file = 'Kopie von ' & $file
FileCopy($tmp, $aPath[UBound($aPath)-1] & $str & '\' & $file)
_WriteList($aPath[UBound($aPath)-1])
GUICtrlSetState($itemPaste, $GUI_DISABLE)
EndFunc
Func _RenFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, $Safed) Then Return MsgBox(0, 'Geschützt!', $str & ' - Attribut: ' & $attrib)
Local $tmp = InputBox('Umbenennen', 'Neuer Name:' & @LF & @LF & $aPath[UBound($aPath)-1], $str)
If $tmp <> '' Then FileMove($aPath[UBound($aPath)-1] & $str, $aPath[UBound($aPath)-1] & $tmp)
_WriteList($aPath[UBound($aPath)-1])
EndFunc
Func _DelFile()
Local $str = _GUICtrlListBox_GetText($hList, _GUICtrlListBox_GetCurSel($hList))
If $str = '' Then Return
Local $attrib = FileGetAttrib($aPath[UBound($aPath)-1] & $str)
If StringRegExp($attrib, $Safed) Then Return MsgBox(0, 'Geschützt!', $str & ' - Attribut: ' & $attrib)
FileDelete($aPath[UBound($aPath)-1] & $str)
_WriteList($aPath[UBound($aPath)-1])
EndFunc
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
If Not IsHWnd($hList) Then $hWndListBox = GUICtrlGetHandle($hList)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
$iCode = BitShift($iwParam, 16) ; Hi Word
Switch $hWndFrom
Case $hList, $hWndListBox
Switch $iCode
Case $LBN_DBLCLK ; Sent when the user double-clicks a string in a list box
_ListDblClick()
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
Welchen Sinn soll das Einbetten haben? Stehe da voll auf der Leitung.
Wenn der Anwender eine Datei wählen soll, erscheint die Datei/der Dateipfad nach der Auswahl in einem Input. Wozu willst du Platz verschwenden und ein Tree/Listview zur Auswahl ständig anzeigen, wenn nur einmalig darauf zugegriffen wird?
Ist doch als native Funktion in AutoIt enthalten:
[autoit]FileOpenDialog() ; == Datei-Öffnen
FileSelectFolder() ; == Ordner wählen
Guckst du auf JEDEC.org ![]()
Manchmal sind die einfachsten Ideen auch die besten
(übrigens bei mir der erste Treffer in der Suche..
)