Adding titles, images, and files

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Adding titles, images, and files

01 Sep 2020, 10:01

Looks promising, but not really familiar to me?! Would you mind sharing the code you've used to make this happen?
Here's another (?) 'workaround': https://autohotkey.com/board/topic/74758-tip-how-to-set-row-height-for-listview/
RickC
Posts: 299
Joined: 27 Oct 2013, 08:32

Re: Adding titles, images, and files

01 Sep 2020, 10:29

As an alternative, EMDB (https://www.emdb.eu/) does this for you automatically. Just point it a location where movies are stored using the Hard Disk icon in the menubar.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Adding titles, images, and files

01 Sep 2020, 10:37

@RickC - Had to realize that my favourite inventory app for iOS (CD/DVD/... barcode scan, searching Amazon) has died *sigh*.
:salute: R.I.P 'itemShelf' :salute: (https://github.com/dev2dev/itemshelf)
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

01 Sep 2020, 16:27

BoBo wrote:
01 Sep 2020, 10:01
Looks promising, but not really familiar to me?! Would you mind sharing the code you've used to make this happen?
Here's another (?) 'workaround': https://autohotkey.com/board/topic/74758-tip-how-to-set-row-height-for-listview/
yah, I saw that as an example as well. This is what I went with, as it seemed to work without changing much code.

Code: Select all

IconWidth    :=  2
IconHeight   := 50
IconBitDepth := 24 
InitialCount :=  1
GrowCount    :=  

ImageListID := DllCall( "ImageList_Create", Int,IconWidth,    Int,IconHeight
                                          , Int,IconBitDepth, Int,InitialCount
                                          , Int,GrowCount )

LV_SetImageList( ImageListID, 1 )
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

01 Sep 2020, 16:28

RickC wrote:
01 Sep 2020, 10:29
As an alternative, EMDB (https://www.emdb.eu/) does this for you automatically. Just point it a location where movies are stored using the Hard Disk icon in the menubar.
No really desiring something already done. I'm learning and it's more gratifying when you do something yourself... thank you though. Looks like a great movie program!
Snowy42
Posts: 42
Joined: 03 Jul 2017, 18:32

Re: Adding titles, images, and files

01 Sep 2020, 19:01

Epialis, could you post your whole script? I'd be keen to check it out and see if I can make something work or you.
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

02 Sep 2020, 07:54

Okay, I have it where I can press enter on the list in the listview, and it plays the video I tell it to in my VLC player. I need it, however, to insert this in every listing I add to the listview. Like how it creates a new row when you add another title, it needs to recognize the move and vlc media player and update each one based on the movie title. Right no I manually add the file in the script... I need it to auto add as I add the movie titles. Any help would be appreciated. Thank you!

So if I enter The Stand, year 2000, then it puts in the command

Code: Select all

ButtonCLICK:
GuiControlGet, FocusedControl, FocusV
if (FocusedControl != "MyListView")
	return
;MsgBox % "Enter was pressed. The focused row number is " . LV_GetNext(0, "Focused")
SetTitleMatchMode, 2
ControlSend, , {Enter}, VLC media player
Run, C:\Users\dclar\Desktop\DO NOT TOUCH\Brand New Installs\MOVIES\Sent to BACKUP\The_Stand\stand.mp4  C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
return


Code: Select all

Gui +AlwaysOnTop +resize
Gui, Show, x100 y100 w500 h500

Gui, Add, ListView, sort -ReadOnly grid x10 y5  h360 w400 +hscroll vMyListView gMyListview, Title 
| Year | Image
Gui, Add, Button, section gAddItem, Add Movie Title
Gui, Add, Text, w52 section , Movie Title
Gui, Add, Edit, w100 ys vTitle1 hwndOne
SetEditCueBanner(One, "Title")
Gui, Add, Text, ys, Year
Gui, Add, Edit, w150 ys vYear1 hwndTwo
SetEditCueBanner(Two, "Year")

pathToPic := ""
GUI Add, Button, w65 ys gpushPic, Add Image ; add a button and set its g-label to be 'pushPic' (https://www.autohotkey.com/docs/commands/Gui.htm#label)
Gui, Add, Picture, w65 h100 ys vNewVar hwndThree, %Newvar%

Gui, Add, Button, Hidden Default, CLICK

User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

02 Sep 2020, 07:57

I think I can do it by doing what I did with the image? Add the link to the actually movie file and then focus it to each row/field???? Maybe.. any thoughts?
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

02 Sep 2020, 21:44

YAY, okay, I have it now adding the movie and linking the movie to the title of the movie and playing it. But I want to be able to click on the title to play the movie. Here's the code. It only works when I press Enter only.. What am I missing?

Code: Select all

ButtonCLICK:
GuiControlGet, FocusedControl, FocusV
if (FocusedControl != "MyListView")
	return
SetTitleMatchMode, 2
ControlSend, , {LButton}, VLC media player
Run, %Newvar1% C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
return
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

02 Sep 2020, 23:02

Well, yay wasn't warranted yet :( *cries* lol

Why would it play the movie when you first add it, but when you close it, and re open, it gives an error? The ini file saves the url and the image, name and year just fine... not sure why it wouldn't replay it after saving the information?

The error is the line above... here's the line..

Code: Select all

Run, %Newvar1% C:\Program Files (x86)\VideoLAN\VLC\vlc.exe

And I created my variable here...

Code: Select all

pushPic1:
Gui, Submit, NoHide		; <- GuiControlGet would work here too
FileSelectFile, path, 3, % pathToPic1, Select Movie File, Pictures (*.mp4; ) ; displays a standard dialog that allows the user to choose a picture
Newvar1 := % path
GuiControl,, Newvar1, %Newvar1%
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

02 Sep 2020, 23:36

WEll ughh... It only plays the first movie I put into the list... if I add other titles, it still only plays the first movie I enter... Some reason not focusing. I"m going to bed lol... long day... will tackle tomorrow.. blessings all..
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

03 Sep 2020, 09:24

Okay, the msgbox shows the correct row and is identify the focused row that it's on, but it's not recognizing the movie. Not sure why it shows the row, but won't show the right movie. It gives me an error on the run command. Any ideas? I trided it without the brackets and size as well and still get same error on the run, command.

Code: Select all

GuiControlGet, FocusedControl, FocusV
if (FocusedControl != "MyListView")
	return
SetTitleMatchMode, 2
Run, %playmovie% [C:\Program Files (x86)\VideoLAN\VLC\vlc.exe, w500 h500]
MsgBox % "Enter was pressed. The focused row number is " . LV_GetNext(0, "Focused")
return
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Adding titles, images, and files

03 Sep 2020, 09:45

Code: Select all

SetTitleMatchMode, 2
;
;
GuiControlGet, FocusedControl, FocusV
If (FocusedControl != "MyListView")
	Return
Run, % "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe " . playmovie . " --width=""500"" --height=""500"" " ; https://wiki.videolan.org/Documentation:Command_line/#Use_the_command_line
MsgBox % "Enter was pressed. The focused row number is " . LV_GetNext(0, "Focused")
Return
Untested.
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

03 Sep 2020, 10:01

BoBo wrote:
03 Sep 2020, 09:45

Code: Select all

SetTitleMatchMode, 2
;
;
GuiControlGet, FocusedControl, FocusV
If (FocusedControl != "MyListView")
	Return
Run, % "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe " . playmovie . " --width=""500"" --height=""500"" " ; https://wiki.videolan.org/Documentation:Command_line/#Use_the_command_line
MsgBox % "Enter was pressed. The focused row number is " . LV_GetNext(0, "Focused")
Return
Untested.

Okay, thank you. It opens the vlc media player but doesn't recognize the playmovie.

Code for p lay movie

Code: Select all

pathToMovie := ""
GUI Add, Button, w65 ys gpushMovie, Select Movie File 
Gui, Add, Button, w65 h100 ys vplaymovie hwndFour, %playmovie%

Code creating variable for movie mp4

Code: Select all

pushMovie:
Gui, Submit, NoHide		; <- GuiControlGet would work here too
FileSelectFile, path, 3, % pathToMovie, Select Movie File, (*.mp4; ) ; displays a standard dialog that allows the user to choose a picture
playmovie := % path
GuiControl,, playmovie, %playmovie%
return
It's strange b/c the msgox opens and show the correct rows, but not the movie.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Adding titles, images, and files

03 Sep 2020, 10:09

If vlc wont show the movie there's obviously something wrong with the path you're handing over. Simply check the FileSelect-output for consistency, or how you deal with the variable afterwards. Btw, don't do this var = % expression but that var := expression :roll:
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

03 Sep 2020, 10:10

Okay, it says this upon immediately adding the movie and trying to play.

Code: Select all

Your input can't be opened:
VLC is unable to open the MRL 'file:///C:/Users/dclar/Desktop/AdvancedTools/My%20Sample%20Scripts/Must%20Use%20and%20Learn%20For%20Program%20Add/My%20Testing%20Folder/Coven.mp4'.
When I reload it, it doesn't say anything...but load the player... so I have something wrong with the url somehow.
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

03 Sep 2020, 10:16

As you can see, it puts the correct path to the movie.. so why is the path not working properly when called to play through VLC?
Attachments
capture12.jpg
capture12.jpg (42.85 KiB) Viewed 663 times
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Adding titles, images, and files

03 Sep 2020, 12:00

It's not up to AHK to care about VLCs animosity. Probably it's a credential issue, so have a try with :arrow: RunAs (admin).
https://appuals.com/fix-vlc-is-unable-to-open-the-mrl-file/
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

03 Sep 2020, 17:42

I don't think it's a right/credential error, it's trying to open the directory of the script is in but also the location of the file. Also, as stated, it will play ONCE and then gives the error after I reload the program; won't play it a second time

Your input can't be opened:
VLC is unable to open the MRL 'file:///C:/Users/dclar/Desktop/AdvancedTools/My%20Sample%20Scripts/Must%20Use%20and%20Learn%20For%20Program%20Add/My%20Testing%20Folder/Activist/Accidental_Activist.mp4'. Check the log for details.

Instead of the actual file location:

C:\Users\dclar\Desktop\DO NOT TOUCH\Brand New Installs\MOVIES\Sent to BACKUP\Christian\Accidental Activist\Accidental_Activist.mp4

And I can't find the error that's doing this.
User avatar
Epialis
Posts: 858
Joined: 02 Aug 2020, 22:44

Re: Adding titles, images, and files

04 Sep 2020, 02:45

Okay, I have been exploring. I enter the file for the mp4 and when I enter it plays. If I enter another movie, the last movie I enter is the one that always plays. So if I have 10 movies entered, it will only play the last title that I entered. Meaning... that all 10 title, no matter their file chosen for the mp4, play the last movie entered. They don't play what they are to play lol... grrr.... Not only that, when I exit the program, it does save all the text and information needed in the file. But when I reload the program, none of the movies play at all. They play the last one I entered until I exit, but then they won't play nothing.

I figured it had to be upon updating file upon exit that was the issue, but I find no issue whatsoever.

Code: Select all

UpdateFile() 
{
	FileDelete, MovieList.txt
	WinGet, Min, MinMax, MovieList
	If Min = -1
		WinRestore, MovieList
	WinGetPos, X, Y, Width, Height, MovieList
	Width -= 16
	Height -= 38
	FileAppend, x%x% y%y% w%Width% h%Height% `n, MovieList.txt
	Loop % LV_GetCount()
     {
		RowNum := A_Index
		Loop, 3
		{
			LV_GetText(Text, RowNum, A_Index)
			TrimText := Trim(Text)
			FileAppend, "%TrimText%"`,, MovieList.txt
		}
		LV_GetText(Text, RowNum, 4)
		TrimText := Trim(Text)
		FileAppend, "%TrimText%"`n, MovieList.txt
     }
}

Then I thought it was how the file was loaded, but I also find no error there.

Code: Select all

IfExist, MovieList.txt ;Add data from MovieList.txt to ListView
{
	Loop, Read, MovieList.txt
	{
		If (A_index = 1 and SubStr(A_LoopReadLine, 1, 1) = "x")
		{
			WinPos := A_LoopReadLine
			Continue
		}
		Else
		{
			Loop, Parse, A_LoopReadLine , CSV
			{
				RowData%A_Index% := A_LoopField
			}
			
			LV_Add("", RowData1,RowData2,RowData3,RowData4)
		}
	}
}
So I am not finding error upon saving the file and then reloading the program, unless I am missing something that is obvious LOL.. I do that sometimes. The only other thing I could think of is how it's adding the file... It does play the last movie I enter into the program... but it only plays that movie for ALL the entries I put into the program. SO I looked at the code for adding, and I also find nothing wrong there.

Code: Select all

AddItem:                 
  Gui, Submit, NoHide
  
If SelectedRow = 0
{
	LV_Add("", Trim(Title1),Trim(Year1),Trim(NewVar),Trim(playmovie))
	
	
}
else
{
	LV_Modify(SelectedRow,"", Year1,Title1,NewVar,playmovie)
	LV_ModifyCol(1,"Sort")
	SelectedRow := 0
	GuiControl, ,Button1, Add to list
}
So now, I"m completely exhausted with trying to figure this out. I don't see any errors in the code. Everything is pointing to where it needs to be. The files is saving the correct image location and mp4 location. I'm lost now lol :oops: :oops:

Sorry for such a long post, but had a lot to cover. Any help appreciated, thank you.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: inseption86, mikeyww and 444 guests