Jump to content

xan

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by xan

  1. Thank you for simplifying this post.
  2. A simple code make in Autoit files https://www.4shared.com/get/TixvzsqSce/code.html #include<includes.au3> $gui = GUICreate("",680,720,-1,-1,$WS_POPUP) GUISetBkColor(0x7E7E7E) GUISetState() $cod = GUICtrlCreateLabel("Code:", 0, 630,680,30,$SS_CENTER) GUICtrlSetFont(-1,20,800) GUICtrlSetState(-1, $GUI_DISABLE ) $bext= GUICtrlCreateButton("SAIR",240,670,200,40) GUICtrlSetBkColor(-1, $COR_PRETO) GUICtrlSetColor(-1, $COR_BRANCO) GUICtrlSetFont(-1,20,800) Local $bt[3][3], $btpos[3][3][2], $x = 1, $y = 0, $ncode = 9,$foto[6],$clk _GDIPlus_Startup() $ref = _GDIPlus_GraphicsCreateFromHWND($gui) For $i = 0 To 2 For $j = 0 to 2 If $i < 2 Then $foto[$i*3+$j] = _GDIPlus_ImageLoadFromFile($i*3+$j & ".png") $btpos[$i][$j][$y] = $i * 220 + 5 $btpos[$i][$j][$x] = $j * 220 + 45 $bt[$i][$j] = GUICtrlCreatePic("6.bmp",$btpos[$i][$j][$x],$btpos[$i][$j][$y],150,150) Next Next Local $msg = GUIGetMsg() While 1 $msg = GUIGetMsg() If $msg = -3 Or $msg = $bext Then Exit If _IsPressed(1) Then If Not $clk Then bot() $clk = 1 EndIf Else $clk = 0 EndIf WEnd Func bot() Local $xy[2],$l,$c=1, $n = 9, $code,$nmsg, $msg = GUIGetMsg() $xy[0] = 9 $xy[1] = 9 If $msg = -3 Or $msg = $bext Then Exit For $j = 0 To 2 For $i = 0 to 2 If $msg = $bt[$i][$j] Then $xy[$l] = $i $xy[$c] = $j _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$i][$j][$x],$btpos[$i][$j][$y],150,150) While _IsPressed(1) $msg = GUIGetMsg(1) Select case $xy[$c] < 2 And $msg[3] > $btpos[$xy[$l]][$xy[$c]][$x] + 260 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]][$xy[$c]+1][$x],$btpos[$xy[$l]][$xy[$c]+1][$y],150,150) ; -> _GDIPlus_GraphicsDrawImageRect($ref,$foto[1],$btpos[$xy[$l]][$xy[$c]][$x]+143,$btpos[$xy[$l]][$xy[$c]][$y]+55,80,40) $xy[$c] += 1 case $xy[$l] < 2 And $xy[$c] < 2 And $msg[3] > $btpos[$xy[$l]][$xy[$c]][$x] + 260 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 410 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] + 260 _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]+1][$xy[$c]+1][$x],$btpos[$xy[$l]+1][$xy[$c]+1][$y],150,150) ; -> v _GDIPlus_GraphicsDrawImageRect($ref,$foto[3],$btpos[$xy[$l]][$xy[$c]][$x]+113,$btpos[$xy[$l]][$xy[$c]][$y]+120,142,132) $xy[$c] += 1 $xy[$l] += 1 case $xy[$l] > 0 And $xy[$c] < 2 And $msg[3] > $btpos[$xy[$l]][$xy[$c]][$x] + 260 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] - 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] - 260 _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]-1][$xy[$c]+1][$x],$btpos[$xy[$l]-1][$xy[$c]+1][$y],150,150) ; -> ^ _GDIPlus_GraphicsDrawImageRect($ref,$foto[4],$btpos[$xy[$l]][$xy[$c]][$x]+113,$btpos[$xy[$l]][$xy[$c]][$y]-100,142,132) $xy[$c] += 1 $xy[$l] -= 1 case $xy[$c] > 0 And $msg[3] And $msg[3] <= $btpos[$xy[$l]][$xy[$c]][$x] - 110 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]][$xy[$c]-1][$x],$btpos[$xy[$l]][$xy[$c]-1][$y],150,150) ; <- _GDIPlus_GraphicsDrawImageRect($ref,$foto[1],$btpos[$xy[$l]][$xy[$c]][$x]-76,$btpos[$xy[$l]][$xy[$c]][$y]+55,80,40) $xy[$c] -= 1 case $xy[$l] < 2 And $xy[$c] > 0 And $msg[3] And $msg[3] <= $btpos[$xy[$l]][$xy[$c]][$x] - 110 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] + 410 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] + 260 _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]+1][$xy[$c]-1][$x],$btpos[$xy[$l]+1][$xy[$c]-1][$y],150,150) ; <- v _GDIPlus_GraphicsDrawImageRect($ref,$foto[4],$btpos[$xy[$l]][$xy[$c]][$x]-108,$btpos[$xy[$l]][$xy[$c]][$y]+120,142,132) $xy[$c] -= 1 $xy[$l] += 1 case $xy[$l] > 0 And $xy[$c] > 0 And $msg[3] And $msg[3] <= $btpos[$xy[$l]][$xy[$c]][$x] - 110 And $msg[4] <= $btpos[$xy[$l]][$xy[$c]][$y] - 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] - 260 _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]-1][$xy[$c]-1][$x],$btpos[$xy[$l]-1][$xy[$c]-1][$y],150,150) ; ^ <- _GDIPlus_GraphicsDrawImageRect($ref,$foto[3],$btpos[$xy[$l]][$xy[$c]][$x]-108,$btpos[$xy[$l]][$xy[$c]][$y]-100,142,132) $xy[$c] -= 1 $xy[$l] -= 1 case $xy[$l] < 2 And $msg[3] >= $btpos[$xy[$l]][$xy[$c]][$x] And $msg[3] < $btpos[$xy[$l]][$xy[$c]][$x] + 110 And $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] + 260 and $msg[4] < $btpos[$xy[$l]][$xy[$c]][$y] + 330 _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]+1][$xy[$c]][$x],$btpos[$xy[$l]+1][$xy[$c]][$y],150,150) ; v _GDIPlus_GraphicsDrawImageRect($ref,$foto[2],$btpos[$xy[$l]][$xy[$c]][$x]+55,$btpos[$xy[$l]][$xy[$c]][$y]+145,40,80) $xy[$l] += 1 case $xy[$l] > 0 And $msg[3] >= $btpos[$xy[$l]][$xy[$c]][$x] And $msg[3] < $btpos[$xy[$l]][$xy[$c]][$x] + 110 And $msg[4] < $btpos[$xy[$l]][$xy[$c]][$y] - 110 and $msg[4] > $btpos[$xy[$l]][$xy[$c]][$y] - 330 _GDIPlus_GraphicsDrawImageRect($ref,$foto[0],$btpos[$xy[$l]-1][$xy[$c]][$x],$btpos[$xy[$l]-1][$xy[$c]][$y],150,150) ; ^ _GDIPlus_GraphicsDrawImageRect($ref,$foto[2],$btpos[$xy[$l]][$xy[$c]][$x]+55,$btpos[$xy[$l]][$xy[$c]][$y]-75,40,80) $xy[$l] -= 1 EndSelect If $n <> $xy[0]*3+$xy[1] Then $n = $xy[0]*3+$xy[1] $code &= $xy[0]*3+$xy[1] GUICtrlSetData($cod, "Code: " & $code) EndIf WEnd $nmsg = 1 EndIf Next Next If $ncode = 9 And $nmsg Then $ncode = $code $code = 9 GUICtrlSetData($cod, "Code: " ) Beep(1200,400) ElseIf $code = $ncode Then GUISetBkColor($COR_VERDE) Beep() GUISetBkColor(0x7E7E7E) ElseIf $nmsg Then Beep(100,400) EndIf $nmsg = 0 If $xy[0] <> 9 Or $xy[1] <> 9 Then GUICtrlSetPos($cod, 0, 0, 700, 600 ) GUICtrlSetPos($cod, 0, 610, 640, 80) EndIf EndFunc
  3. Local $mx, $b[16], $bx[16], $by[16], $bn[16], $win, $enf, $rnd[16], $fr, $loop, $nMsg mix() While $nMsg <> -3 $nMsg = GUIGetMsg() If $nMsg = $mx Then mix() ; Botão mix If Not $loop Then For $i = 0 To 15 ; movimenta os botões selecionados Switch $nMsg Case $b[$i] GUICtrlSetBkColor($b[$i], 0x00cc33) Sleep(190) GUICtrlSetBkColor($b[$i], 0xffffff) if $i = 0 or $i = 4 Or $i = 8 Or $i = 12 Then pos($i, 2, 1, 1) if $i = 1 or $i = 5 Or $i = 9 Or $i = 13 Then pos($i, 1, 1, 1) if $i = 2 or $i = 6 Or $i = 10 Or $i = 14 Then pos($i, 0, 1, 1) if $i = 1 or $i = 5 Or $i = 9 Or $i = 13 Then pos($i, 0, -1, -1) if $i = 2 or $i = 6 Or $i = 10 Or $i = 14 Then pos($i, 1, -1, -1) if $i = 3 or $i = 7 Or $i = 11 Or $i = 15 Then pos($i, 2, -1, -1) if $i < 4 Then pos($i, 2, 4, 4) if $i > 3 And $i < 8 Then pos($i, 1, 4, 4) if $i > 7 And $i < 12 Then pos($i, 0, 1, 4) if $i > 3 And $i < 8 Then pos($i, 0, -4, -4) if $i > 7 And $i < 12 Then pos($i, 1, -4, -4) if $i > 11 Then pos($i, 2, -4, -4) Case -3 Exit EndSwitch GUICtrlSetPos($b[$i], $bx[$i], $by[$i]) ; Atualiza as posições dos botões If $bn[$i] <> $i + 1 Then $win = 1 ; Verifica se os botãoes estão ordenados Next EndIf If Not $win Then ; Animaçã da vitória If $loop < 2 Then For $i = 0 To 30 If $i < 16 Then GUICtrlSetBkColor($b[$i], Random(100, 10000, 1) * 5572 + $i * Random(100, 10000, 1)) If $i > 15 Then GUICtrlSetBkColor($b[$i-16], 0xffffff) Beep(Random(30, 100, 1) * $i, 250) Next EndIf $loop += 1 EndIf $win = 0 WEnd Func pos($n, $p, $sinal, $step) ; combinação para movimento dos botões For $i = $p To 0 Step - 1 if $bn[$n + $sinal * $i + $step] = 16 Then $aux = $b[$n + $sinal * $i] $b[$n + $sinal * $i]= $b[$n + $sinal * $i + $step] $b[$n + $sinal * $i + $step] = $aux $aux = $bn[$n + $sinal * $i] $bn[$n + $sinal * $i] = $bn[$n + $sinal * $i + $step] $bn[$n + $sinal * $i + $step] = $aux EndIf Next $nMsg = 0 EndFunc Func mix() ;Cria e embaralha os botões GUIDelete($fr) $fr = GUICreate("Autoit", 510, 560, 300, 50) GUISetBkColor(0xe8c70e) GUICtrlCreateLabel("JOGO DOS 15", 30, 15, 430, 70, 1) GUICtrlSetFont(-1, 54, 800, 0, "MS Sans Serif") $bt = GUICtrlCreateButton("", 38, 78, 434, 429) GUIctrlSetState(-1,128) $mx = GUICtrlCreateLabel("M i x", 422, 530, 50, 20, 1, 1) GUISetState() For $i = 0 To 3 ;gera as posições dos botões For $j = 0 To 3 $bx[$j + $i * 4] = $i * 3 + $j * 110 + 40 - 3 * $i $by[$j + $i * 4] = $i * 3 + $i * 105 + 80 Next Next $win = 0 $loop = 0 For $i = 0 to 15 Do $b[$i] = 0 $enf = 1 $rnd[$i] = Random(0, 15, 1) For $j = 0 To $i For $k = 0 To $i If $j <> $k And $rnd[$k] = $rnd[$j] Then $enf = 0 Next Next Until $enf $bn[$i] = $rnd[$i] + 1 If $rnd[$i] < 15 Then $b[$i] = GUICtrlCreateButton($rnd[$i] + 1, $bx[$i], $by[$i], 100, 100) GUICtrlSetBkColor($b[$i], 0xffffff) GUICtrlSetFont($b[$i], 50, 800, 0, "MS Sans Serif") EndIf Next EndFunc
  4. Some modifications, continued track, time etc. #include <GuiListView.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Sound.au3> If FileExists("Lista.ini") Then ;Se a lista existe é exibida $lista = IniRead("Lista.ini", "Lista" , "Caminho","") $var = $lista Else ;Se não é criado um falso mp3 no diretório do Script FileOpen("No-Music.mp3",1) Sleep(300) $var = @ScriptDir EndIf Local $asteriscos = " **************************** " Local $FileList = _FileListToArray($var, "*.mp3*", 1), $dir,$ntime,$slength Global $tocando, $music = 1, $vol = 30, $max = $FileList[0], $title = $FileList[1],$sound, $List2 GUICreate("Autoit Sound Play", 500, 313, 192, 124, -1, 16) $List1 = GUICtrlCreateListView("", 200, 4, 295, 215, 0x00800000) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetBkColor(0x393952) GUISetState() _GUICtrlListView_InsertColumn($List1, 0," " & $FileList[0] & " - músicas ", 257,0) GUICtrlSetState ( - 1 , $GUI_DROPACCEPTED ) For $i = 1 To $max Step 1 _GUICtrlListView_AddItem($List1, $FileList[$i], $i) ;gera itens de acordo com o nº de músicas Next $Prev = GUICtrlCreateButton("Prev", 104, 2, 81, 41) GUICtrlSetBkColor(-1, 0xff6633) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Next = GUICtrlCreateButton("Next", 104, 51, 81, 49) GUICtrlSetBkColor(-1, 0xff6633) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Play = GUICtrlCreateButton("Play", 8, 2, 89, 97) GUICtrlSetBkColor(-1, 0xbdc6c6) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Stop = GUICtrlCreateButton("Stop", 8, 110, 177, 33) GUICtrlSetBkColor(-1, 0xbdc6c6) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $List = GUICtrlCreateButton("List", 136, 147, 49, 73) GUICtrlSetBkColor(-1, 0x999999) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $VolUP= GUICtrlCreateButton("VolUP", 72, 147, 57, 73) GUICtrlSetBkColor(-1, 0xbdc6c6) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $time = GUICtrlCreateLabel("Autosom", 420, 240, 80, 30) GUICtrlSetColor(-1, 0xffffff) $VDown= GUICtrlCreateButton("VolDown", 8, 147, 57, 73) GUICtrlSetBkColor(-1, 0xbdc6c6) $Volume=GUICtrlCreateLabel("Volume " & $vol, 15, 230, 340, 45) GUICtrlSetFont(-1, 30, 500, 0, "MS Sans Serif") $List2 =GUICtrlCreateList($title & " *********************************", 0, 280, 500, 50,3) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1,0xbdc6c6) GUISetState(@SW_SHOW) While 1 If $ntime <> _SoundPos($sound, 1) Then GUICtrlSetData($time,"Time " & _SoundLength($sound, 1) & @cr & " |> "& _SoundPos($sound, 1)) $ntime = _SoundPos($sound, 1) EndIf $nMsg = GUIGetMsg() If _SoundPos($sound) >= _SoundLength($sound, 1) And $tocando And $music < $max Then Sleep(1500) SoundControl(1) EndIf Switch $nMsg Case $GUI_EVENT_DROPPED $File = @GUI_DragFile $str = StringSplit($File, "\", 1) ConsoleWrite($max&@CR) _GUICtrlListView_AddItem($List1, $str[$str[0]], $max) Case $Play SoundControl(0) Case $Next If $music < $max And $tocando Then SoundControl(1) Case $Prev If $music > 1 And $tocando Then SoundControl(2) Case $Stop _SoundStop($sound) GUICtrlSetData($Play, "Play") $tocando = False Case $VDown If $tocando And $vol >= 5 Then $vol -= 5 GUICtrlSetData($Volume, "Volume " & $vol) EndIf Case $VolUP If $tocando And $vol < 100 Then $vol += 5 GUICtrlSetData($Volume, "Volume " & $vol) EndIf Case $List $openwin = FileSelectFolder("Escolha um pasta.", $dir ) Local $FileList = _FileListToArray($openwin, "*.mp3", 0) ; transforma os mp3 em arrays If @error = 1 Or Not $openwin Then $FileList = _FileListToArray($var, "*.mp3", 0) ; transforma os mp3 em arrays Else $var = $openwin EndIf $max = $FileList[0] ; [0] número de mp3 é o limite max $open = FileOpen("Lista.ini", 2) $lista = IniWrite("Lista.ini", "Lista", "Caminho", $var) GUICtrlDelete($List1) $List1 = GUICtrlCreateListView("", 200, 4, 285, 215) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() _GUICtrlListView_InsertColumn($List1, 0," " & $FileList[0] & " - músicas ", 256) GUICtrlSetState ( - 1 , $GUI_DROPACCEPTED ) For $i = 1 To $max Step 1 _GUICtrlListView_AddItem($List1, $FileList[$i], $i) ;gera novamente itens após novo diretório Next Case -3 Exit EndSwitch SoundSetWaveVolume($vol) Sleep(10) WEnd Func SoundControl($mode) If $mode = 0 Then If $tocando = 2 Then GUICtrlSetData($Play, "||") _SoundResume($sound) $tocando = 1 ElseIf $tocando Then GUICtrlSetData($Play, "Play") _SoundPause($sound) $tocando = 2 Else GUICtrlSetData($Play, "||") $sound = _SoundOpen($var & "\" & $FileList[$music]) _SoundPlay($sound) $tocando = 1 EndIf ElseIf $mode = 1 Then $tocando = 1 _SoundClose($sound) $music += 1 $sound = _SoundOpen($var & "\" & $FileList[$music]) _SoundPlay($sound) ElseIf $mode = 2 Then $tocando = 1 _SoundClose($sound) $music -= 1 $sound = _SoundOpen($var & "\" & $FileList[$music]) _SoundPlay($sound) ElseIf $mode = 3 Then GUICtrlSetData($Play, "||") $tocando = 1 _SoundClose($sound) $sound = _SoundOpen($var & "\" & $FileList[$music]) _SoundPlay($sound) EndIf $title = $FileList[$music] $star = $asteriscos For $i = 0 To StringLen($star) $starr = StringTrimLeft($star,$i) GUICtrlSetData($List2, "") GUICtrlSetData($List2, $starr & $title & $asteriscos); & $asteriscos) Sleep(30) Next EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ;reconhece o ítem clicado duas vezes e executa Local $iCode, $tNMHDR, $hWndListView, $tInfo, $aItem, $hWndListView = $List1, _ $tNMHDR = DllStructCreate($tagNMHDR, $ilParam), $iCode = DllStructGetData($tNMHDR, "Code") If $iCode = $NM_DBLCLK Then $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $aItem = _GUICtrlListView_GetItem($hWndListView, DllStructGetData($tInfo, "Index")) $music = $aItem[4] SoundControl(3) EndIf EndFunc
  5. Some modifications, continued track, time etc.
  6. Very good!
  7. Front-end for Stella Atari 2600 Select game and enter, double click or click play button <snip>
  8. Nariwan, here worked when I added a script in encounter endif line 404
  9. Hey Belini... KeyCode Door Vjolt Resident Evil game https://www.dropbox.com/s/054s1t7qdyroofz/KeyDoor%20Lab%20RE.rar
  10. Truth is, I will do the best...thanks
  11. https://www.dropbox.com/s/x3qlqwvhzk06kmn/Pac-man.rar #include <misc.au3> #include <Sound.au3> Dim $map[18][27] =[["x","X","X","X","X","X","X","X","X","X","x","X","X","n","X","X","x","X","X","X","X","X","X","X","X","X","x"], _ ["x","n"," "," "," "," "," "," ","n","n","x"," "," "," "," ","n","x","n","n"," "," "," "," "," "," ","n","x"], _ ["x","o","X","X","n","x","n","X","X","n","X","n","X","X","X","n","X","n","X","X","n","x","n","X","X","o","x"], _ ["x","n"," "," "," ","x","n"," "," "," "," ","n"," ","n"," ","n"," "," "," "," ","n","x"," "," "," ","n","x"], _ ["x","X","X","n","X","X","n","X","X","X","x","n","X","X","X","n","x","X","X","X","n","X","X","n","X","X","x"], _ ["x","n"," "," "," "," "," "," "," ","n","x","n","x","n","x","n","x","n"," "," "," "," "," "," "," ","n","x"], _ ["x","n","X","X","n","x","n","X","X","n","X","n","X","X","X","n","X","n","X","X","n","x","n","X","X","n","x"], _ ["x","n"," "," "," ","x","n"," "," "," "," ","n"," ","n"," ","n"," "," "," "," ","n","x"," "," "," ","n","x"], _ ["x","X","X","n","X","X","n","X","X","X","x","n","X","X","X","n","x","X","X","X","n","X","X","n","X","X","x"], _ ["x","n"," "," "," "," "," "," "," ","n","x","n"," "," "," ","n","x","n"," "," "," "," "," "," "," ","n","x"], _ ["x","n","X","X","n","x","n","X","X","n","X","n","X","X","X","n","X","n","X","X","n","x","n","X","X","n","x"], _ ["x","n"," "," "," ","x","n"," "," "," "," ","n"," ","n"," ","n"," "," "," "," ","n","x"," "," "," ","n","x"], _ ["x","X","X","n","X","X","n","X","X","X","x","n","X","X","X","n","x","X","X","X","n","X","X","n","X","X","x"], _ ["x","n"," "," "," "," "," "," "," ","n","x"," "," ","n"," ","n","x","n"," "," "," "," "," "," "," ","n","x"], _ ["x","o","X","X","n","x","n","X","X","n","X","n","X","X","X","n","X","n","X","X","n","x","n","X","X","o","x"], _ ["x","n"," "," "," ","x","n"," "," "," "," ","n"," ","n"," ","n"," "," "," "," ","n","x"," "," "," ","n","x"], _ ["X","X","X","X","X","X","X","X","X","X","X","X","X","n","X","X","X","X","X","X","X","X","X","X","X","X","X"]] Local $vida = 2, $dir = 3, $posx = 390, $posy = 390, $pilu[18][27], $ponto[18][27], $dirAnterior, $pontos, $return[4], $fan[16], _ $fx[4], $fy[4], $rand[4], $fanDir[4], $trinta[4], $mem[4], $Tanima, $sort[4], $morto, $gameOver, $color, $Tpower, $Tcaixa, _ $cx = 390, $cy = 210, $form = GUICreate("Pac Man", 799, 590, 107, 18), $dll = DllOpen("user32.dll"), $B[3] LerMapa() $map[5][14]="n" GUISetBkColor(0x5a4ade) $B0 = GUICtrlCreateButton("", -2, 500, 805, 18) GUICtrlSetBkColor(-1, 0x1A1A1A) GUICtrlSetState(-1, 128) $B2 = GUICtrlCreateLabel("0", -2, 517, 803, 29,1) GUICtrlSetBkColor(-1, 0x008000) GUICtrlSetFont(-1, 24, 800, 20, "Atari Small") $B1= GUICtrlCreateButton("", -2, 544, 803, 50) GUICtrlSetBkColor(-1, 0x1A1A1A) GUICtrlSetState(-1, 128) $caixa=GUICtrlCreatePic("Imagens/caixa.bmp", 385, -200, 40, 33) For $i = 0 To 3 Step 1 if $i < 3 Then $B[$i] = GUICtrlCreateButton("", 40 * $i + 40, 560, 22, 24, 131072) GUICtrlSetBkColor(-1, 0x008000) GUICtrlSetState(-1, 128) $Fan[$i] = GUICtrlCreatePic("Imagens/fan" & $i & "0.bmp", 390, 135, 30, 43) Next $pac = GUICtrlCreatePic("Imagens/pac2.bmp", 390, 376, 30, 43) GUISetState() Sleep(1000) SoundPlay("Sounds/inicia.mp3",1) Restart() HotKeySet("{esc}", "Sair") AnimaPac(2) While 1 $color += 1 $Tcaixa += 1 $Tanima += 1 If $Tpower Then $Tpower -= 1 If $color > 51 Then $color = 0 If $Tcaixa > 100 Then $Tcaixa = 0 $cy = -210 GUICtrlSetPos($caixa, 385, -200) EndIf If $gameOver Then GUICtrlDelete($pac) $posx = 390 If $color > 50 Then GUISetBkColor(0x00441*$fx[0]) EndIf For $i = 0 To 3 Step 1 If Not $trinta[$i] Then $return[$i] = 1 While $return[$i] $return[$i] = 0 Switch $rand[$i] Case 0 If $map[$fy[$i]/30][$fx[$i]/30+1] <> "X" Then $fanDir[$i] = 0 ;> Else $return[$i] = 1 EndIf Case 1 If $map[$fy[$i]/30][$fx[$i]/30-1] <> "X" Then $fanDir[$i] = 1 ;< Else $return[$i] = 1 EndIf Case 2 If $map[$fy[$i]/30+1][$fx[$i]/30] <> "X" Then $fanDir[$i] = 2 ;V Else $return[$i] = 1 EndIf Case 3 If $fy[$i] <= 0 Then $fy[$i] = 510 If $map[$fy[$i]/30-1][$fx[$i]/30] <> "X" Then $fanDir[$i] = 3 ;^ Else $return[$i] = 1 EndIf EndSwitch If $return[$i] Then Sort($i) WEnd Else $mem[$i] = $fanDir[$i] EndIf If $fanDir[$i] = 0 Then $fx[$i] += 15 $trinta[$i] += 15 EndIf If $fanDir[$i] = 1 Then $fx[$i] -=15 $trinta[$i] +=15 EndIf If $fanDir[$i] = 2 Then $fy[$i] +=15 $trinta[$i] +=15 EndIf If $fanDir[$i] = 3 Then $fy[$i] -=15 $trinta[$i] +=15 EndIf If $fy[$i] > 508 And $fanDir[$i] = 2 Then $fy[$i] = 0 If $fy[$i] <= 0 And $fanDir[$i] = 1 Then $fy[$i] = 510 If Not $morto Then GUICtrlSetPos($fan[$i], $fx[$i], $fy[$i]-15) If $trinta[$i] > 20 Then $fanDir[$i] = 4 $trinta[$i] = 0 EndIf Sort($i) if $fx[$i] + 30 >= $posx And $fx[$i] <= $posx + 30 And $fy[$i] + 30 >= $posy And $fy[$i] <= $posy + 30 And Not $gameOver Then If $Tpower Then SoundPlay("Sounds/fantdie.mp3") Else $morto = 1 EndIf EndIf Next If $morto Then Restart() Else If $Tanima > 4 Then $Tanima = 0 If $posy > 508 And $dir = 3 Then $posy = -30 if $posy <= 0 And $dir = 1 Then $posy = 540 $pt = $pontos if $dir = 0 Or $dir = 2 Then $dirAnterior = $dir If GUIGetMsg( ) =-3 Then Exit If Not $gameOver Then If _IsPressed("25", $dll) And $map[$posy/30 ][$posx/30-1] <> "x" Then $dir = 0 ; < If _IsPressed("26", $dll) Then if $posy > 0 Then If $map[$posy/30-1][$posx/30 ] <> "x" Then $dir = 1 ; ^ EndIf EndIf If _IsPressed("27", $dll) And $map[$posy/30 ][$posx/30+1] <> "x" Then $dir = 2 ; > If _IsPressed("28", $dll) And $map[$posy/30+1][$posx/30 ] <> "x" Then $dir = 3 ; v EndIf If $dir == 1 Then if $posy > 0 Then If $map[$posy/30-1][$posx/30 ] == "o" Then $map[$posy/30-1][$posx/30] = "n" GUICtrlDelete($pilu[$posy/30-1][$posx/30]) $pontos +=5 $Tpower = 50 _SoundPlay("Sounds/pilula.mp3") ElseIf $map[$posy/30-1][$posx/30] == " " Then GUICtrlDelete($ponto[$posy/30-1][$posx/30]) $map[$posy/30-1][$posx/30] = "n" $pontos +=1 SoundPlay("Sounds/ponto.mp3") EndIf EndIf EndIf If $dir == 3 Then If $map[$posy/30+1][$posx/30] == "o" Then $map[$posy/30+1][$posx/30] = "n" GUICtrlDelete($pilu[$posy/30+1][$posx/30]) $pontos +=5 $Tpower = 50 _SoundPlay("Sounds/pilula.mp3") ElseIf $map[$posy/30+1][$posx/30] == " " Then GUICtrlDelete($ponto[$posy/30+1][$posx/30]) $map[$posy/30+1][$posx/30] = "n" $pontos +=1 SoundPlay("Sounds/ponto.mp3") EndIf EndIf If $dir == 0 Then If $map[$posy/30][$posx/30-1] == " " Then $map[$posy/30][$posx/30-1] = "n" GUICtrlDelete($ponto[$posy/30][$posx/30-1]) $pontos +=1 SoundPlay("Sounds/ponto.mp3") ElseIf $posx + 30 >= $cx And $posx <= $cx + 30 And $posy = $cy Then $cy = -200 $pontos += 100 _SoundPlay("Sounds/caixa.mp3") GUICtrlSetPos($caixa, $cx, $cy+10) $Tcaixa = 0 EndIf EndIf If $dir == 2 Then If $map[$posy/30][$posx/30+1] == " " Then $map[$posy/30][$posx/30+1] = "n" GUICtrlDelete($ponto[$posy/30][$posx/30+1]) $pontos +=1 SoundPlay("Sounds/ponto.mp3") ElseIf $posx + 30 >= $cx And $posx <= $cx + 30 And $posy = $cy Then $cy = -200 $pontos += 100 _SoundPlay("Sounds/caixa.mp3") GUICtrlSetPos($caixa, $cx, $cy+10) $Tcaixa = 0 EndIf EndIf If $Tcaixa > 50 Then $cy = 210 GUICtrlSetPos($caixa,$cx-5, $cy-10) EndIf If $dir = 0 And $map[$posy/30 ][$posx/30-1] <> "x" Then $posx -= 30 If $dir = 1 Then If $posy > 0 And $map[$posy/30-1][$posx/30 ] <> "x" Then $posy -= 30 ElseIf $posy <=0 Then $posy -= 30 EndIf EndIf If $dir = 2 And $map[$posy/30 ][$posx/30+1] <> "x" Then $posx += 30 If $dir = 3 And $map[$posy/30+1][$posx/30 ] <> "x" Then $posy += 30 If Not $morto Then GUICtrlSetPos($pac,$posx,$posy-14) If $pontos > $pt Then GUICtrlSetData($B2,$pontos) If $dir = 0 Or $dir = 2 And $mem <> $fanDir then AnimaPac($dir) ElseIf $mem <> $fanDir then AnimaPac($dirAnterior) EndIf If $i > 2 Then $map[5][14]="x" EndIf WEnd Func Restart() if $morto Then $vida -=1 SoundPlay("Sounds/morre.mp3") EndIf GUICtrlSetImage($pac,"Imagens/pac5.bmp") For $i = 0 To 3 Step 1 $fy[$i] = 150 $fx[$i] = 390 $return[$i] = 0 $trinta[$i] = 0 $mem[$i] = 0 $rand[$i] = 0 $sort[$i] = 1 if $morto Then Sleep(400) GUICtrlSetImage($pac,"Imagens/pac" & $i+6 & ".bmp") EndIf Next If $vida < 0 Then GUICtrlDelete($pac) $gameOver = 1 GUICtrlDelete($B[0]) GUICtrlSetData($B1, " Autoit") GUICtrlSetFont($B1, 24) EndIf For $i = 0 To 3 Step 1 GUICtrlSetPos($Fan[$i],390, 135) Next Sleep(300) if Not $gameOver Then GUICtrlSetImage($pac,"Imagens/pac0.bmp") $posx = 390 $posy = 390 GUICtrlSetPos($pac,$posx,$posy-14) $dir = 0 $map[5][14]="n" if $morto Then if $vida = 1 Then GUICtrlDelete($B[2]) If $vida = 0 Then GUICtrlDelete($B[1]) Sleep(1000) If Not $gameOver Then SoundPlay("Sounds/inicia.mp3",1) EndIf $morto = 0 EndFunc Func AnimaPac($face) If $Tanima = 0 Then For $i=0 To 3 Step 1 If Not $Tpower Then GUICtrlSetImage($Fan[$i],"Imagens/fan" & $i & "0.bmp") Next EndIf If $Tanima = 1 Then if $face = 0 Then GUICtrlSetImage($pac,"Imagens/pac4.bmp") ElseIf $face = 2 Then GUICtrlSetImage($pac,"Imagens/pac5.bmp") EndIf GUICtrlSetImage($pilu[2][1],"Imagens/zero.bmp") GUICtrlSetImage($pilu[2][25],"Imagens/zero.bmp") GUICtrlSetImage($pilu[14][25],"Imagens/zero.bmp") GUICtrlSetImage($pilu[14][1],"Imagens/zero.bmp") For $i=0 To 3 Step 1 If $Tpower < 25 Then GUICtrlSetImage($Fan[$i],"Imagens/fan" & $i & "1.bmp") Next EndIf If $Tanima = 2 Then For $i=0 To 3 Step 1 If Not $Tpower Then GUICtrlSetImage($Fan[$i],"Imagens/fan" & $i & "2.bmp") If $Tpower Then GUICtrlSetImage($Fan[$i],"Imagens/fan.bmp") Next EndIf If $Tanima = 3 Then For $i=0 To 3 Step 1 If $Tpower < 10 Then GUICtrlSetImage($Fan[$i],"Imagens/fan" & $i & "3.bmp") Next GUICtrlSetImage($pilu[2][1] ,"Imagens/pilula.bmp") GUICtrlSetImage($pilu[2][25] ,"Imagens/pilula.bmp") GUICtrlSetImage($pilu[14][25],"Imagens/pilula.bmp") GUICtrlSetImage($pilu[14][1] ,"Imagens/pilula.bmp") if $face = 0 Then GUICtrlSetImage($pac,"Imagens/pac0.bmp") ElseIf $face = 2 Then GUICtrlSetImage($pac,"Imagens/pac2.bmp") EndIf EndIf Sleep(130) EndFunc Func LerMapa() $gameOver = 0 For $i=0 To 26 Step 1 For $j=0 To 17 Step 1 If $map[$j][$i] == "X" Then GUICtrlCreatePic("Imagens/tijolo.bmp",$i*30,$j*30,30,15) ElseIf $map[$j][$i] = "x" Then If $j < 6 And $j > 4 And $i < 15 And $i > 13 Then GUICtrlCreatePic("Imagens/tijolo.bmp",$i*30+10,$j*30-15,20,60) ElseIf $j < 6 And $j > 4 And $i < 13 And $i > 11 Then GUICtrlCreatePic("Imagens/tijolo.bmp",$i*30,$j*30-15,20,60) Else GUICtrlCreatePic("Imagens/tijolo.bmp",$i*30,$j*30,30,30) EndIf ElseIf $map[$j][$i] = "o" Then $pilu[$j][$i] = GUICtrlCreatePic("Imagens/pilula.bmp",$i*30+4,$j*30-3,20,20) ElseIf $map[$j][$i] = " " Then $ponto[$j][$i]= GUICtrlCreatePic("Imagens/ponto.bmp",$i*32-20,$j*30+5,20,8) EndIf Next Next EndFunc Func Sair() DllClose($dll) Exit EndFunc Func Sort($si) Dim $aux[4] $aux[$si] = 1 While $aux[$si] $aux[$si] = 0 $rand[$si] = Random(0,3,1) If $mem[$si] = 0 Then if $rand[$si] = 1 Then $aux[$si] = 1 ElseIf $mem[$si] = 1 Then if $rand[$si] = 0 Then $aux[$si] = 1 ElseIf $mem[$si] = 2 Then if $rand[$si] = 3 Then $aux[$si] = 1 ElseIf $mem[$si] = 3 Then if $rand[$si] = 2 Then $aux[$si] = 1 EndIf WEnd EndFunc
  12. Cool, I'll try, thanks
  13. HotKeySet("{space}", "Go") $go = 0 While 1 if $go Then Beep(493.8833,500);B Beep(65,13) Beep(369.9944,250);F# Beep(65,13) Beep(391.9954,250);G Beep(65,13) Beep(440,500) ;A Beep(65,13) Beep(391.9954,250);G Beep(65,13) Beep(369.9944,250);F# Beep(65,13) Beep(65,13) Beep(329.6276,550) ;E Beep(65,13) Beep(329.6276,250) ;E Beep(65,13) Beep(391.9954,250);G Beep(493.8833,550);B Beep(440,250) ;A Beep(391.9954,250);G Beep(369.9944,550);F# Beep(369.9944,250);F# Beep(391.9954,250);G Beep(440,500) ;A Beep(493.8833,500);B Beep(391.9954,500);G Beep(329.6276,700) ;E Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(65,13) Sleep(50) Beep(440,500) ;A Beep(440,300) ;A Beep(523.2511,250);D8 Beep(659.2551,500);E8 Beep(587.3295,250);D8 Beep(523.2511,250);C8 Beep(493.8833,500);B Beep(493.8833,250);B Beep(391.9954,250);G Beep(493.8833,500);B Beep(440,300);A Beep(391.9954,250);G Beep(369.9944,500);F# Beep(369.9944,250);F# Beep(391.9954,250);G Beep(440,500);A Beep(493.8833,500);B Beep(391.9954,500);G Beep(329.6276,600);E Sleep(1000) $go -= 1 EndIf WEnd Func Go() If Not $go Then $go=2 Sleep(900) Else Exit EndIf EndFunc
  14. Galaxian, 80's Game https://www.dropbox.com/s/ov8di2wuq736vm2/Galaxian.rar
  15. I did here a little program to capture screen using the mouse as a reference selection #include<Misc.au3> Local $hDLL = DllOpen("user32.dll") #include<ScreenCapture.au3> Global $loop = 1, $fotos = "foto", $loop2 = 1, $pos1 = 0, $pos2 = 0 While $loop sleep(100) if _IsPressed("01", $hDLL) Then $pos1 = MouseGetPos() $loop2 = 1 $loop = 0 EndIf WEnd While $loop2 if not _IsPressed("01", $hDLL) and $loop2 = 1 Then $pos2 = MouseGetPos() IniWrite("foto.ini", "foto", "chave", "area.bmp" &"," & $pos1[0] & "," & $pos1[1] & "," & $pos2[0] & "," & $pos2[1]&"," & 0) $var = IniRead("foto.ini", $fotos, "chave", "0") $area = StringSplit($var,",") if $pos1[0] < $pos2[0] and $pos1[1] < $pos2[1] Then _ScreenCapture_Capture($area[1], Number($area[2]), Number($area[3]), Number($area[4]), Number($area[5])) EndIf if $pos1[0] > $pos2[0] and $pos1[1] < $pos2[1] Then _ScreenCapture_Capture($area[1], Number($area[4]), Number($area[3]), Number($area[2]), Number($area[5])) EndIf if $pos1[0] > $pos2[0] and $pos1[1] > $pos2[1] Then _ScreenCapture_Capture($area[1], Number($area[4]), Number($area[5]), Number($area[2]), Number($area[3])) EndIf if $pos1[0] < $pos2[0] and $pos1[1] > $pos2[1] Then _ScreenCapture_Capture($area[1], Number($area[2]), Number($area[5]), Number($area[4]), Number($area[3])) EndIf DllClose($hDLL) $loop2 = 0 EndIf WEnd
  16. Example Insertion Sort #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> Global $num1 = 8, $num2 = 5, $num3 = 7, $num4 = 3, $num5 = 1, $num6 = 6, $num7 = 4, $num8 = 2, _ $posComp = 3, $CollorWhile = 0x9900cc, $B1x = 16, $B2x = 96, $B3x = 176, $B4x = 264, _ $B5x = 344, $B6x = 432, $B7x = 520, $B8x = 600, $aux = "Start !!", $Btcor #Region ### START Koda GUI section ### Form=d:\documents and settings\xan\meus documentos\booblesort.kxf $Form1 = GUICreate("Autoit", 742, 454, 192, 224) GUISetBkColor(0xD4D0C8) $Label1 = GUICtrlCreateLabel("InsertionSort", 170, 5, 598, 177) GUICtrlSetFont(-1, 75, 400, 10, "MS Sans Serif") $b1 = GUICtrlCreateButton($num1, 16, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b2 = GUICtrlCreateButton($num2, 104, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b3 = GUICtrlCreateButton($num3, 192, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b4 = GUICtrlCreateButton($num4, 280, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b5 = GUICtrlCreateButton($num5, 370, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b6 = GUICtrlCreateButton($num6, 460, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b7 = GUICtrlCreateButton($num7, 552, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b8 = GUICtrlCreateButton($num8, 640, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $Button3 = GUICtrlCreateButton("", 0, 366, 737, 17,0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, $GUI_DISABLE ) $ordenar = GUICtrlCreateButton("Sort", 16, 8, 150, 81, $WS_BORDER) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFF0000) $Button4 = GUICtrlCreateButton("....", 0, 250, 737, 17,0) GUICtrlSetFont(-1, 75, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, $GUI_DISABLE) $while = GUICtrlCreateButton("While 0", 16, 290, 700, 121, $WS_BORDER) GUICtrlSetFont(-1, 75, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_DISABLE) $mem = GUICtrlCreateButton("Memory", $posComp + 13, 195, 165, 93, 0) GUICtrlSetFont(-1, 28, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 if GUIGetMsg() = $ordenar Then $CollorWhile = 0x009900 GUICtrlSetBkColor($ordenar, 0xffff33) GUICtrlSetBkColor($while, $CollorWhile) Sleep(500) ExitLoop EndIf WEnd While 1 GUICtrlSetBkColor($B1, 0xf5f5f5) GUICtrlSetBkColor($B2, 0xf5f5f5) GUICtrlSetBkColor($B3, 0xf5f5f5) GUICtrlSetBkColor($B4, 0xf5f5f5) GUICtrlSetBkColor($B5, 0xf5f5f5) GUICtrlSetBkColor($B6, 0xf5f5f5) GUICtrlSetBkColor($B7, 0xf5f5f5) GUICtrlSetBkColor($B8, 0xf5f5f5) $CollorWhile = 0x00cc33 GUICtrlSetBkColor($while, $CollorWhile) GUICtrlSetData($while, "While 1") Sleep(200) if $aux = False Then GUICtrlDelete($mem) $mem = GUICtrlCreateButton("OK !!", $posComp + 13, 195, 165, 93, 0) GUICtrlSetFont(-1, 24) GUICtrlSetData($while, "Orderly !!!") While $posComp > 3 $posComp -= 2 GUICtrlSetPos($mem, $posComp +12) Sleep(1) WEnd Sleep(6000) Exit EndIf $aux = False if $num1 > $num2 Then $aux = $num1 Comparador() $num1= "..." Troca() $num1= $num2 $num2= "..." Troca() $num2= $aux $aux = "..." Troca() ElseIf $num2 > $num3 Then $aux = $num2 Comparador() $num2= "..." Troca() $num2 = $num3 $num3= "..." Troca() $num3 = $aux $aux = "..." Troca() ElseIf $num3 > $num4 Then $aux = $num3 Comparador() $num3= "..." Troca() $num3 = $num4 $num4= "..." Troca() $num4 = $aux $aux = "..." Troca() ElseIf $num4 > $num5 Then $aux = $num4 Comparador() $num4= "..." Troca() $num4 = $num5 $num5= "..." Troca() $num5 = $aux $aux = "..." Troca() ElseIf $num5 > $num6 Then $aux = $num5 Comparador() $num5= "..." Troca() $num5 = $num6 $num6= "..." Troca() $num6 = $aux $aux = "..." Troca() ElseIf $num6 > $num7 Then $aux = $num6 Comparador() $num6= "..." Troca() $num6 = $num7 $num7= "..." Troca() $num7 = $aux $aux = "..." Troca() ElseIf $num7 > $num8 Then $aux = $num7 Comparador() $num7= "..." Troca() $num7 = $num8 $num8= "..." Troca() $num8 = $aux $aux = "..." Troca() EndIf WEnd Func Comparador() $CollorWhile = 0x009900 Switch $aux case $num1 $posComp = 3 $Btcor = $B1 Case $num2 $posComp = 93 $Btcor = $B2 Case $num3 $posComp = 183 $Btcor = $B3 Case $num4 $posComp = 273 $Btcor = $B4 Case $num5 $posComp = 363 $Btcor = $B5 Case $num6 $posComp = 453 $Btcor = $B6 Case $num7 $posComp = 543 $Btcor = $B7 Case $num8 $posComp = 633 $Btcor = $B8 EndSwitch GUICtrlSetBkColor($Btcor, 0x999999) GUICtrlSetData($mem, ">>") GUICtrlSetPos($mem, $posComp + 12) Sleep(300) GUICtrlSetBkColor($while, $CollorWhile) GUICtrlSetBkColor($mem, 0x999999) Sleep(300) EndFunc Func Troca() GUICtrlSetBkColor($Btcor, 0xf5f5f5) GUICtrlSetData($B1,$num1) GUICtrlSetData($B2,$num2) GUICtrlSetData($B3,$num3) GUICtrlSetData($B4,$num4) GUICtrlSetData($B5,$num5) GUICtrlSetData($B6,$num6) GUICtrlSetData($B7,$num7) GUICtrlSetData($B8,$num8) GUICtrlSetData($mem,$aux) GUICtrlSetData($mem,$aux) GUICtrlSetPos($mem, $posComp + 12) Sleep(500) EndFunc
  17. Example Bubble sort #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $posw = 3 Global $memoria = "mem...",$fim = False, $i,$array[9] = [8,5,7,3,1,6,4,2] #Region ### START Koda GUI section ### Form=d:\documents and settings\xan\meus documentos\bublesort.kxf $Form1 = GUICreate("Autoit", 738, 450, 192, 224) GUISetBkColor(0xD4D0C8) $Label1 = GUICtrlCreateLabel("Bubble Sort", 212, 5, 598, 177) GUICtrlSetFont(-1, 75, 400, 10, "MS Sans Serif") $b1 = GUICtrlCreateButton($array[0], 16, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b2 = GUICtrlCreateButton($array[1], 104, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b3 = GUICtrlCreateButton($array[2], 192, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b4 = GUICtrlCreateButton($array[3], 280, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b5 = GUICtrlCreateButton($array[4], 368, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b6 = GUICtrlCreateButton($array[5], 456, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b7 = GUICtrlCreateButton($array[6], 552, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $b8 = GUICtrlCreateButton($array[7], 640, 114, 78, 80) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0) $Button3 = GUICtrlCreateButton("", 0, 366, 737, 17,0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, $GUI_DEFBUTTON ) $for = GUICtrlCreateButton("Ordenar", 16, 8, 200, 81, $WS_BORDER) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFF0000) $Button4 = GUICtrlCreateButton("....", 0, 250, 737, 17,0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetState(-1, 0 ) $while = GUICtrlCreateButton("While 0", 3, 305, 193, 129) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlSetState(-1, $GUI_DISABLE) $mem = GUICtrlCreateButton("Memória", $posw + 12, 194, 161, 73, 0) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xA6CAF0) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $For ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Display() GUICtrlSetData($for, "For Stop") GUICtrlSetBkColor($for, 0xFF0000);ver Sleep(1000) GUICtrlSetBkColor($for, 0x009900) Sleep(500) GUICtrlSetBkColor($for, 0xffff00) Sleep(500) GUICtrlSetBkColor($for, 0x009900) Sleep(500) GUICtrlSetBkColor($for, 0xffff00) GUICtrlSetData($for, "For Start") Sleep(500) GUICtrlSetBkColor($for, 0x009900) Sleep(1000) For $i = 1 To 8 Step 1 GUICtrlSetData($for, "For $i = "&$i) BotCollor() Sleep(400) While $array[$i] < $array[$i-1] GUICtrlDelete($while) $while = GUICtrlCreateButton("While 1", $posw, 290, 193, 129) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0x009900) GUICtrlSetState(-1, $GUI_DISABLE) $memoria = $array[$i] Display() $array[$i] = $array[$i-1] Display() $array[$i-1] = $memoria Display() $fim = False Sleep(700) GUICtrlDelete($while) $while = GUICtrlCreateButton("While 0", $posw, 290, 193, 129) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") GUICtrlSetBkColor($while, 0xFF0000) $memoria = "mem..." Display() WEnd if $i >= 7 and $fim Then GUICtrlSetData($mem, " OK !!! ") GUICtrlSetData($for, "Ordenado !!!") Sleep(300) GUICtrlSetBkColor($for, 0xffffff) Sleep(300) GUICtrlSetBkColor($for, 0xffff00) Sleep(300) GUICtrlSetBkColor($for, 0xffffff) Sleep(300) GUICtrlSetBkColor($for, 0xffff00) Sleep(300) GUICtrlSetBkColor($for, 0xffffff) Sleep(300) GUICtrlSetBkColor($for, 0xffff00) Sleep(300) GUICtrlSetBkColor($for, 0xffffff) Sleep(300) GUICtrlSetBkColor($for, 0xffff00) Sleep(9000) Exit EndIf If $i >= 7 Then $i = 0 $fim = True EndIf Movewhile() next Func BotCollor() Switch $i Case 1 GUICtrlSetBkColor($B1, 0x666666) GUICtrlSetBkColor($B2, 0x9900cc) Case 2 GUICtrlSetBkColor($B2, 0x666666) GUICtrlSetBkColor($B3, 0x9900cc) Case 3 GUICtrlSetBkColor($B3, 0x666666) GUICtrlSetBkColor($B4, 0x9900cc) Case 4 GUICtrlSetBkColor($B4, 0x666666) GUICtrlSetBkColor($B5, 0x9900cc) Case 5 GUICtrlSetBkColor($B5, 0x666666) GUICtrlSetBkColor($B6, 0x9900cc) Case 6 GUICtrlSetBkColor($B6, 0x666666) GUICtrlSetBkColor($B7, 0x9900cc) Case 7 GUICtrlSetBkColor($B7, 0x666666) GUICtrlSetBkColor($B8, 0x9900cc) EndSwitch Sleep(300) EndFunc Func Movewhile() If $i >= 1 Then $posw += 90 GUICtrlSetData($mem, $memoria) GUICtrlSetBkColor($mem, 0xA6CAF0) GUICtrlSetState($mem, $GUI_DEFBUTTON ) GUICtrlSetPos($mem, $posw + 12) GUICtrlSetData($while, "While 0") GUICtrlSetPos($while, $posw) GUICtrlSetBkColor($while, 0xFF0000) GUICtrlSetBkColor($B1, 0xf5f5f5) GUICtrlSetBkColor($B2, 0xf5f5f5) GUICtrlSetBkColor($B3, 0xf5f5f5) GUICtrlSetBkColor($B4, 0xf5f5f5) GUICtrlSetBkColor($B5, 0xf5f5f5) GUICtrlSetBkColor($B6, 0xf5f5f5) GUICtrlSetBkColor($mem, 0xA6CAF0) Else GUICtrlSetBkColor($B7, 0xf5f5f5) GUICtrlSetBkColor($B8, 0xf5f5f5) GUICtrlSetBkColor($mem, 0xA6CAF0) While $posw > 3 $posw -= 1 GUICtrlSetPos($while, $posw) GUICtrlSetPos($mem, $posw+12) WEnd EndIf EndFunc Func Display() Sleep(60) GUICtrlSetData($b1, $array[0]) GUICtrlSetData($b2, $array[1]) GUICtrlSetData($b3, $array[2]) GUICtrlSetData($b4, $array[3]) GUICtrlSetData($b5, $array[4]) GUICtrlSetData($b6, $array[5]) GUICtrlSetData($b7, $array[6]) GUICtrlSetData($b8, $array[7]) GUICtrlSetPos($mem, $posw + 12) GUICtrlSetBkColor($mem, 0x9900cc) GUICtrlSetData($mem, $memoria) EndFunc
  18. new version of this player with some enhancements like click and run #include <File.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If FileExists("Lista.ini") Then ;if the list exists is displayed $lista = IniRead("Lista.ini", "Lista" , "Caminho","") $var = $lista Else ;if not, it created a false mp3 directory script FileOpen("No-Music.mp3",1) Sleep(300) $var = @ScriptDir EndIf Local $FileList = _FileListToArray($var, "*.mp3*", 1) Global $tocando = False, $music = 1, $voll = "Volume", $vol = 30, $max = $FileList[0], $title = $FileList[1] #region ### START Koda GUI section ### $Form1_1 = GUICreate("Autoit Sound Play", 500, 313, 192, 124) GUISetBkColor(0x393952) $List1 = GUICtrlCreateListView("", 200, 8, 261, 220) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() _GUICtrlListView_InsertColumn($List1, 0," " & $FileList[0] & " - músicas ", 257) For $i = 1 To $max Step 1 _GUICtrlListView_AddItem($List1, $FileList[$i], $i) ;generating items according to the number of songs Next $Prev = GUICtrlCreateButton("Prev", 104, 2, 81, 41) GUICtrlSetBkColor(-1, 0xff6633) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Next = GUICtrlCreateButton("Next", 104, 51, 81, 49) GUICtrlSetBkColor(-1, 0xff6633) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $Play = GUICtrlCreateButton("Play", 8, 2, 89, 97) GUICtrlSetBkColor(-1, 0xbdc6c6) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Stop = GUICtrlCreateButton("Stop", 8, 110, 177, 33) GUICtrlSetBkColor(-1, 0xbdc6c6) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $List = GUICtrlCreateButton("List", 136, 147, 49, 73) GUICtrlSetBkColor(-1, 0x999999) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") $VolUP = GUICtrlCreateButton("VolUP", 72, 147, 57, 73) GUICtrlSetBkColor(-1, 0xbdc6c6) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $AutoSound = GUICtrlCreateLabel("A" & @CR & "U" & @CR & "T" & @CR & "O" & _ @CR & @CR & @CR & "S" & @CR & "O" & @CR & "U" & @CR & "N" & @CR & "D", 478, 10, 257, 217) $VolDown = GUICtrlCreateButton("VolDown", 8, 147, 57, 73) GUICtrlSetBkColor(-1, 0xbdc6c6) $Volume = GUICtrlCreateLabel("Volume " & $vol, 15, 230, 400, 45) GUICtrlSetFont(-1, 30, 500, 0, "MS Sans Serif") $List2 = GUICtrlCreateList($title & " *********************************", 0, 280, 500, 50,3) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") GUICtrlSetBkColor(-1,0xbdc6c6) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### SoundPlay($var & "\" & $music, 0) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Play $title = $FileList[$music] SoundPlay($var & "\" & $FileList[$music], 0) GUICtrlSetData($List2, $title & " *********************************") ; $tocando = True Case $Prev If $tocando And $music > 1 Then $music -= 1 $title = $FileList[$music] SoundPlay($var & "\" & $FileList[$music], 0) GUICtrlSetData($List2, $title & " *********************************") EndIf If $tocando And $music < 2 Then SoundPlay($var & "\" & $FileList[$music], 0) EndIf Case $Next If $tocando And $music < $max Then $music += 1 $title = $FileList[$music] GUICtrlSetData($List2,"") GUICtrlSetData($List2, $title & " *********************************") SoundPlay($var & "\" & $FileList[$music], 0) EndIf Case $Stop SoundPlay("nosound", 0) $tocando = False Case $VolDown If $tocando And $vol >= 5 Then $vol -= 5 GUICtrlSetData($Volume, $voll & " " & $vol) EndIf Case $VolUP If $tocando And $vol < 100 Then $vol += 5 GUICtrlSetData($Volume, $voll & " " & $vol) EndIf Case $List $openwin = FileSelectFolder("Escolha um pasta.", "") $var = $openwin ; var equal to the Open Directory Local $FileList = _FileListToArray($var, "*.mp3", 0) ; mp3 transforms into arrays $max = $FileList[0] ;[0] number of mp3 is the limit max $open = FileOpen("Lista.ini", 2) $lista = IniWrite("Lista.ini", "Lista", "Caminho", $var) GUICtrlDelete($List1) $List1 = GUICtrlCreateListView("", 200, 8, 261, 220) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() _GUICtrlListView_InsertColumn($List1, 0," " & $FileList[0] & " - músicas ", 256) For $i = 1 To $max Step 1 _GUICtrlListView_AddItem($List1, $FileList[$i], $i) ;regenerates items after new directory Next Case $GUI_EVENT_CLOSE Exit EndSwitch SoundSetWaveVolume($vol) Sleep(10) WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ;recognizes the item double-clicked and executed Local $iCode, $tNMHDR, $hWndListView, $tInfo, $aItem, $hWndListView = $List1, _ $tNMHDR = DllStructCreate($tagNMHDR, $ilParam), $iCode = DllStructGetData($tNMHDR, "Code") Switch $iCode Case $NM_DBLCLK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $aItem = _GUICtrlListView_GetItem($hWndListView, DllStructGetData($tInfo, "Index")) GUICtrlSetData($List2, "") GUICtrlSetData($List2, $aItem[3] & " *********************************") SoundPlay($var & "\" & $aItem[3], 0) $tocando = True ;music playing EndSwitch EndFunc
  19. hello guys, I made a music player to view it Player https://www.dropbox.com/s/dlj9w5tnteilbhl/Autoit%20Player.rar video
×
×
  • Create New...