Page 1 of 1

Start VLC minimized

Posted: 16 Jun 2020, 03:58
by SyntaxTerror
Hello

I am currently using this script to read a folder randomly with VLC when I press a special key on my keyboard (I had to compile it as an EXE as Logitech's Setpoint — the program that controls the keyboard — doesn't recognise AHK scripts):

Code: Select all

run "C:\Program Files\VLC\vlc.exe" "--random" "D:\Musique\Reggea"
I would like to start VLC minimized to the taskbar and tried this:

Code: Select all

run "C:\Program Files\VLC\vlc.exe" "--random" "D:\Musique\Reggea"
WinWait, ahk_exe vlc.exe
WinMinimize
but it doesn't work (note that I am using "ahk_exe vlc.exe" because the title of the window is different at every start, as it plays random songs).

I also tried to find an option to add to the command line, like the "--random" option that plays the folder randomly (see wiki.videolan.org /VLC_command-line_help, but it is outdated), unfortunately it doesn't seem to exist.
[EDIT] I actually found (there: wiki.videolan.org/VLC_command-line_help) that adding the option "--qt-start-minimized" starts VLC minimized, but it is in the system tray, and I'd prefer to have it minimized to the taskbar.

I also tried to make a shortcut of the EXE and choose "Start minimized" in its parameters, to no avail.

Does anyone have a solution?

Re: Start VLC minimized  Topic is solved

Posted: 16 Jun 2020, 04:27
by vsub
--qt-start-minimized - will start it as tray icon only

This will minimize it the moment the vlc window appear

Code: Select all

WinWaitActive,ahk_exe vlc.exe
WinMinimize
Just "WinWait" don't work because ahk is waiting for any window to exist,not just the gui

Re: Start VLC minimized

Posted: 16 Jun 2020, 04:34
by SyntaxTerror
vsub wrote:
16 Jun 2020, 04:27
Just "WinWait" don't work because ahk is waiting for any window to exist,not just the gui
It was that simple...
Thank you very much for this quick answer! :thumbup:

Re: Start VLC minimized

Posted: 16 Jun 2020, 06:35
by garry
some examples for videolan vlc.exe

Code: Select all

#NoEnv
SendMode, Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1

VLC     =%A_programfiles%\VideoLAN\VLC\vlc.exe
;C2      =C:\test.mp3
C2      =C:\test.mp4

SetFormat, float, 04
begintime=00:00:30
endtime  =00:00:45
gosub,timecalc
;-------------
  ;INPUT   =--qt-start-minimized --play-and-exit --height=500 --width=700 --input-repeat=1 --start-time=%begin% --stop-time=%end%
  ;INPUT   =--play-and-exit --height=500 --width=700 --input-repeat=1 --start-time=%begin% --stop-time=%end%
  ;INPUT   =--one-instance --height=500 --width=700 --start-time=%begin% --stop-time=%end%
  ; position x y not works (?)
  ;INPUT   =--one-instance --play-and-stop --video-x=0 --video-y=50 --height=500 --width=700 --start-time=%begin% --stop-time=%end%
  ;INPUT   =--one-instance --play-and-stop --height=500 --width=700 --start-time=%begin% --stop-time=%end%

  ;INPUT   =--one-instance --play-and-exit --height=500 --width=700 --start-time=%begin% --stop-time=%end%

  INPUT   =--repeat --fullscreen --start-time=%begin% --stop-time=%end%

  run,%VLC% %input% "%C2%",,,pid2
return

esc::
{
process, exist,%pid2%
if errorlevel=0
  return
else
  {
  process,close,%pid2%
  exitapp
  }
return
}

timecalc:
;gui,2:submit,nohide
 stringsplit,b,begintime,`:
 hours  :=(b1*60*60)
 minutes:=(b2*60)
 seconds:=(b3)
 begin  :=(hours+minutes+seconds)
 ;--
 stringsplit,e,endtime,`:
 hours2  :=(e1*60*60)
 minutes2:=(e2*60)
 seconds2:=(e3)
 end     :=(hours2+minutes2+seconds2)
return
;===============================================

a RANDOM music player

Code: Select all

;- https://autohotkey.com/board/topic/51861-tinyshuffle-smallest-mp3-player-on-earth/
#warn
#Noenv
#singleinstance, force		                ;- force the app to reload if reopened
setworkingdir,%a_scriptdir%
mp3root=D:\M_MEDIA\M_MUSIC                  ;- your music files here
IfNotExist,%mp3root%
	exitapp		        		 	        ;- If the dir doesn't exist, exit the app
played=
Filelist0=0
Menu,Tray, NoStandard		        		;- Remove the standard items from the menu
Menu,Tray,add,skip,#s			        	;- Add a item to skip a song
Menu,Tray,add,exit,#esc		        		;- Add exit item
Menu,Tray, icon, shell32.dll, 138	        ;- give the tray a icon
Menu,Tray,Default,skip			        	;- set the menu's default item if leftclick
Menu,Tray,Click,1 	        			    ;- Single-click to activate the tray menu's default menu item.
Loop %mp3root%\*.*,, 1		        		;- Loop all files in the folder
	If A_LoopFileExt in mp3,wma	        	;- If it is a supported filetype
		{
		FileList0++	        		        ;- Add one to the count of files
		FileList%FileList0%:=A_LoopFileFullPath	;- Store the path of the file
		}
menu, tray, tip, Tiny Shuffler - %FileList0% items
loop {
	Random, rand, 1, %FileList0%			;- Get a random nr with a max of the nr of items in the fillelist
	if rand not in %played%				    ;- If we did not played the song before (needs a comma delimited list)
		{
		TrayTip , Tiny Shuffler - %FileList0% items,% filelist%rand%,3	;- Show the filename of the new song
		Soundplay,% filelist%rand%, wait	;- Play the song and wait until it finishes
		played.=played ? "," rand : rand	;- Add the songnr to the played ones (create the comma delimited list)
		Loop, parse, played, `,			    ;- Loop to see if we played all (Loop the comma delimited list)
			IfEqual,A_Index,%FileList0%,SetEnv,played,  ;- If we played all, reset to play all again
		}
	}
return							    ;- End of the main section
;--------------------------------------------------------------
#s:: Soundplay,skip					;- win+s	Give a fiction name to clear the playing item so the Loop continues
#esc:: exitapp						;- win+esc	Exit the app
;==============================================================

Re: Start VLC minimized

Posted: 03 Oct 2021, 01:47
by Dsalomon
run, vlc.exe "--qt-start-minimized" "--random" "D:\Musique\Reggea"
ExitApp
Algo tarde... :lol:

Re: Start VLC minimized

Posted: 03 Oct 2021, 16:37
by flyingDman
Mejor tarde que nunca... :lol:

Thank you. Works well.