Что нового

[Автоматизация] Автоматическое сохранение плейлиста для GOM player

Сообщения
1
Репутация
-1
AutoIt: 3.3.8.0
Версия: N/A
Категория: Автоматизация
Описание: если у вас не установлен GOM player
дальше можно не читать


если достало каждый раз нажимать save as
искать директорию и далее перезаписывать файл
после просмотра многофайлового playlist'a

то мб этот скрипт для вас
(можно впринципе по другому сделать
но что есть то есть)
и да получился быдлоскрипт


прописывается в реестр(скрипт restore восттанавливает реестр)
добавляет к плееру еще 1 плейлист
в котором на выходе из плеере
очищается что было удалено из GUI скрипта


установка:
скомпилить скрипт
клацнуть 2 раза
ну и попробовать запустить любой плейлист(*.asx)



собственно kmplayer имеет автосейв(+ вкладки)
но там чет мутно
ссылка на скачивание с форума(сайта нету0о)
и вирустотал ругается
мб ложное срабатывание
но мне пока лень проверять
и все лабуду переписывать настраивать

думаю что для 99.9 % бесполезен скрипт
мб для других нужд

кстати если кто знает видео плеер с автосейвом плейлистов(который перезаписывает плейлист а не просто хранит 1 плейлист во временном файле/реестре)
Код:
Код:
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <Misc.au3>
#NoTrayIcon
_Singleton(@ScriptName)

;if not @Compiled then Exit
$key="HKEY_LOCAL_MACHINE\SOFTWARE\Classes\GomPlayer.asx\shell\open\command"
$keygomexe="HKEY_CURRENT_USER\Software\GRETECH\GomPlayer"
$pathgom=regread($keygomexe,"ProgramPath")
if $pathgom="" then Exit
RegWrite($key,"", "REG_SZ", '"'&@ScriptFullPath&'" /add "%1"')
;HKEY_CLASSES_ROOT\GomPlayer.asx\shell\open\command
Func showmeitpliz($proc, $strComputer=".")
   ;  $proc="cfp.exe"  ;=> Comodo FW process   ==>cfp.exe  (define your proc.exe)

  $oWMI=ObjGet("winmgmts:{impersonationLevel=impersonate}!\" & $strComputer & "
oot\cimv2")
  $oProcessColl=$oWMI.ExecQuery("Select * from Win32_Process where Name= " & '"'& $Proc & '"')

  For $Process In $oProcessColl
    $Process=$Process.Commandline
    ;MsgBox(0,"",$Process)
	Return $Process
  Next

EndFunc; ==>showmeitpliz()

$cmdlinegom=""
if $cmdline[0]=2 Then
	;$cmdline[1]
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$cmdline[1]' & @lf & @lf & 'Return:' & @lf & $cmdline[1]) ;### Debug MSGBOX
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$cmdline[1]' & @lf & @lf & 'Return:' & @lf & $cmdline[2]) ;### Debug MSGBOX

if $cmdline[1]="/open" or  $cmdline[1]="/add" then

$cmdlinegom=$cmdline[2]
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$cmdlinegom' & @lf & @lf & 'Return:' & @lf & $cmdlinegom) ;### Debug MSGBOX

;StringRegExpReplace($cmdline[2],'.*/open ',"")
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$cmdlinegom' & @lf & @lf & 'Return:' & @lf & $cmdlinegom) ;### Debug MSGBOX
EndIf
;$cmdexepath="C:\Program Files\GRETECH\GomPlayer\GOM.EXE"
$pathgom=regread($keygomexe,"ProgramPath")
run($pathgom&" /open "&'"'&$cmdlinegom&'"')

WinWait("[class:GomPlayer1.x]","",5)
sleep(2000)

Else

$cmdlinegom=showmeitpliz("GOM.exe")
;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $cmdlinegom = ' & $cmdlinegom & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
if $cmdlinegom<>0 then exit
$cmdlinegom=StringRegExpReplace($cmdlinegom,'.*/open |"',"")
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$cmdlinegom' & @lf & @lf & 'Return:' & @lf & $cmdlinegom) ;### Debug MSGBOX
$ext=stringmid($cmdlinegom,StringLen($cmdlinegom)-3,4)
;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $ext = ' & $ext & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : stringmid($cmdlinegom,StringLen($cmdlinegom)-4,4) = ' & stringmid($cmdlinegom,StringLen($cmdlinegom)-4,4) & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
if $ext=".exe" then exit
;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $cmdlinegom = ' & $cmdlinegom & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;exit
; Script Start - Add your code below here
endif

#include <Array.au3>
#include <GuiListView.au3>

;ProcessGetStats
$file = FileOpen($cmdlinegom, 0)

; Check if file opened for reading OK
If $file = -1 Then
	ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $file = ' & $file & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
   ; MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
Local $avArray[3][2]
$1element=0
$i=0
While 1

    $line = FileReadLine($file)
  If @error = -1 Then ExitLoop
		;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $line = ' & $line & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
if StringInStr($line,"<title>") or $1element=1 then

	if $1element=1 then
$line=StringRegExpReplace($line,'.*<ref href = "|" />.*',"")
		$z=$i-1
	$avArray[$z][1]=$line
	$1element=0
Else
				$i=$i+1
	ReDim $avArray[$i][2]
$line=StringRegExpReplace($line,".*<title>|</title>.*","")
	$z=$i-1
$avArray[$z][0]=$line
$1element=1
	EndIf
	EndIf
    ;MsgBox(0, "Line read:", $line)
Wend

FileClose($file)
;_ArrayDisplay($avArray, "$avArray as a 2D array")

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#include <GUIListBox.au3>
#include <Constants.au3>

#Region ### START Koda GUI section ### Form=
	$hwndgom=WinGetHandle("[class:GomPlayer1.x]")
	$size = WinGetPos($hwndgom)

$Form1 = GUICreate("PlayListAutoRemove", $size[0]+$size[2],$size[1],$size[2]/2,$size[3])
	winmove($Form1,"",$size[0]+$size[2],$size[1],$size[2]/2,$size[3])

;$List1 = GUICtrlCreateList("", 24, 40, 577, 240, $LBS_EXTENDEDSEL)

$hListBox = _GUICtrlListBox_Create($Form1, "", 10, 10, $size[2]/2-$size[3]/100*5, $size[3]-$size[3]/100*30,$LBS_EXTENDEDSEL)
;$hListBox = ""

$Button1 = GUICtrlCreateButton("del",$size[2]/2-$size[2]/100*35,$size[3]-$size[3]/100*15,100,50);$size[3]/10*2 $size[3]/10*2
;$Button2 = GUICtrlCreateButton("reopen",$size[2]/2-$size[2]/100*35,$size[3]-$size[3]/100*15,100,50);$size[3]/10*2 $size[3]/10*2

;$Button1 = GUICtrlCreateButton("del",0,0,10,10)
;, $size[0]+$size[2]/2-550, $size[1]/2, 250, 100)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
		;	$size = WinGetPos($hwndgom)
