Music Lyric Grabber Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
meireles
Posts: 3
Joined: 25 Jun 2017, 03:02

Music Lyric Grabber

17 Jan 2018, 10:34

I found on older forum this post https://autohotkey.com/board/topic/3582 ... c-grabber/ and need help.

I modified the script but seems i made some mistake. Could someone correct me?

The url was changed to

Code: Select all

https://www.letras.mus.br/%Artist%/%Song%, lyrics.html
The loopfield is

Code: Select all

<div class="cnt-letra p402_premium"> <article>
Take a try. Write camila-cabello (slash instead space) for artist and havana for the song.

If you comment the line

Code: Select all

FileDelete, lyrics.html
you can see the parameters exists inside the html file.
Music Lyric Grabber.ahk
Modified script
(2.72 KiB) Downloaded 24 times
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: Music Lyric Grabber  Topic is solved

17 Jan 2018, 13:17

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
;;;;;;;;start code;;;;;;;;;
#persistent
#singleinstance
#NoTrayIcon

Gui, Margin, 10, 10
Gui, add, text  , xm     ym    w30  h20  Right 0x200            , Artist:
Gui, add, edit  , xm+35  ym    w100 h20              vArtist    , 
Gui, add, text  , xm+140 ym    w30  h20  Right 0x200            , Song:
Gui, add, edit  , xm+175 ym    w100 h20              vSong      , 
Gui, add, button, xm+280 ym    w50  h20  Default                , Search
Gui, Add, Edit  , xm     ym+30 w330 h400 ReadOnly    vLyrics_edt,
Gui, Add, Statusbar
SB_SetText( "Ready." )
; Gui, add, button, x90 y98, Cancel
Menu, FileMenu, Add, About, AboutFun
Menu, FileMenu, Add, Help, HelpFun
Menu, MenuBar, Add, Menu, :FileMenu
Menu, transmenu, Add, Low, Low
Menu, transmenu, Add, Medium, Medium
Menu, transmenu, Add, Full, Full
Menu, OptionsMenu, Add, Transparency, :transmenu
Menu, OptionsMenu, Add, Keep On Top, kot
Menu, MenuBar, Add, Options, :OptionsMenu
Gui, Menu, MenuBar
Gui, show, AutoSize Center, Lyric Grabber
Return

;;;;;;;;;;;;;;;;Button Actions;;;;;;;;;;;;;

AboutFun:
Msgbox, Made using AutoHotKey script
Return

HelpFun:
Msgbox, Song and artist titles MUST be capitilized and spelled properly or you will not achieve proper results. Otherwise, the problem is most likely because Lyricwiki.org does not have the song in archive.
Return

Low:
WinSet, Transparent, 100, Lyric Grabber
Menu, transmenu, check, Low
Menu, transmenu, Uncheck, Medium
Menu, transmenu, Uncheck, Full
Return

Medium:
Winset, Transparent, 200, Lyric Grabber
Menu, transmenu, check, Medium
Menu, transmenu, Uncheck, Low
Menu, transmenu, Uncheck, Full
Return

Full:
Winset, Transparent, Off, Lyric Grabber
Menu, transmenu, check, Full
Menu, transmenu, Uncheck, Medium
Menu, transmenu, Uncheck, Low
Return

kot:
Winset, AlwaysOnTop, Toggle
Menu, OptionsMenu, togglecheck, Keep On Top
Return

ButtonCancel:
exitapp
Return


GuiEscape:
GuiClose:
{
  ExitApp
}
Return

ButtonSearch:
Gui, submit, NoHide
GuiControl, Text, Lyrics_edt
SB_SetText( "Procurando..." )
Sleep, 50


url= https://www.letras.mus.br/%Artist%/%Song%

wb := ComObjCreate("InternetExplorer.Application")
wb.Navigate(url)
wb.Visible := false
while wb.readyState!=4 || wb.document.readyState != "complete" || wb.busy
    sleep 10
try
{
Lyrics3:= wb.document.getElementsbyClassName("cnt-letra p402_premium")[0].innerText
}
catch e  ; Handles the first error/exception raised by the block above.
{
    MsgBox, An exception was thrown! check artist and song name
    return
}
SB_SetText( "Done." )
GuiControl,, Lyrics_edt, %Lyrics3%
wb.quit
return
meireles
Posts: 3
Joined: 25 Jun 2017, 03:02

Re: Music Lyric Grabber

18 Jan 2018, 15:02

Thank you for solving the problem.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 203 guests