| Lahace |
| | E con il mio grande ritorno pubblico anche il mio terminale nella sua nuova versione era già nella sezione progetti ma era la versione vecchia... per questo terminale si possono perfino creare script da eseguire, infatti metto anche il source di Imhos, un lettore musicale per il terminale, come esempio per lasciare a voi la programmazione Per avviare Imhos basta semplicemente scrivere "Imhos" senza apici appena si apre il terminale come funzionano gli script : nella cartella /bin/src/ vengono collocati tutti gli script .au3 se date ad uno script il nome ciao.au3, per eseguirlo dal terminale vi basterà scrivere "ciao" sempre senza apici. Funziona anche in un computer sprovvisto di autoit grazsie al file autoit.exe e alla cartella include in Bin/Autoit/ Usando il file Commandinstaller.exe verranno aggiunti (non tutti siccome è ancora in fase di elaborazione) i comandi per programmare script che usano l'interfaccia del terminale come Imhos C'è ancora il sito dal quale è possibile uppare script per poi permettere agli utilizzatori del terminale di scaricarli ed utilizzarli www.terminalautoit.altervista.orgComandi del terminale CODICE quelli dopo : sono i parametri comandi: insapp :nomedelcomando percorsoapplicazione(*.exe) -> inserire un applicazione da avviare con il nome del comando scelto
open :nomecomando -> apre un applicazione registrata in precedenza con insapp
kill :nomeapplicazione(*.exe) chiude un processo in esecuzione
cmd :comando -> esegue un comando BAT in windows
exit -> esce dall'applicazione
comandi ADM
adm src-list -> ritorna la lista dei source disppnibili nel sito ufficiale
adm download :URL -> scarica il file da un sito (il link deve essere diretto al file da scaricare)
adm src-get :srcname -> scarica il source di un file dal sito ufficiale
amd require :name scarica pacchetti essenziali per il terminale terminale.au3 CODICE #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Comment=None #AutoIt3Wrapper_Res_Description=by lahace jugasoft© #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_Language=1040 #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.0.0 Author: Lahace
Script Function: allora le funzioni sono semplici per inserire un comando basta mettere insapp nomecomando percorsoapplicazione e poi per attivarlo open nomecomando
#ce ---------------------------------------------------------------------------- #include <Process.au3> #include <WinAPI.au3> #include <Inet.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include <FTPEx.au3> #include <File.au3> #include <Array.au3> #include <Misc.au3> #include <Sound.au3>
$GUI = GUICreate("CONSOLE", 700, 300) Global Const $NAME = @ScriptDir & " >" $old = "" IniWrite("Bin\tm.att", "Names", "name", $NAME) Global $Edit = GUICtrlCreateEdit($NAME, 0, 0, 700, 300, 0x0040 + 0x00200000) ;BitOR(, 0x00200000)) IniWrite("Bin\tm.att", "Handle", "Edit", $Edit) GUICtrlSetFont($Edit, 8.5, -1, 0, "Lucida Console") GUICtrlSetBkColor(-1, 00000000) GUICtrlSetColor(-1, 99999999) GUISetState() If DirGetSize(@ScriptDir & "\Download") = -1 Then DirCreate(@ScriptDir & "\Download") EndIf $pos = WinGetPos($GUI) ; get whole window size (no client size defined in GUICreate) Global $width = $pos[2] Global $height = $pos[3] If Not FileExists(@ScriptDir & "\Bin\autoit\AutoIt3.exe") Then print("Attenzione! L'interprete di AutoIt non è installato correttamente nella cartella" & @CRLF & @ScriptDir & "\Bin\Autoit" & @CRLF & "gli script scaricati NON riusciranno a essere eseguiti. Digita quindi" & @CRLF & "adm require autoit" & @CRLF & "per procedere all'installazione" & @CRLF & $NAME) EndIf $rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height) _WinAPI_SetWindowRgn($GUI, $rgn) _HotKey(True) $state = True While True Switch GUIGetMsg() Case -3 Exit EndSwitch If BitAND(WinGetState($GUI), 8) And Not $state Then _HotKey(True) $state = True ElseIf Not BitAND(WinGetState($GUI), 8) And $state Then _HotKey(False) $state = False EndIf WEnd Func _HotKey($mode) For $i = 32 To 127 If $mode Then HotKeySet(Chr($i), "_HotFunc") Else HotKeySet(Chr($i)) EndIf Next If $mode Then HotKeySet("{BACKSPACE}", "_HotDel") HotKeySet("{ENTER}", "_HotEnt") Else HotKeySet("{BACKSPACE}") HotKeySet("{ENTER}") EndIf EndFunc ;==>_HotKey
Func _HotEnt() $Split = StringSplit(StringReplace(GUICtrlRead($Edit), @CR, ""), @LF) $Comm = StringReplace($Split[$Split[0]], $NAME, "") $Comm = StringReplace($Split[$Split[0]], $NAME, "") $esegui = _Esegui($Comm) GUICtrlSetData($Edit, GUICtrlRead($Edit) & @CRLF & $esegui & @CRLF & $NAME) EndFunc ;==>_HotEnt
Func cls($mode = 0) If $mode = 0 Then GUICtrlSetData($Edit , $NAME) ElseIf $mode = 1 Then GUICtrlSetData($Edit , "") EndIf EndFunc
Func _Esegui($com) $Split = StringSplit($com, " ") Switch StringLower($Split[1]) Case "insapp" IniWrite(@ScriptDir & "\Bin\tm.att", "percorso", $Split[2], $Split[3]) Return "commando aggiunto!" Case "open" $run = IniRead(@ScriptDir & "\Bin\tm.att", "percorso", $Split[2], "") If $run = "" Then Return "Errore" Else Run($run) Return $run EndIf Case "kill" If $Split[0] >= 2 Then ProcessClose($Split[2] & ".exe") EndIf Case "cmd" If $Split[0] >= 2 Then _RunDOS($Split[2]) Return $Split[2] EndIf Case "exit" Exit Case "adm" If $Split[0] >= 2 Then Switch StringLower($Split[2]) Case "require" If $Split[0] >= 3 Then Return Require($Split[3]) Else Return "Require what?" EndIf Case "src-list" Return Srclist() Case "download" If $Split[0] >= 3 Then $size = InetGetSize($Split[3]) If @error Then Return "Attenzione! File probabilmente inesistente" EndIf $choice = choiceyn("Il file da scaricare pesa " & $size & " bytes... scaricare?") If $choice = "y" Then $url = GetURLDetails($Split[3]) $fname = $url[$url[0]] print("Download in corso") GUICtrlSetState($Edit, 128) _HotKey(False) $dwn = InetGet($Split[3], @ScriptDir & "\Download\" & $fname, 0, 1) Do $perc = getperc($dwn, $size) If $perc = $old Then ; Else $old = $perc WinSetTitle($GUI, "", "CONSOLE - " & $perc & "%") EndIf Until $perc = 100 If $dwn = @error Then GUICtrlSetState($Edit, 64) _HotKey(True) InetClose($dwn) WinSetTitle($GUI, "", "CONSOLE") Return "Errore durante il processo di download" Else GUICtrlSetState($Edit, 64) _HotKey(True) InetClose($dwn) WinSetTitle($GUI, "", "CONSOLE") Return "Download completato" EndIf Else Return "Download Aborted" EndIf EndIf Case "src-dlist" $totfile = "" $ff = FileFindFirstFile(@ScriptDir & "\Bin\src\*.au3") Do $nf = FileFindNextFile($ff) $totfile &= $nf & " " Until @error $tfr = StringReplace($totfile, ".au3", "") Return $tfr Case "src-get" If $Split[0] >= 3 Then Return Srcdwn($Split[3]) EndIf Case Else Return "In Adm '" & $Split[2] & "' comando non riconosciuto" EndSwitch Else Return "" EndIf Case Else If FileExists(@ScriptDir & "\Bin\src\" & $Split[1] & ".au3") Then Run(@ScriptDir & "\Bin\AutoIt\AutoIt3.exe /AutoIt3ExecuteScript " & @ScriptDir & "\Bin\src\" & $Split[1] & ".au3") print("Running " & $Split[1] & @CRLF) TCPStartup() $consttile = "CONSOLE" $title = "CONSOLE" $otitle = "CONSOLE" Do $listen = TCPListen("127.0.0.1","9999",1000) If $listen <> -1 Then Do $socket = TCPAccept($listen) $recv = TCPRecv($socket,100) If $recv <> "" Then $recv= StringReplace($recv , "%title%" , $title) $split = StringSplit($recv , ";") If UBound($split) = 2 Then Call($split[1]) ElseIf UBound($split) = 3 Then Call($split[1],$split[2]) ElseIf UBound($split) = 4 Then Call($split[1],$split[2],$split[3]) ElseIf UBound($split) = 5 Then Call($split[1],$split[2],$split[3],$split[4]) ElseIf UBound($split) = 6 Then Call($split[1],$split[2],$split[3],$split[4],$split[5]) EndIf If @error Then $split = StringSplit($recv , "::") Switch StringLower($split[1]) Case "title" $otitle = $title $title = $split[2] WinSetTitle($otitle , "" , $title) EndSwitch EndIf EndIf Until Not ProcessExists("autoit3.exe") EndIf Until Not ProcessExists("autoit3.exe") WinSetTitle($title , "" , $consttile) TCPShutdown() cls() Return "Successfull" Else Return "'" & $Split[1] & "' comando non riconosciuto" EndIf EndSwitch EndFunc ;==>_Esegui Func EditBlock() _HotKey(False) GUICtrlSetStyle($Edit , 0x0800) EndFunc
Func EditUnBlock() _HotKey(True) GUICtrlSetStyle($Edit , 0x0040 + 0x00200000) EndFunc
Func _HotDel() If StringRight(GUICtrlRead($Edit), StringLen($NAME)) <> $NAME Then GUICtrlSetData($Edit, StringTrimRight(GUICtrlRead($Edit), 1)) EndFunc ;==>_HotDel
Func _HotFunc() GUICtrlSetData($Edit, GUICtrlRead($Edit) & @HotKeyPressed) EndFunc ;==>_HotFunc
Func Srcdwn($file) MsgBox(0,"",$file) $peso = InetGetSize("http://www.terminalautoit.altervista.org/sources/" & $file & ".txt") If @error Then Return "Attenzione! File probabilmente inesistente" EndIf $choice = choiceyn("Il file da scaricare pesa " & $file & " bytes... scaricare?") If $choice = "y" Then print("Download in corso") _HotKey(False) $source = InetGet("http://www.terminalautoit.altervista.org/sources/" & $file & ".txt", @ScriptDir & "\Bin\src\" & $file & ".au3") If $source = @error Then _HotKey(True) InetClose($source) Return "Errore durante il processo di download" Else _HotKey(True) InetClose($source) FileWrite(@ScriptDir & "\Bin\Dlist.txt", $file & " ") Return "Download completato" EndIf Else Return "Download Aborted" EndIf EndFunc Func Srclist() $src = _INetGetSource("http://www.terminalautoit.altervista.org/sources/list.txt") $srcr = StringReplace($src, " ", " ") If @error Then Return "impossibile leggere la lista dei file" Else Return $srcr EndIf EndFunc
Func Require($obj) If FileExists(@ScriptDir & "\Bin\" & $obj) Then Return "Pacchetto già presente" EndIf $size = InetGetSize("http://www.terminalautoit.altervista.org/require/" & $obj & ".zip") If $size Then $ch = choiceyn("il file pesa " & $size/1024 & " kilobytes...scaricare?") If $ch = "y" Then print("Download in corso... Può richiedere parecchio tempo") GUICtrlSetState($Edit, 128) _HotKey(False) $dwn = InetGet("ftp://terminalautoit:terminalrulez@ftp.terminalautoit.altervista.org/require/" & $obj & ".zip", @ScriptDir & "\Bin\" & $obj & ".zip", 0, 1) $perc = "" Do $perc = getperc($dwn, $size) If $perc = $old Then ; Else $old = $perc WinSetTitle($GUI, "", "CONSOLE - " & $perc & "%") EndIf Until $perc = 100 If $dwn Then WinSetTitle($GUI, "", "CONSOLE") print("Estrazione...") $zip = _Zip_UnzipAll(@ScriptDir & "\Bin\" & $obj & ".zip", @ScriptDir & "\Bin\" & $obj, 0) InetClose($dwn) If $zip Then FileDelete(@ScriptDir & "\Bin\" & $obj & ".zip") GUICtrlSetState($Edit, 64) _HotKey(True) Return "File Installato con successo! Riavvia il terminale per sicurezza!" Else GUICtrlSetState($Edit, 64) _HotKey(True) Return "Errore durante l'estrazione. Provare ad estrarre manualmente" EndIf Else InetClose($dwn) WinSetTitle($GUI, "", "CONSOLE") GUICtrlSetState($Edit, 64) _HotKey(True) Return "Errore durante il Download" EndIf Else Return "Download Aborted" EndIf Else Return "File Inesistente" EndIf EndFunc Func GetURLDetails($url) $urlr = StringReplace($url, "http://", "") $splitphp = StringSplit($urlr, "?") $Split = StringSplit($splitphp[1], "/") Return $Split EndFunc ;==>GetURLDetails
Func print($string,$handle = $Edit) If $handle = $Edit Then GUICtrlSetData($Edit, GUICtrlRead($Edit)& @CRLF & $string) Else GUICtrlSetData($handle, GUICtrlRead($Edit)& @CRLF & $string) EndIf EndFunc ;==>print
Func choiceyn($prompt) print($prompt & @CRLF & "[y/n]?") While 1 If _IsPressed("59") Then Return "y" ElseIf _IsPressed("4E") Then Return "n" EndIf WEnd EndFunc ;==>choiceyn
Func _TCPFileSend($sFile, $_socket, $progress_bar = False, $title = "", $main = "") Local $error = False, $num = 1, $wait = 5000, $ack = False $sFileOpen = FileOpen($sFile, 16 + 0) $sFileRead = FileRead($sFileOpen) FileClose($sFileOpen) $sFileSize = BinaryLen($sFileRead) $init = TimerInit() TCPSend($_socket, "xBufferOnx" & $sFileSize) While TimerDiff($init) < $wait $recv = TCPRecv($_socket, 2048) If StringInStr($recv, "xContinuex", 1) Then $init = TimerInit() $ack = True ExitLoop EndIf WEnd If $ack = True Then If $sFileSize < 100000 Then $TCPSend = TCPSend($_socket, $sFileRead) $progress_bar = False Else If $progress_bar = True Then ProgressOn($title, $main, "0%", -1, -1, 16) $buff = $sFileRead Do If $progress_bar = True Then $perc = Round((BinaryLen($buff) / $sFileSize) * 100, 0) $percfin = 100 - $perc ProgressSet($percfin, $percfin & "%") EndIf $TCPSend = TCPSend($_socket, BinaryMid($buff, 1, 100000)) While 1 $recv = TCPRecv($_socket, 2048) If StringInStr($recv, "XStreamX", 1) Then ExitLoop WEnd $buff = BinaryMid($buff, $TCPSend + 1) Until BinaryLen($buff) = 0 EndIf Sleep(100) For $i = 1 To 5 TCPSend($_socket, "xEndTransx") Next If $progress_bar = True Then If $progress_bar = True Then ProgressOff() EndIf Else $error = True EndIf If $error = True Then Return 0 Else Return 1 EndIf EndFunc ;==>_TCPFileSend
Func _TCPFileRecv($rFile, $_socket, $progress_bar = False, $title = "", $main = "") Local $error = False Local $buff, $no_recv_count = 0, $wait = 5000, $syn = False $init = TimerInit() While TimerDiff($init) < $wait $recv = TCPRecv($_socket, 2024) If StringInStr($recv, "xBufferOnx", 1) Then $init = TimerInit() $syn = True TCPSend($_socket, "xContinuex") ExitLoop EndIf WEnd If $syn = True Then If $progress_bar = True Then ProgressOn($title, $main, "0%", -1, -1, 16) $size = StringReplace($recv, "xBufferOnx", "") $binary_recv = 0 While 1 $TCPRecv = TCPRecv($_socket, 100000) If StringLen($TCPRecv) Then If StringInStr($TCPRecv, "xEndTransx", 1) Then If $progress_bar = True Then ProgressOff() ExitLoop EndIf If $TCPRecv <> "" Then If $TCPRecv == "xEndTransx" Then ExitLoop If $progress_bar = True Then $binary_recv += BinaryLen($TCPRecv) $perc = Round(($binary_recv / $size) * 100, 0) ProgressSet($perc, $perc & "%") EndIf $str = BinaryToString($TCPRecv) $buff &= $str $no_recv_count = 0 TCPSend($_socket, "XStreamX") EndIf EndIf WEnd If $buff = "" Then $error = True Else $buff = StringToBinary($buff) $rFileOpen = FileOpen($rFile, 16 + 2) If $rFileOpen = -1 Then $error = True Else $rFileWrite = FileWrite($rFileOpen, $buff) If $rFileWrite = 0 Then $error = True EndIf FileClose($rFileOpen) EndIf EndIf Else $error = True EndIf If $error = True Then Return 0 Else Return 1 EndIf EndFunc ;==>_TCPFileRecv
Func getperc($handle,$peso) $bytes = InetGetInfo($handle,0) $perc = ($bytes/$peso)*100 If $perc > 100 Then $perc2 = 100 Else $perc2 = Int($perc) EndIf Return $perc2 EndFunc
Func _GetIcon($file, $ReturnType = 0) $FileType = StringSplit($file, ".") $FileType = $FileType[UBound($FileType) - 1] $FileParam = RegRead("HKEY_CLASSES_ROOT\." & $FileType, "") $DefaultIcon = RegRead("HKEY_CLASSES_ROOT\" & $FileParam & "\DefaultIcon", "")
If Not @error Then $IconSplit = StringSplit($DefaultIcon, ",") ReDim $IconSplit[3] $Iconfile = $IconSplit[1] $IconID = $IconSplit[2] Else $Iconfile = @SystemDir & "\shell32.dll" $IconID = -219 EndIf
If $ReturnType = 0 Then Return $Iconfile Else Return $IconID EndIf EndFunc ;==>_GetIcon
;====================START ZIP FUNC===================== Func _Zip_Create($hFilename) $hFp = FileOpen($hFilename, 26) $sString = Chr(80) & Chr(75) & Chr(5) & Chr(6) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) FileWrite($hFp, $sString) If @error Then Return SetError(1, 0, 0) FileClose($hFp)
While Not FileExists($hFilename) Sleep(10) WEnd Return $hFilename EndFunc ;==>_Zip_Create
Func _Zip_AddFile($hZipFile, $hFile2Add, $flag = 1) Local $DLLChk = _Zip_DllChk() Local $files = _Zip_Count($hZipFile) If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file $oApp = ObjCreate("Shell.Application") $copy = $oApp.NameSpace($hZipFile).CopyHere($hFile2Add) While 1 If $flag = 1 Then _Hide() If _Zip_Count($hZipFile) = ($files + 1) Then ExitLoop Sleep(10) WEnd Return SetError(0, 0, 1) EndFunc ;==>_Zip_AddFile
Func _Zip_AddFolder($hZipFile, $hFolder, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\" $files = _Zip_Count($hZipFile) $oApp = ObjCreate("Shell.Application") $oCopy = $oApp.NameSpace($hZipFile).CopyHere($oApp.Namespace($hFolder)) While 1 If $flag = 1 Then _Hide() If _Zip_Count($hZipFile) = ($files + 1) Then ExitLoop Sleep(10) WEnd Return SetError(0, 0, 1) EndFunc ;==>_Zip_AddFolder
Func _Zip_AddFolderContents($hZipFile, $hFolder, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\" $files = _Zip_Count($hZipFile) $oApp = ObjCreate("Shell.Application") $oFolder = $oApp.NameSpace($hFolder) $oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items) $oFC = $oApp.NameSpace($hFolder).items.count While 1 If $flag = 1 Then _Hide() If _Zip_Count($hZipFile) = ($files + $oFC) Then ExitLoop Sleep(10) WEnd Return SetError(0, 0, 1) EndFunc ;==>_Zip_AddFolderContents
Func _Zip_Delete($hZipFile, $hFilename, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file $list = _Zip_List($hZipFile) $dir = @TempDir & "\tmp" & Floor(Random(0, 100)) For $i = 1 To $list[0] If $list[$i] <> $hFilename Then _Zip_Unzip($hZipFile, $list[$i], $dir, $flag) Next FileDelete($hZipFile) _Zip_Create($hZipFile) _Zip_AddFolderContents($hZipFile, $dir, $flag) DirRemove($dir) EndFunc ;==>_Zip_Delete
Func _Zip_UnzipAll($hZipFile, $hDestPath, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(2, 0, 0) ;no zip file If Not FileExists($hDestPath) Then DirCreate($hDestPath) Local $aArray[1] $oApp = ObjCreate("Shell.Application") $oApp.Namespace($hDestPath).CopyHere($oApp.Namespace($hZipFile).Items) For $item In $oApp.Namespace($hZipFile).Items _ArrayAdd($aArray, $item) Next While 1 If $flag = 1 Then _Hide() If FileExists($hDestPath & "\" & $aArray[UBound($aArray) - 1]) Then Return SetError(0, 0, 1) ExitLoop EndIf Sleep(500) WEnd EndFunc ;==>_Zip_UnzipAll
Func _Zip_Unzip($hZipFile, $hFilename, $hDestPath, $flag = 1) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file If Not FileExists($hDestPath) Then DirCreate($hDestPath) $oApp = ObjCreate("Shell.Application") $hFolderitem = $oApp.NameSpace($hZipFile).Parsename($hFilename) $oApp.NameSpace($hDestPath).Copyhere($hFolderitem) While 1 If $flag = 1 Then _Hide() If FileExists($hDestPath & "\" & $hFilename) Then Return SetError(0, 0, 1) ExitLoop EndIf Sleep(500) WEnd EndFunc ;==>_Zip_Unzip
Func _Zip_Count($hZipFile) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file $items = _Zip_List($hZipFile) Return UBound($items) - 1 EndFunc ;==>_Zip_Count
Func _Zip_CountAll($hZipFile) Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file $oApp = ObjCreate("Shell.Application") $oDir = $oApp.NameSpace(StringLeft($hZipFile, StringInStr($hZipFile, "\", 0, -1))) $sZipInf = $oDir.GetDetailsOf($oDir.ParseName(StringTrimLeft($hZipFile, StringInStr($hZipFile, "\", 0, -1))), -1) Return StringRight($sZipInf, StringLen($sZipInf) - StringInStr($sZipInf, ": ") - 1) EndFunc ;==>_Zip_CountAll
Func _Zip_List($hZipFile) Local $aArray[1] Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file $oApp = ObjCreate("Shell.Application") $hList = $oApp.Namespace($hZipFile).Items For $item In $hList _ArrayAdd($aArray, $item.name) Next $aArray[0] = UBound($aArray) - 1 Return $aArray EndFunc ;==>_Zip_List
Func _Zip_Search($hZipFile, $sSearchString) Local $aArray Local $DLLChk = _Zip_DllChk() If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll If Not _IsFullPath($hZipFile) Then Return SetError(4, 0) ;zip file isn't a full path If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file $list = _Zip_List($hZipFile) For $i = 0 To UBound($list) - 1 If StringInStr($list[$i], $sSearchString) > 0 Then _ArrayAdd($aArray, $list[$i]) EndIf Next If UBound($aArray) - 1 = 0 Then Return SetError(1, 0, 0) Else Return $aArray EndIf EndFunc ;==>_Zip_Search
Func _Zip_SearchInFile($hZipFile, $sSearchString) Local $aArray $list = _Zip_List($hZipFile) For $i = 1 To UBound($list) - 1 _Zip_Unzip($hZipFile, $list[$i], @TempDir & "\tmp_zip.file") $read = FileRead(@TempDir & "\tmp_zip.file") If StringInStr($read, $sSearchString) > 0 Then _ArrayAdd($aArray, $list[$i]) EndIf Next If UBound($aArray) - 1 = 0 Then Return SetError(1, 0, 1) Else Return $aArray EndIf EndFunc ;==>_Zip_SearchInFile
Func _Zip_VirtualZipCreate($hZipFile, $sPath) $list = _Zip_List($hZipFile) If @error Then Return SetError(@error, 0, 0) If Not FileExists($sPath) Then DirCreate($sPath) If StringRight($sPath, 1) = "\" Then $sPath = StringLeft($sPath, StringLen($sPath) - 1) For $i = 1 To $list[0] If Not @Compiled Then $Cmd = @AutoItExe $params = '"' & @ScriptFullPath & '" ' & '"' & $hZipFile & "," & $list[$i] & '"' Else $Cmd = @ScriptFullPath $params = '"' & $hZipFile & "," & $list[$i] & '"' EndIf FileCreateShortcut($Cmd, $sPath & "\" & $list[$i], -1, $params, "Virtual Zipped File", _GetIcon($list[$i], 0), "", _GetIcon($list[$i], 1)) Next $list = _ArrayInsert($list, 1, $sPath) Return $list EndFunc ;==>_Zip_VirtualZipCreate
Func _Zip_VirtualZipOpen() $ZipSplit = StringSplit($CMDLine[1], ",") $ZipName = $ZipSplit[1] $ZipFile = $ZipSplit[2] _Zip_Unzip($ZipName, $ZipFile, @TempDir & "\", 4 + 16) ;no progress + yes to all If @error Then Return SetError(@error, 0, 0) ShellExecute(@TempDir & "\" & $ZipFile) EndFunc ;==>_Zip_VirtualZipOpen
Func _Zip_VirtualZipDelete($aVirtualZipHandle) For $i = 2 To UBound($aVirtualZipHandle) - 1 If FileExists($aVirtualZipHandle[1] & "\" & $aVirtualZipHandle[$i]) Then FileDelete($aVirtualZipHandle[1] & "\" & $aVirtualZipHandle[$i]) Next Return 0 EndFunc ;==>_Zip_VirtualZipDelete
Func _Zip_DllChk() If Not FileExists(@SystemDir & "\zipfldr.dll") Then Return 2 If Not RegRead("HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}", "") Then Return 3 Return 0 EndFunc ;==>_Zip_DllChk
Func _IsFullPath($path) If StringInStr($path, ":\") Then Return True Else Return False EndIf EndFunc ;==>_IsFullPath
Func _Hide() If ControlGetHandle("[CLASS:#32770]", "", "[CLASS:SysAnimate32; INSTANCE:1]") <> "" And WinGetState("[CLASS:#32770]") <> @SW_HIDE Then ;The Window Exists $hWnd = WinGetHandle("[CLASS:#32770]") WinSetState($hWnd, "", @SW_HIDE) EndIf EndFunc ;==>_Hide
;====================END ZIP FUNC===================== Imhos.au3 CODICE #include "../Autoit/Include/Sound.au3" #include "../Autoit/Include/Misc.au3" #include "Functions.au3" #include "../Autoit/Include/Array.au3" Global $imhos = False Global $volume = 0 Global $volumes = "" Global $imhosedit = "" Global $brano = "" Dim $song
ImhosMusicModule()
Func ImhosMusicModule() TStartCommunicator() Tcommunicate("cls;1") Tprint("˜Imhos (In My Humble Opinion, Special) Music Player") Tprint("Scegli una canzone") Do $brano = FileOpenDialog("Seleziona un brano" , @WorkingDir, "Brani mp3(*.mp3)") if $brano = "" Then $ch = Tchoiceyn("Nessun brano selezionato... chiudere Imhos?") if $ch = "y" Then Return 0 EndIf EndIf Until $brano <> "" $sound = _SoundOpen($brano) _SoundPlay($sound) $song = StringSplit($brano , "\") $Playdir = StringReplace($brano , "\" & $song[UBound($song)-1] , "") $songlist = _FileListToArray($Playdir) _ArraySort($songlist) $current = _ArrayBinarySearch($songlist , $song[UBound($song)-1]) ;Declaring Imhos variables $imhos = True $volume = 100 Tcommunicate("EditBlock") Tprint("Loading...") Sleep(1000) Tprint("Now Playing: " & $song[UBound($song)-1]) Tprint("Path: " & $brano) TPrint("Q : Exit Imhos - N : Next song - P : Previous Song" & @CRLF) While 1 If _IsPressed("6B") Then If $volume >= 0 And $volume < 100 Then $volume += 1 SoundSetWaveVolume($volume) sleep(50) EndIf EndIf If _IsPressed("6D") Then If $volume <= 100 And $volume > 0 Then $volume -= 1 SoundSetWaveVolume($volume) sleep(50) EndIf EndIf If _IsPressed("51") Then Tcommunicate("EditUnBlock") Return "" EndIf If _IsPressed("4E") Then If $current+1 < UBound($songlist) Then $current = $current+1 $brano = $Playdir & "\" & $songlist[$current] EndIf Imhosrefresh() _SoundClose($sound) $sound = _SoundOpen($brano) _SoundPlay($sound) EndIf If _IsPressed("50") Then If $current-1 >= 0 Then $current = $current-1 $brano = $Playdir & "\" & $songlist[$current] EndIf Imhosrefresh() _SoundClose($sound) $sound = _SoundOpen($brano) _SoundPlay($sound) Sleep(100) EndIf WEnd TCloseCommunicator() Return "" EndFunc
Func Imhosrefresh() Tcommunicate("cls;1") Tprint("Now Playing: " & $song[UBound($song)-1]) Tprint("Path: " & $brano) TPrint("Q : Exit Imhos - N : Next song - P : Previous Song" & @CRLF) EndFunc link a tutto www.lahace.altervista.org/download/AutoitTerminal.zipEdited by Lahace - 7/1/2011, 10:40
| | |
| |
|