Danke Simon!
Noch irgendwelche Vorschläge, Kommentare, Bugs?
Beiträge von funkey
-
-
Nettes Spiel.
Es hat aber noch ein paar Bugs.
- Die Labels zur Spielerauswahl sind bei mir zu kurz. Ich kann das letzte 'r' von Spieler nicht mehr sehen
- Hab Einzelplayer gespielt, nachdem ich gewonnen hatte, kam die entsprechende MsgBox, aber das Spiel lief weiter, jedoch konnte natürlich nur noch der Bot weiterkommen.
- Die Icons sind ja riesig!! (5 Icons haben 866 kB)
- Du könntest die Icons (kleinere wären nett) und das Hintergrundbild mit FileInstall in die Exe aufnehmen.
- Sounds wären coolmfg funkey
-
Bin mittlerweile schon bei Version 0.8!
Neuerungen
;Version 0.7: April 08, 2010
;Added: Icon
;Added: Save file when exiting
;Added asterisk (star) to see if file has changed
;Added in context menu: row to clip
;Added in context menu: column to clip
;Added: Support full CSV format <-- thanks a lot to progandy!!
;Added: Enter @CRLF to item with Ctrl+{Enter};Version 0.8: April 23, 2010
;Added: Cut, copy and paste rows
;Added: Renew index after changing row(s)
;Added: Accelerators
;Added: Search and replace strings
;Added: Hide toolbar if you want
;Added: Buttons for row up / row down
;Added: Create new file -
[autoit]
#Include <Timers.au3>
[/autoit][autoit][/autoit][autoit]$hGui = GUICreate("")
[/autoit][autoit][/autoit][autoit]
$Timer = _Timer_SetTimer($hGui, 1000, "_UpdateMsgBox")
MsgBox(262144 + 64, "Countdown", 10, 10)
_Timer_KillTimer($hGui, $Timer)Func _UpdateMsgBox($hWnd, $Msg, $iIDTimer, $dwTime)
[/autoit]
Local $sText = ControlGetText("Countdown", "", "Static2")
ControlSetText("Countdown", "", "Static2", $sText - 1)
EndFunc -
Wow!!
Einfach nur große Klasse!! -
Gibt es schon eine UDF um Icons aus der ImageList zu extrahieren?
-
Das war eines meiner ersten Skripts, hab damit ca. 10000 mp3's in 10 Sekunden eingeordnet!
Skript zum Einordnen von MP3's
Ist zwar ganz simpel und unflexibel, funktioniert aber super. -
Natürlich gibt es bei Autoit auch das doppelte '=='. Man kan es beim Vergleichen von Strings hernehmen um auf CaseSensitive zu überprüfen!
[autoit]Local $String = "Test"
[/autoit][autoit][/autoit][autoit]If $String = "test" Then MsgBox(0,"", "ohne case sensitive")
[/autoit]
If $String == "test" Then MsgBox(0,"=", "mit case sensitive")
If $String == "Test" Then MsgBox(0,"==", "mit case sensitive") -
Bugfix, mit dem Brush kann man jetzt aber nicht mehr die Linienstärke einstellen, ist aber eigentlich sogar besser, weil jetzt die Markierung nicht mehr über das Subitem hinaussteht.
Ich hatte eigentlich ursprünglich nicht vor die Markierung immer wieder zu erneuern, wenn sie durch scrollen verloren geht, aber wenn jemand eine gute Lösung dafür hat, dann habe ich nichts dagegen einzuwenden.Hab die Funktion noch mal erweitert, um entweder das ganze Item zu markieren oder nur wein Subitem.
Ich hoffe auch, dass sich UEZ hier mal meldet, weil auf seinem System die Markierung nicht richtig positioniert wurde.Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>Local $hGui, $listview, $button, $button2, $item1, $item2, $item3, $item4, $item5, $msg
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate("listview items", 220, 250, 100, 200)
[/autoit] [autoit][/autoit] [autoit]$listview = GUICtrlCreateListView("col1 |col2|col3|col4 ", 10, 10, 200, 150, -1, 0x21)
[/autoit] [autoit][/autoit] [autoit]
$button = GUICtrlCreateButton("Mark SubItem", 25, 170, 80, 20)
$button2 = GUICtrlCreateButton("Mark Item", 110, 170, 80, 20)
$item1 = GUICtrlCreateListViewItem("item1|col12|col13|col14", $listview)
$item2 = GUICtrlCreateListViewItem("item2|col22|col23|col24", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33|col34", $listview)
$item4 = GUICtrlCreateListViewItem("item4|col42|col43|col44", $listview)
$item5 = GUICtrlCreateListViewItem("item5|col52|col53|col54", $listview)
GUISetState()Do
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()Select
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Case $msg = $button
_GuiCtrlListView_MarkItem($hGui, $listview, Random(0, 4, 1), Random(0, 3, 1))
Case $msg = $button2
_GuiCtrlListView_MarkItem($hGui, $listview, Random(0, 4, 1), -1, 0xff00)
EndSelect
Until $msg = $GUI_EVENT_CLOSEFunc _GuiCtrlListView_MarkItem($hWndGui, $hWnd, $iIndex, $iSubItem, $Color = 0xFF, $Redraw = 1)
[/autoit] [autoit][/autoit] [autoit]
;funkey April 16, 2010
Local $iSubItemHelp = $iSubItem
Local $aWndSize = WinGetPos($hWndGui)
Local $aWndClientSize = WinGetClientSize($hWndGui)
Local $aPos = ControlGetPos($hWndGui, "", $hWnd)Local $tRECT = DllStructCreate('int Left;int Top;int Right;int Bottom')
[/autoit] [autoit][/autoit] [autoit]
If $iSubItem = -1 Then $iSubItemHelp = 0
Local $aRect = _GUICtrlListView_GetSubItemRect($hWnd, $iIndex, $iSubItemHelp)
If $iSubItem = 0 Then $aRect[2] = _GUICtrlListView_GetColumnWidth($hWnd, 0)
DllCall("user32", 'long', 'SetRect', 'ptr', DllStructGetPtr($tRECT), _
'long', $aRect[0] + $aPos[0] + $aWndSize[2] - $aWndClientSize[0], _
'long', $aRect[1] + $aPos[1] + $aWndSize[3] - $aWndClientSize[1], _
'long', $aRect[2] + $aPos[0] + $aWndSize[2] - $aWndClientSize[0], _
'long', $aRect[3] + $aPos[1] + $aWndSize[3] - $aWndClientSize[1])If $Redraw Then _WinAPI_RedrawWindow($hWndGui)
[/autoit] [autoit][/autoit] [autoit]Local $hDC, $hBrush, $obj_orig
[/autoit] [autoit][/autoit] [autoit]
$hDC = _WinAPI_GetWindowDC($hWndGui)
$hBrush = _WinAPI_CreateSolidBrush($Color)
$obj_orig = _WinAPI_SelectObject($hDC, $hBrush)
_WinAPI_FrameRect($hDC, DllStructGetPtr($tRECT), $hBrush); clear resources
[/autoit]
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hBrush)
_WinAPI_ReleaseDC($hWndGui, $hDC)
EndFunc ;==>_GuiCtrlListView_MarkItem -
-
Danke für's testen!
Hab's noch einmal überarbeitet:Spoiler anzeigen
[autoit]#include <Array.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>Local $hGui, $listview, $button, $item1, $item2, $item3, $item4, $item5, $msg
[/autoit] [autoit][/autoit] [autoit]$hGui = GUICreate("listview items", 220, 250, 100, 200)
[/autoit] [autoit][/autoit] [autoit]If Random(0,1,1) Then GUICtrlCreateMenu("Test") ;manchmal mit, manchmal ohne Menü
[/autoit] [autoit][/autoit] [autoit]$listview = GUICtrlCreateListView("col1 |col2|col3|col4 ", 10, 10, 200, 150, -1, 0x21)
[/autoit] [autoit][/autoit] [autoit]
$button = GUICtrlCreateButton("Click Me!!!!", 75, 170, 70, 20)
$item1 = GUICtrlCreateListViewItem("item1|col12|col13|col14", $listview)
$item2 = GUICtrlCreateListViewItem("item2|col22|col23|col24", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33|col34", $listview)
$item4 = GUICtrlCreateListViewItem("item4|col42|col43|col44", $listview)
$item5 = GUICtrlCreateListViewItem("item5|col52|col53|col54", $listview)
GUISetState()Do
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()Select
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Case $msg = $button
_GuiCtrlListView_MarkItem($hGui, $listview, Random(0, 4, 1), Random(0, 3, 1))
EndSelect
Until $msg = $GUI_EVENT_CLOSEFunc _GuiCtrlListView_MarkItem($hWndGui, $hWnd, $iIndex, $iSubItem, $Color = 0xFF, $Redraw = 1)
[/autoit] [autoit][/autoit] [autoit]
;funkey April 16, 2010
Local $x, $y, $w, $h
Local $aWndSize = WinGetPos($hWndGui)
Local $aWndClientSize = WinGetClientSize($hWndGui)
Local $aPos = ControlGetPos($hWndGui, "", $hWnd)Local $aRect = _GUICtrlListView_GetSubItemRect($hWnd, $iIndex, $iSubItem)
[/autoit] [autoit][/autoit] [autoit]
$x = $aRect[0] + $aPos[0] + $aWndSize[2] - $aWndClientSize[0]
$y = $aRect[1] + $aWndSize[3] - $aWndClientSize[1] + $aPos[1]
$w = $aRect[2] - $aRect[0]
$h = $aRect[3] - $aRect[1]If $Redraw Then _WinAPI_RedrawWindow($hWndGui)
[/autoit] [autoit][/autoit] [autoit]Local $hDC, $hPen, $obj_orig
[/autoit] [autoit][/autoit] [autoit]
$hDC = _WinAPI_GetWindowDC($hWndGui)
$hPen = _WinAPI_CreatePen($PS_SOLID, 3, $Color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)_WinAPI_DrawLine($hDC, $x, $y - 1, $x + $w, $y - 1)
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_DrawLine($hDC, $x, $y - 1, $x, $y + $h - 1)
_WinAPI_DrawLine($hDC, $x + $w, $y - 1, $x + $w, $y + $h - 1)
_WinAPI_DrawLine($hDC, $x, $y + $h - 1, $x + $w, $y + $h - 1); clear resources
[/autoit]
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC($hWndGui, $hDC)
EndFunc ;==>_GuiCtrlListView_MarkItemFunktioniert jetzt super bei mir.
Zitat von BugfixWäre es nicht einfacher, statt der 4 Einzellinien mit _WinAPI_FrameRect() zu zeichnen?
Das RECT könntest du dir gleich mit _GUICtrlListView_GetItemRectEx() ausgeben lassen.
Ganz so einfach geht es auch wieder nicht. -
[autoit]
Local $Vergleich = 30
[/autoit][autoit][/autoit][autoit]
Local $Vacuum = 30Switch $Vergleich
[/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit]
Case $Vacuum - 0.1 To $Vacuum + 0.1
MsgBox(0, "OK", "Messwert in der Toleranz")
Case Else
MsgBox(0, "Fehler", "Messwert außerhalb der Toleranz")
EndSwitch -
Ist ganz toll geworden, wie wir es von dir gewohnt sind!!
Bei mir auf meiner Kiste ruckelt es halt ein wenig, ist aber nicht schlimm. -
Hallo!
Ich hab hier eine Funktion, die bei mir auf WinXP (klassischer und XP-Style einigermaßen gut funktioniert). Ich habe aber berechtigten Zweifel, dass es unter Vista und Win7 noch so stimmt.
Die Funktion _GuiCtrlListView_MarkItem umrandet einfach ein SubItem einer ListView, nur leider sollen auf einigen Systemen die Koordinaten nicht passen, sodass das Quadrat nicht schön über dem SubItem gezeichnet wird. Ich hätte aber natürlich gerne, dass es überall System- und Style-unabhängig gleich gut funktioniert.Vielen Dank für eure Hilfe!
[autoit]#include <GUIConstantsEx.au3>
[/autoit][autoit][/autoit][autoit][/autoit][autoit]
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#Include <WinAPI.au3>Opt('MustDeclareVars', 1)
[/autoit][autoit][/autoit][autoit]Example()
[/autoit][autoit][/autoit][autoit]Func Example()
[/autoit][autoit][/autoit][autoit]
Local $hGui, $listview, $button, $item1, $item2, $item3, $item4, $item5, $input1, $msg
$hGui = GUICreate("listview items", 220, 250, 100, 200)$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150, -1, 0x21)
[/autoit][autoit][/autoit][autoit]
$button = GUICtrlCreateButton("Click Me!!!!", 75, 170, 70, 20)
$item1 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
$item2 = GUICtrlCreateListViewItem("item2|col22|col23", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
$item4 = GUICtrlCreateListViewItem("item4|col42|col43", $listview)
$item5 = GUICtrlCreateListViewItem("item5|col52|col53", $listview)
GUISetState()Do
[/autoit][autoit][/autoit][autoit][/autoit][autoit]
$msg = GUIGetMsg()
Select
Case $msg = $button
_GuiCtrlListView_MarkItem($hGui, $listview, Random(0,4,1), Random(0,2,1))
EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc ;==>ExampleFunc _GuiCtrlListView_MarkItem($hWndGui, $hWnd, $iIndex, $iSubItem, $Color = 0xFF, $Redraw = 1)
[/autoit][autoit][/autoit][autoit]
;funkey April 16, 2010
Local $aPos, $aRect, $aMenu, $aBorder, $aBorder3D, $aWndSize, $aWndClientSize, $Offset, $iSum = 0
Local $x, $y, $w, $h
For $i = 0 To $iSubItem - 1
$iSum += _GUICtrlListView_GetColumnWidth($hWnd, $i)
Next
$aWndSize = WinGetPos($hWndGui)
$aWndClientSize = WinGetClientSize($hWndGui)
$aBorder = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 6) ;SM_CYBORDER
$aBorder3D = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 46) ;SM_CYEDGE
;~ ConsoleWrite("Border: " & $aBorder[0] & @CR)
;~ ConsoleWrite("Border3D: " & $aBorder3D[0] & @CR)
;~ ConsoleWrite("ClientDiff: " & ($aWndSize[2] - $aWndClientSize[0]) / 2 & @CR)
$Offset = $aWndSize[3] - $aWndClientSize[1]
$aRect = _GUICtrlListView_GetItemRect($hWnd, $iIndex)
$aPos = ControlGetPos($hWndGui, "", $hWnd)
$x = $iSum + $aPos[0] + $aRect[0] + ($aWndSize[2] - $aWndClientSize[0]) / 2 + $aBorder3D[0] + $aBorder[0]
$y = $aPos[1] + $aRect[1] + $Offset
$w = _GUICtrlListView_GetColumnWidth($hWnd, $iSubItem)
$h = $aRect[3] - $aRect[1]If $Redraw Then _WinAPI_RedrawWindow($hWndGui)
[/autoit][autoit][/autoit][autoit]Local $hDC, $hPen, $obj_orig
[/autoit][autoit][/autoit][autoit]
$hDC = _WinAPI_GetWindowDC($hWndGui)
$hPen = _WinAPI_CreatePen($PS_SOLID, 2, $Color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)_WinAPI_DrawLine($hDC, $x, $y, $x + $w, $y)
[/autoit][autoit][/autoit][autoit]
_WinAPI_DrawLine($hDC, $x, $y, $x, $y + $h)
_WinAPI_DrawLine($hDC, $x + $w, $y, $x + $w, $y + $h)
_WinAPI_DrawLine($hDC, $x, $y + $h, $x + $w, $y + $h); clear resources
[/autoit]
_WinAPI_SelectObject($hDC, $obj_orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC($hWndGui, $hDC)
EndFunc ;==>ShowCross -
Wozu?
Spoiler anzeigen
[autoit]#cs **************************************************************************
[/autoit] [autoit][/autoit] [autoit]Listview alle spalten überschriften löschen.
[/autoit] [autoit][/autoit] [autoit]http://www.autoit.de/index.php?page…3876#post153876
[/autoit] [autoit][/autoit] [autoit]#ce **************************************************************************
[/autoit] [autoit][/autoit] [autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]#region ### START Koda GUI section ### Form=
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$Form1 = GUICreate("Form1", 357, 266, 192, 124)
$ListView = GUICtrlCreateListView("Spalte1|Spalte2|Spalte3|Spalte4|Spalte5|Spalte6", 0, 0, 353, 135)
$LVItem = GUICtrlCreateListViewItem("1|2|3|4|5|6", $ListView)
$CheckIt = GUICtrlCreateButton("&Neu1", 120, 140, 113)
$CheckIt2 = GUICtrlCreateButton("&Neu2", 120, 190, 113)GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]
#endregion ### END Koda GUI section ###While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $CheckIt
GUICtrlSetData($ListView, " | | ")
Sleep(500)
GUICtrlSetData($ListView, "a|b|c")
Case $CheckIt2
GUICtrlSetData($ListView, " | ")
Sleep(500)
GUICtrlSetData($ListView, "1|2")EndSwitch
[/autoit]
WEnd -
Als Abfallprodukt meines CSV-Editor erhielt ich nun eine Funktion, die im Unterschied zu _GUICtrlListView_EnsureVisible auch das gesuchte SubItem anzeigt.
Ich hoffe, das das jemand brauchen kann.Spoiler anzeigen
[autoit]#include <GuiListView.au3>
[/autoit] [autoit][/autoit] [autoit]GUICreate("Test _GUICtrlListView_EnsureVisibleEx", 600, 600)
[/autoit] [autoit][/autoit] [autoit]Local $sHeader
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To 50
$sHeader &= "|Col" & $i
Next
$sHeader = "Col0" & $sHeaderGlobal $hLV = GUICtrlCreateListView($sHeader, 5, 5, 590, 590)
[/autoit] [autoit][/autoit] [autoit]Local $sItem
[/autoit] [autoit][/autoit] [autoit]
For $i = 1 To 1000
For $j = 0 To 50
$sItem &= Random(1, 1000, 1) & "|"
Next
GUICtrlCreateListViewItem($sItem, $hLV)
$sItem = ""
NextAdlibRegister("_Test_GUICtrlListView_EnsureVisibleEx", 4000)
[/autoit] [autoit][/autoit] [autoit]
_Test_GUICtrlListView_EnsureVisibleEx()GUISetState()
[/autoit] [autoit][/autoit] [autoit]
Do
Until GUIGetMsg() = -3Func _GUICtrlListView_EnsureVisibleEx($hwnd, $iIndex, $iSubItem = 0, $fPartialOK = False)
[/autoit] [autoit][/autoit] [autoit]
;funkey April 15, 2010
If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
_SendMessage($hWnd, $LVM_ENSUREVISIBLE, $iIndex, $fPartialOK)
Local $aRect = _GUICtrlListView_GetItemRect($hWnd, $iSubItem)
Local $iPixel
For $i = 0 To $iSubItem - 2 ; 2 means: show at second visible column
$iPixel += _GUICtrlListView_GetColumnWidth($hWnd, $i)
Next
_GUICtrlListView_Scroll($hWnd, $iPixel + $aRect[0], 0)
EndFuncFunc _Test_GUICtrlListView_EnsureVisibleEx()
[/autoit]
Local $iItem = Random(1, 1000, 1)
Local $iSubItem = Random(0, 50, 1)
Local $sText = _GUICtrlListView_GetItemText($hLV, $iItem, $iSubItem)
ToolTip(StringFormat("EnsureVisible %i/%i - %s", $iItem, $iSubItem, $sText))
_GUICtrlListView_EnsureVisibleEx($hLV, $iItem, $iSubItem)
_GUICtrlListView_SetItemSelected($hLV, $iItem)
_GUICtrlListView_SetSelectedColumn($hLV, $iSubItem)
EndFunc -
Wieso sendest du nicht gleich / anstelle von +7 ?
Hast du ControlSetText schon probiert? Geht meistens besser.Wenn das Programm wirklich dagegen gesichert sein sollte, dann handelt es sich meistens um ein Spiel. Das würde dann gegen die Forenregeln verstoßen, dir weiter zu helfen!
-
Wie bei _IsPressed zu erkennen ist, musst du 0x26 anstelle von 26 verwenden.
Spoiler anzeigen
[autoit]#include <WinAPI.au3>
[/autoit] [autoit][/autoit] [autoit]Local $uparrow
[/autoit] [autoit][/autoit] [autoit]While 1
[/autoit]
Sleep(250)
$uparrow = _WinAPI_GetAsyncKeyState(0x26)
If Not $uparrow = 0 Then
MsgBox(0, "Ok", "OK")
ExitLoop
EndIf
WEnd -
[autoit]
Func _IsPressed($sHexKey, $vDLL = 'user32.dll')
[/autoit]
; $hexKey must be the value of one of the keys.
; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is.
Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x' & $sHexKey)
If @error Then Return SetError(@error, @extended, False)
Return BitAND($a_R[0], 0x8000) <> 0
EndFunc ;==>_IsPressed -
_IECreate hat einen visible-Parameter
