Page 1 of 3

Adding titles, images, and files

Posted: 30 Aug 2020, 05:47
by Epialis
Okay, I'll just come out and ask. Is it possible to create A GUI where I can select an image, have it show in the GUI, with a place to put a title and link to the file? In otherwords, I have a list of songs and movies I would like to be able to just add to a GUI by selecting the image to the artists, or movies, and then linking them to the file on my computer. I'm trying to make it easy for me to just have all movies in a program like that, and then save everything. I think it's possible with AHK, from what I have been looking at in the forums, but don't really know where to start. Just brainstorming to see what I can and cannot do with AHK. Been reading and googling. Any suggestions would be great.

What I have so far is the ability to add an image, but no idea how to save it or link it to a song on the computer.

Re: Adding titles, images, and files

Posted: 30 Aug 2020, 06:36
by BoBo
The most simple thing (that is even working without using AHK) - creating an HTML/HTA that contains an image (or a table of tiled images) that is linked to a local/remote file.
AHK would come into play if you wanna create such a table (and playlist files etc.) on the fly, parsing a directory.

Re: Adding titles, images, and files

Posted: 30 Aug 2020, 08:43
by Epialis
Okay, so u're saying mix AHK with HTML and use the HMTL to hold the images. I already have written the add song title and year and have it all saved now. I was wondering how to do the image, and linking the image with the actual song to be played. But thanks for the HTML, I'll try and implement that in what I have already. Not sure of linking it though to the actual song title, but I'll google and search and ask in here when I get that far. Thank you.

Re: Adding titles, images, and files

Posted: 30 Aug 2020, 20:43
by Epialis
Okay, now I'm where I could use some help. I have the title an the year writing to my gui, but the image add at this point, I need it to actually just give me the url to the image in a text box... and then when I click add, it puts the image in the list view area next to the title and year, or even underneath it. This is what I think I need to show so far for help.

Code: Select all

Gui +AlwaysOnTop +Resize
Gui, Add, ListView, sort -ReadOnly r10 w800 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 vAddr2, Title
Gui, Add, Text, ys, Year
Gui, Add, Edit, w150 ys vAddr1, Year

pathToPic := ""
GUI Add, Button, w65 ys vMyButton gpushPic, Add Image
GUI, Show, AutoSize

pushPic:
FileSelectFile, path, 3, % pathToPic, Select a picture, Pictures (*.png; *.svg; *.jpg) ; displays a standard dialog that allows the user to choose a picture
	return
So I'd need a text area that would hold the url to the image, and when I click Add Movie Title, it would then put it int he listview, next to the information of the movie and link it to either the image, or have it link to a watch/play button. Hope this makes sense. I was going to try my songs first, but I have so many movies I figured I'd try it first. Thanks for any help. I don't expect anyone to write it for me, but would help to have an idea where to go and how to implement what I am needing. Thank you all for help.

Re: Adding titles, images, and files

Posted: 30 Aug 2020, 21:26
by Epialis
Okay I have the path displaying, but it's not writing to the edit area...

Code: Select all

pathToPic := ""
GUI Add, Button, w65 ys vMyButton 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, Edit, w100 ys, %path% 
GUI, Show, AutoSize

pushPic:
FileSelectFile, path, 3, % pathToPic, Select a picture, Pictures (*.png; *.jpeg; *.jpg) ; displays a standard dialog that allows the user to choose a picture
MsgBox, % path
When I run it and add image, it displays the url in the messagebox... but not in the Add, Edit area?

Re: Adding titles, images, and files

Posted: 30 Aug 2020, 21:46
by Epialis
Updated:

Okay, I have the URL showing now... Now I need to convert it into the actual image with a play button that will play the movie. Busy, Busy, Busy lol.. If anyone has any ideas, thank you.

Re: Adding titles, images, and files

Posted: 31 Aug 2020, 02:04
by Epialis
Okay, I have the image showing instead of url, as the url gets posted anyway.

anyway that I can place that image in the listbox? Next to the title and year? I don't now how to convert it to do that. Any help would be great.

Re: Adding titles, images, and files

Posted: 31 Aug 2020, 02:18
by BoBo
Respect. :thumbup: Well, tweaking your code is kinda tricky, without having your code. :shifty:

Re: Adding titles, images, and files

Posted: 31 Aug 2020, 02:48
by Epialis
@BoBo

Okay, well background wont' work, as it has to be with each entry I make with different images. Is there a better way to do this without the listview then... possibly?

And thank you

Re: Adding titles, images, and files

Posted: 31 Aug 2020, 04:49
by BoBo
I'd guess the mainstream way would be to show whatever image to the right of the listview, and you could set the 'path'-column hidden style if you're not really interested to show it in its full glory. Btw, do you really wanna add your content manually to your Gui, instead of creating a directory parser?