;sleep(2000)
;exit

for $i=0 to UBound($avArray,1)-1
;FileWrite($file, "<title>"&$avArray[$i][0]&"</title>" & @CRLF)
;FileWrite($file, '<ref href = "'&$avArray[$i][1]&'" />' & @CRLF)

;GUICtrlSetData($List1,$avArray[$i][0],"")
_GUICtrlListBox_AddString($hListBox, $avArray[$i][0])

	Next
$x=0
$p=0
$dll = DllOpen("user32.dll")

	if $hwndgom="" then exit

While 1
		if WinExists($hwndgom)=0 then ExitLoop
			$size = WinGetPos($hwndgom)
winmove($Form1,"",$size[0]+$size[2],$size[1],$size[2]/2,$size[3])


    If _IsPressed("2E", $dll) Then
      ;  MsgBox(0,"_IsPressed", "End Key Pressed")
	  DelSelItems()
      sleep(5000)
    EndIf


	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			ExitLoop
		Case $Button1
DelSelItems()
	EndSwitch
WEnd





$file = FileOpen($cmdlinegom, 10)

FileWrite($file, '<asx version = "3.0" >' & @CRLF)


for $i=0 to UBound($avArray,1)-1
	if $avArray[$i][0]<>"" then
FileWrite($file, '<entry>' & @CRLF)
	FileWrite($file, "<title>"&$avArray[$i][0]&"</title>" & @CRLF)
	FileWrite($file, '<ref href = "'&$avArray[$i][1]&'" />' & @CRLF)
FileWrite($file, '</entry>' & @CRLF)
endif
	Next
FileWrite($file, '</asx>')
FileClose($file)
DllClose($dll)




			Func DelSelItems()
			$iI=0
			Do
			  ;  _GUICtrlListBox_BeginUpdate($hListBox)
$aItems = _GUICtrlListBox_GetSelItems($hListBox)

if _GUICtrlListBox_GetCurSel($hListBox)=-1 then ExitLoop
if $aItems[0]=0 then ExitLoop
;	For $iI = 1 To $aItems[0]-$p

		;If $iI > 1 Then $sItems &= ", "
		;$sItems &=
	For $zZ = 0 To UBound($avArray,1)-1
		if _GUICtrlListBox_GetCurSel($hListBox)=-1 then ExitLoop
		if $aItems[0]=0 then ExitLoop
	;$z=$aItems[0]
	;if $z=$x then ExitLoop

$iI=1;$iI+1
;_ArrayDisplay($aItems, "$avArray as a 2D array")
$string=_GUICtrlListBox_GetText($hListBox, $aItems[$iI])
;ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $string = ' & $string & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console


;_GUICtrlListBox_GetItemData($hListBox, )

		if $avArray[$ZZ][0]=$string then
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $string = ' & $string & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$p=$p+1
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $p = ' & $p & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
;$aItems[$iI]
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $aItems[$iI] = ' & $aItems[$iI] & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
$count=$aItems[$iI]
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $count = ' & $count & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
_GUICtrlListBox_DeleteString($hListBox,$aItems[$iI])

$aItems = _GUICtrlListBox_GetSelItems($hListBox)
;$x=$aItems[0]
;$p=$p+1
;$iI=0
			$avArray[$ZZ][0]=""
			ExitLoop
			EndIf



	Next
;ExitLoop
	until _GUICtrlListBox_GetCurSel($hListBox)=-1
	EndFunc
Screenshot:

Источник: N/A
 

kaster

Мой Аватар, он лучший самый
Команда форума
Глобальный модератор
Сообщения
4,020
Репутация
626
ordvtaigc
больше править никто не станет ;)
 

Zaramot

I ♥ AutoIt
Сообщения
1,160
Репутация
660
OffTopic:
http://www.autoitscript.com/forum/topic/137911-autosave-playlist-asx-for-gomplayer/ :scratch:
Просто текст переведен :D
 
Верх