Jump to content

Markus

Active Members
  • Posts

    134
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Markus's Achievements

Adventurer

Adventurer (3/7)

2

Reputation

  1. Hi, I have an existing sql db created in my memory. When my script exits I want to copy that db into a file. $memoryDb=_SQLite_Open() things are done with the memory db here $fileDb=_SQLite_Open(@ScriptDir & "\localfile.db") Is there a command like this? _SQLite_CopyFromTo($memoryDb,$fileDb)
  2. Hi, I want to create an insertmark using this code: ;create the structure $a = DllStructCreate("uint cbSize;dword dwFlags;int iItem;dword dwReserved") ;DllStructSetData($a,"cbSize",-1) DllStructSetData($a,"dwFlags","LVIM_AFTER") DllStructSetData($a,"iItem",1) DllStructSetData($a,"dwReserved",0) ;send the message _SendMessage(GUICtrlGetHandle($mylistview), $LVM_SETINSERTMARK, 0, DllStructGetPtr($a)) MSDN Source for SendMessage MSDN Source for the DLLStruct It just doesn't work. Please help me. Greets Markus EDIT: DllStructSetData($a,"cbSize",DllStructGetSize($a)) is the solution
  3. Doesn't work well, as mouseclicks don't reach the treeview sometimes.
  4. Hi, is it possible to set a background image for a treeview, or make the treeview transparent somehow to display a pic control behind it? Greets Markus
  5. Somehow that only works for the top most nodes for me, not for child nodes, they neither expand nor collapse EDIT: found the error, i had used _GUICtrlTreeView_GetText instead of _GUICtrlTreeView_GetTree there ControlTreeView ($gui, "", $treeview, "Expand", _GUICtrlTreeView_GetTree($treeview,$idsCats[$i]))
  6. How is it possible to collapse a TreeViewItem? Thank you in advance. _GUICtrlTreeView_Expand(...) doesn't help because the treeview doesn't "remember" which childs have been expanded and which childs have been collapsed, when the parent node is expanded again. I want the usual double click behavior just for a single click.
  7. It doesn't do anything if you have to guess. As there is no field opened at the beginning, you have to guess. So always when that message appears, click anywhere in the field and then "OK" in the message. If you have a game situation where you don't have to guess but that message still appears, there's a bug
  8. Have to check the screen size in the office tomorrow (weekend suxx :-P) You could change the pixelarea - or make an array with different areas, that are randomly checked.
  9. Botrecords: Minesweeper: 33 seconds Pinball: 2.6 millions
  10. Being bored at work with only having the stupid windows xp games Minesweeper and Pinball I wrote bots for both. Now I'm even more bored. PinballBot: start pinball (or add a shellexecute line) (doesn't work with fullscreen) HotKeySet("^q","quit") WinMove("3D-Pinball","",0,0) WinActivate("3D-Pinball","") WinWaitActive("3D-Pinball","") $sumleft=PixelChecksum(159,429,173,454) $sumright=PixelChecksum(197,429,210,454) AutoItSetOption("SendKeyDownDelay",100) AutoItSetOption("SendKeyDelay",200) While 1 If PixelChecksum(159,429,173,454)<>$sumleft Then Send("y") If PixelChecksum(197,429,210,454)<>$sumright Then Send("m") WEnd Func quit() Exit EndFunc And the more difficult MinesweeperBot: ShellExecute("C:\WINDOWS\system32\winmine.exe") WinWaitActive("MineSweeper") HotKeySet("^q","_quit") HotKeySet("^h","_forhotkey") WinActivate("MineSweeper") WinMove("MineSweeper","",0,0) Sleep(200) ;Dim $alltime=0 Dim $xstart=15 Dim $ystart=105 Dim $fieldwidth=16 Dim $fieldheight=16 Dim $fieldspos[31][17][2] Dim $fieldsstates[31][17][3] Dim $fieldsprocessed[31][17] Dim $fieldinfluenced[31][17] For $y=1 To 16 For $x=1 To 30 $fieldspos[$x][$y][0]=$xstart+($x-1)*$fieldwidth $fieldspos[$x][$y][1]=$ystart+($y-1)*$fieldheight Next Next ;MsgBox(0,"",_field_get_numb(7,2)) ;MsgBox(0,"",_field_get_col(13,5)) ;MsgBox(0,"",_field_get_col(26,7)) ;MsgBox(0,"",Hex(PixelGetColor($fieldspos[5][13][0]+7,$fieldspos[5][13][1]+7))) ;MsgBox(0,"",Hex(PixelGetColor(327,250))) _scan() While 1 _bot() ;_calculatestates() WEnd Func _forhotkey() $teststring="" For $y=1 To 16 For $x=1 To 30 If $fieldsstates[$x][$y][0]=10 Then $teststring&="x" Else $teststring&=$fieldsstates[$x][$y][0] EndIf Next $teststring&=@CRLF Next MsgBox(0,"",$teststring) EndFunc Func _scan() For $y=1 To 16 For $x=1 To 30 $fieldsstates[$x][$y][0]=_field_get_numb($x,$y) Next Next _calculatestates() EndFunc Func _bot() For $y=1 To 16 For $x=1 To 30 $fieldsprocessed[$x][$y]=0 Next Next For $y=1 To 16 For $x=1 To 30 If $fieldsstates[$x][$y][0]>0 And $fieldsstates[$x][$y][0]<9 Then If $fieldsstates[$x][$y][0]-$fieldsstates[$x][$y][1]=$fieldsstates[$x][$y][2] Then _setflags($x,$y) EndIf If $fieldsstates[$x][$y][0]=$fieldsstates[$x][$y][1] And $fieldsstates[$x][$y][2]>0 Then _setopenfields($x,$y) EndIf EndIf Next Next $clicked=0 For $y=1 To 16 For $x=1 To 30 If $fieldsprocessed[$x][$y]=1 Then $clicked=1 Next Next If $clicked=0 Then ;MsgBox(0,"Bot Message","Nothing found with usual way." & @crlf & "Starting special search.") _checkspecialmoves() EndIf $clicked=0 For $y=1 To 16 For $x=1 To 30 If $fieldsprocessed[$x][$y]=1 Then $clicked=1 Next Next If $clicked=0 Then MsgBox(0,"Bot Message","Also special search doesn't help - you have to guess." & @crlf & "Over and Out") _scan() #cs For $y=1 To 16 If $clicked Then ExitLoop For $x=1 To 30 If $clicked Then ExitLoop If $fieldsstates[$x][$y][0]=0 Then MouseClick("left",$fieldspos[$x][$y][0]+16,$fieldspos[$x][$y][1]+16,1,0) $fieldsprocessed[$x][$y]=1 Sleep(50) $fieldsstates[$x][$y][0]=_field_get_numb($x,$y) If $fieldsstates[$x][$y][0]=9 Then _scanaroundfield($x,$y) EndIf _calculatestatesaroundfield($x,$y) $clicked=1 EndIf Next Next #ce EndIf EndFunc Func _checkspecialmoves() For $y=1 To 16 For $x=1 To 30 For $yinner=1 To 16 For $xinner=1 To 30 $fieldinfluenced[$xinner][$yinner]=0 Next Next If $fieldsstates[$x][$y][0]>1 And $fieldsstates[$x][$y][0]<7 And $fieldsstates[$x][$y][2]>1 Then _search($x,$y) EndIf Next Next EndFunc Func _search($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]>0 And $fieldsstates[$tmpx][$tmpy][0]<6 Then _setinfluence($xfield,$yfield) _subtractinfluence($tmpx,$tmpy) $numbStillInfluenced=0 For $y=1 To 16 For $x=1 To 30 If $fieldinfluenced[$x][$y]=1 Then $numbStillInfluenced+=1 Next Next If $fieldsstates[$xfield][$yfield][0]-$fieldsstates[$xfield][$yfield][1]-$fieldsstates[$tmpx][$tmpy][0]+$fieldsstates[$tmpx][$tmpy][1]=$numbStillInfluenced Then For $y=1 To 16 For $x=1 To 30 If $fieldinfluenced[$x][$y]=1 And $fieldsprocessed[$x][$y]=0 Then ;MsgBox(0,"Bot Message","Special search succesful" & @crlf & "flag on: " & @crlf & "x: " & $x & " y: " & $y & @crlf & @crlf & "reason:" & @crlf & "field: x:" & $xfield & " y: " & $yfield & @crlf & "Still Influenced: " & $numbStillInfluenced) MouseClick("right",$fieldspos[$x][$y][0]+5,$fieldspos[$x][$y][1]+5,1,0) $fieldsprocessed[$x][$y]=1 $fieldsstates[$x][$y][0]=10 _calculatestatesaroundfield($x,$y) EndIf Next Next EndIf EndIf EndIf Next EndFunc Func _setinfluence($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=0 Then $fieldinfluenced[$tmpx][$tmpy]=1 EndIf EndIf Next EndFunc Func _subtractinfluence($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=0 Then $fieldinfluenced[$tmpx][$tmpy]=0 EndIf EndIf Next EndFunc Func _field_get_col($xfield,$yfield) Return Hex(PixelGetColor($fieldspos[$xfield][$yfield][0]+10,$fieldspos[$xfield][$yfield][1]+10)) EndFunc Func _field_get_numb($xfield,$yfield) $col=_field_get_col($xfield,$yfield) $numb=0 If $col="00C0C0C0" Then $numb=0;field to click If $col="000000FF" Then $numb=1 If $col="00008000" Then $numb=2 If $col="00FF0000" Then $numb=3 If $col="00000080" Then $numb=4 If $col="?" Then $numb=5 If $col="?" Then $numb=6 If $col="?" Then $numb=7 If $col="?" Then $numb=8 If $col="00000000" Then $numb=10;fahne If $numb=0 Then If Hex(PixelGetColor($fieldspos[$xfield][$yfield][0],$fieldspos[$xfield][$yfield][1]))<>"00FFFFFF" Then $numb="9";open field EndIf EndIf Return $numb EndFunc Func _field_get_flags_around($xfield,$yfield) $numberflags=0 For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=10 Then $numberflags+=1 EndIf Next Return $numberflags EndFunc Func _field_get_openfields_around($xfield,$yfield) $numberopenfields=0 For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=0 Then $numberopenfields+=1 EndIf Next Return $numberopenfields EndFunc Func _setflags($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=0 And $fieldsprocessed[$tmpx][$tmpy]=0 Then MouseClick("right",$fieldspos[$tmpx][$tmpy][0]+5,$fieldspos[$tmpx][$tmpy][1]+5,1,0) $fieldsprocessed[$tmpx][$tmpy]=1 $fieldsstates[$tmpx][$tmpy][0]=10 _calculatestatesaroundfield($tmpx,$tmpy) EndIf EndIf Next EndFunc Func _setopenfields($xfield,$yfield) ;MouseClick("left",$fieldspos[$xfield][$yfield][0]+16,$fieldspos[$xfield][$yfield][1]+16) ;MouseClick("right",$fieldspos[$xfield][$yfield][0]+16,$fieldspos[$xfield][$yfield][1]+16) ;_scanaroundfield($xfield,$yfield) ;_calculatestatesaroundfield($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=0 And $fieldsprocessed[$tmpx][$tmpy]=0 Then MouseClick("left",$fieldspos[$tmpx][$tmpy][0]+14,$fieldspos[$tmpx][$tmpy][1]+14,1,0) $fieldsprocessed[$tmpx][$tmpy]=1 Sleep(50) $fieldsstates[$tmpx][$tmpy][0]=_field_get_numb($tmpx,$tmpy) If $fieldsstates[$tmpx][$tmpy][0]=9 Then ;MouseMove(0,0,0) _scan() Else _calculatestatesaroundfield($tmpx,$tmpy) EndIf EndIf EndIf Next EndFunc Func _scanaroundfield($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then If $fieldsstates[$tmpx][$tmpy][0]=0 And $fieldsprocessed[$tmpx][$tmpy]=0 Then $fieldsprocessed[$tmpx][$tmpy]=1 Sleep(50) $fieldsstates[$tmpx][$tmpy][0]=_field_get_numb($tmpx,$tmpy) If $fieldsstates[$tmpx][$tmpy][0]=9 Then _scanaroundfield($tmpx,$tmpy) EndIf _calculatestatesaroundfield($tmpx,$tmpy) EndIf EndIf Next EndFunc Func _calculatestates() For $y=1 To 16 For $x=1 To 30 $fieldsstates[$x][$y][1]=_field_get_flags_around($x,$y) Next Next For $y=1 To 16 For $x=1 To 30 $fieldsstates[$x][$y][2]=_field_get_openfields_around($x,$y) Next Next EndFunc Func _calculatestatesaroundfield($xfield,$yfield) $fieldsstates[$xfield][$yfield][1]=_field_get_flags_around($xfield,$yfield) $fieldsstates[$xfield][$yfield][2]=_field_get_openfields_around($xfield,$yfield) For $i=1 To 8 Switch $i Case 1 $tmpx=$xfield-1 $tmpy=$yfield-1 Case 2 $tmpx=$xfield-1 $tmpy=$yfield Case 3 $tmpx=$xfield-1 $tmpy=$yfield+1 Case 4 $tmpx=$xfield $tmpy=$yfield+1 Case 5 $tmpx=$xfield+1 $tmpy=$yfield+1 Case 6 $tmpx=$xfield+1 $tmpy=$yfield Case 7 $tmpx=$xfield+1 $tmpy=$yfield-1 Case 8 $tmpx=$xfield $tmpy=$yfield-1 EndSwitch If $tmpx>0 And $tmpx<31 And $tmpy>0 And $tmpy<17 Then $fieldsstates[$tmpx][$tmpy][1]=_field_get_flags_around($tmpx,$tmpy) $fieldsstates[$tmpx][$tmpy][2]=_field_get_openfields_around($tmpx,$tmpy) EndIf Next EndFunc Func _quit() Exit EndFunc How to use MinesweeperBot: as the bot only works for professional mode (the biggest one) you have to start minesweeper before using the bot and set the mode to professional, then close minesweeper and start the bot (maybe you have to change the path in the first line). run him and wait. The message "Bot Message" will appear. Always if that message appears you have to guess, as Minesweeper suxx you often have to guess....
  11. Here it is selected correctly: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> GUICreate("",400,400) GUISetState() $inputs = GUICtrlCreateCombo("", 10, 10, 150, 30) For $i = 1 To 3 GUICtrlSetData($inputs,"testtest" & $i) Next _GUICtrlComboBox_SetCurSel($inputs, 2) _GUICtrlComboBox_SetEditSel($inputs, 0, 4) Sleep(3000) Here it isn't selected: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> GUICreate("",400,400) $inputs = GUICtrlCreateCombo("", 10, 10, 150, 30) For $i = 1 To 3 GUICtrlSetData($inputs,"testtest" & $i) Next GUISetState() _GUICtrlComboBox_SetCurSel($inputs, 2) _GUICtrlComboBox_SetEditSel($inputs, 0, 4) Sleep(3000) using Vista OS (the difference is the line position of GUISetState())
  12. I deleted all data from a *.db file created by the usual autoit sql functions with the _SQLite_Exec(-1, "DELETE FROM...") command. the select query didn't find any data after that anymore. But if I look at the *.db file it still has the same size and if i open it in notepad the data is still there. (Maybe familiar problem but couldn't find a thread here)
×
×
  • Create New...