PS. regarding my initial statement about HTML (if you're more used to that), here we go: https://www.autohotkey.com/boards/viewtopic.php?f=74&t=4588
PPS. I can't believe that your (media viewer) topic hasn't been dealt with before. Being off for research ...

Re: Adding titles, images, and files

Posted: 31 Aug 2020, 21:48
by Epialis
@BoBo

Yeah, I want it manually, as I can use it for many different purposes; not just movies or music. Still not got anything figured out, but I"m relentless lol. Thank you!

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 04:44
by garry
a Listview example , see example black.ico , you can add small pictures to the row

Code: Select all

#warn
#noenv
Setworkingdir,%a_scriptdir%
Gui,2:default
Gui,2: -DPIScale
Gui,2: Font,s14 CBlack,Lucida Console
e4x=
(Ltrim Join`r`n
VOLUME;Sndvol.exe
CHARMAP;Charmap.exe
Black;myblack.ahk
Notepad;Notepad.exe
mozilla;%a_programfiles%\Mozilla Firefox\Firefox.exe
)
   Gui,2:Add, ListView, backgroundGray  grid x10 y5  h360 w600 +hscroll altsubmit vMLV1A gMLV1B      , Icon|Program
   gosub,lb
gui,2:show, x100 y10 h380 w630,LV-Icon / Click on column-2 to start
return
2Guiclose:
exitapp
lb:
Gui,2:Submit,nohide
Gui,2:ListView,mlv1a
t1:=280
t2:=300
   LV_ModifyCol(1,T1)
   LV_ModifyCol(2,T2)
  ;ILStatus := IL_Create(1,1,0)                ;small
   ILStatus := IL_Create(1,1,1)                ;bigger
   LV_SetImageList(ILStatus, 1)
LV_Delete()
GuiControl,2: -Redraw,MLV1a

;---  for test -----------
R3I=C:\M_ICO
XXA:=% R3I . "\black.ico"
;-------------------------

loop,parse,e4x,`n,`r
  {
  x:=a_loopfield
  c1=
  c2=
  IconNumber := IL_Add(ILSTATUS, "%pictxx05%" )      ;- clear with picture which not exist
  stringsplit,C,x,`;,
  SplitPath,c2, name, dir, ext, name_no_ext, drive
  IconNumber := IL_Add(ILSTATUS, C2 )

  if C1=black
    IconNumber := IL_Add(ILSTATUS, XXA )

  LV_Add("icon" . IconNumber ,C1,name_no_ext)
  }
GuiControl,2: +Redraw,MLV1a
LV_ModifyCol(1,"right")     ;- move text to right
return
;-----------------------------------------------------------------
mlv1b:
Gui,2:submit,nohide
Gui,2:ListView, mlv1a
t1a:=(t1+20)
If A_GuiEvent = Normal
   {
    MouseGetPos,x,y
       {
       if x<%T1%
          return
       if x>%T1a%
          {
          LV_GetText(C2,A_EventInfo,2)
          ;msgbox, 262208, C2,%c2%
          try 
          run,%c2%
          return
          }
       }
}
return
;==============================================
InternetRadio example show wikipedia from played song ( and also not in picture , radio symbol-ico )
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=72452
Image

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 05:37
by Epialis
@garry

Yea, I just have to learn how to turn the url or file.jp into an actual image by edit; not adding to the script itself. I can see it can be done however. Thank you.

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 06:02
by BoBo
Epialis wrote:
01 Sep 2020, 05:37
@garry
Yea, I just have to learn how to turn the url or file.jp into an actual image by edit; not adding to the script itself. I can see it can be done however. Thank you.
:arrow: FileSelectFile ?!

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 06:29
by Epialis
@BoBo

Yeah, this is my code for that, but as you see, it places the picture in the very top left hand corner and not in the listview.

Code: Select all

pushPic:
Gui, Submit, NoHide		; <- GuiControlGet would work here too
FileSelectFile, path, 3, % pathToPic, Select a picture, Pictures (*.png; *.jpeg; *.jpg) ; displays a standard dialog that allows the user to choose a picture
NewVar := % path
GuiControl,, Newvar, %Newvar%
Gui, Add, Picture, x0 y0  w50 h50 hwndhWndPicControl, %Newvar%
Listview Code:

Code: Select all

OnExit, UpdateFile

SelectedRow := 0

Gui +AlwaysOnTop +Resize
Gui, Add, ListView, sort -ReadOnly r10 w800 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 vAddr2 hwndOne
SetEditCueBanner(One, "Title")
Gui, Add, Text, ys, Year
Gui, Add, Edit, w150 ys vAddr1 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%

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 06:30
by Epialis
And sorry, here is my add item...

Code: Select all

AddItem:                 ;Add new or update ListView row
  Gui, Submit, NoHide
  
If SelectedRow = 0
{
	LV_Add("", Trim(Addr2),Trim(Addr1),Trim(NewVar))
}
else
{
	LV_Modify(SelectedRow,"", Addr1,Addr2,NewVar)
	LV_ModifyCol(1,"Sort")
	SelectedRow := 0
	GuiControl, ,Button1, Add to list
}

SizeCols()
UpdateFile()
Return

UpdateFile:  ;When exiting
  DetectHiddenWindows On
  UpdateFile()
  ExitApp
Return

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 06:52
by BoBo
Gui, Add, Picture, x0 y0 ... placing it at the top-left position of that window. Correct.

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 06:55
by Epialis
yeah, but I need to figure out how to add it to the listview so that it lines up with the description. Still workin on it.. I'll get her done eventually. Fun Fun eh? :) Thanks

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 07:05
by BoBo
I doubt that's possible at all. You can use a picture instead of an icon within the listview but that won't help bc its to tiny to be of any use. You can instead postion an image (outside of the listview) that is related to the row that has the focus.

Re: Adding titles, images, and files

Posted: 01 Sep 2020, 07:43
by Epialis
@BoBo

As you can see, I can make the rows higher, so an icon or even picture would fit better. Can make as high as I need the image.