Nowplaying.dll to TXT

Discuss the use of Lua in Script measures.

Nowplaying.dll to TXT

August 11th, 2017, 11:45 am
Kobayen
   [3 posts]

I wanted to know if anyone has ever written a script that takes the result string from NowPlaying.dll and send it to a txt file (so it can be captured and used by OBS). And if nobody had, how would one even start getting to do that?

I'm pretty sure this would involve scripting because of the file-writing part of the equation.

Re: Nowplaying.dll to TXT

August 11th, 2017, 3:48 pm
dvo
   [353 posts]

why don't you use screen capture ? then you have your things already in place :D
or try this.... https://sourceforge.net/projects/obsmusicstreamd/

Re: Nowplaying.dll to TXT

August 11th, 2017, 5:32 pm
Kobayen
   [3 posts]

Window Capture needs to be set up every single time beforehand for a Photoshop stream, and Screen Capture assumes a given object will be drawn into the screen in a visible position at all times.

SMG stopped working for WinAMP for a while now, and newer versions where that bug is corrected are paid. 8 euro is quite an amount of cash in third-world-currency.

Re: Nowplaying.dll to TXT

August 11th, 2017, 5:50 pm
dvo
   [353 posts]

i can try to make something that does that but i'm a beginner so i have to try a lot to get it right some script i can handle... :D
but could winamp not write the info some how ... have to look in to that to maybe the better way :D

otherway :https://sourceforge.net/p/streamripper/discussion/19083/thread/b20cf24f/
and winamp is in restyle so all is gone searching the web could help :oops:

or this :P

http://brandon.fuller.name/archives/2007/01/21/17.15.20/#download :bow: :rolmfao:
this outputs with nowplaying plugin installed a xml (this didn't work with mine )

C:\Program Files (x86)\Winamp\Plugins\Now Playing\now_playing.xml :rolmfao: :great: :welcome:

Re: Nowplaying.dll to TXT

August 11th, 2017, 7:21 pm
Kobayen
   [3 posts]

In the end, you solved my problem but not Quite the way I expected! :D Fuller's NowPlaying doesnt work for OBS (for a variety of reasons) but googling its name directed me to AMIP ( http://amip.tools-for.net/wiki/start ) -- which does have an option to output things to a text file the way OBS can actually use!

So, thanks for saving us both alot of needless work and worry. And 8 Euro. :bow:

Re: Nowplaying.dll to TXT

August 12th, 2017, 2:12 pm
dvo
   [353 posts]

your welome :) :D

Re: Nowplaying.dll to TXT

August 13th, 2017, 1:38 am
FlyingHyrax
   [251 posts]

I see your problem is already solved, but just for future reference in case someone searches their way upon this thread - I do think this is doable with Lua.

Here's a quick and dirty script that takes the string value from a measure and appends it to a file:

Code: Select all

function Initialize()
    measureToSave = SKIN:GetMeasure(SELF:GetOption('MeasureToSave'))
    writeOnUpdate = SELF:GetNumberOption('WriteOnUpdate') == 1
    logFilePath = SKIN:MakePathAbsolute(SELF:GetOption('FileToWrite', 'default_log.txt'))
end

function Update()
    if writeOnUpdate then
        WriteMeasureValue()
    end
end

function WriteMeasureValue()
    local strVal = measureToSave:GetStringValue()
    local theFile = io.open(logFilePath, 'a')
    theFile:write(strVal .. "\n")
    theFile:close()
end



...and here is a corresponding skin that uses that script to write the current track name any time the track changes with the NowPlaying plugin:

Code: Select all

[Rainmeter]
Update=1000
MiddleMouseUpAction=[!Refresh]

[measureTrackname]
Measure=Plugin
Plugin=NowPlaying
PlayerName=CAD
PlayerType=Title
TrackChangeAction=[!CommandMeasure "measureWriteToFile" "WriteMeasureValue()"]

[measureWriteToFile]
Measure=Script
ScriptFile=.\save_measure_value.lua
MeasureToSave="measureTrackname"
FileToWrite="log.txt"
WriteOnUpdate=0

[meterTrackname]
Meter=String
MeasureName=measureTrackname
X=0
Y=0
W=200
H=25
SolidColor=0,0,0,100
FontSize=12
FontColor=255,255,255
ClipString=1
AntiAlias=1



The script could pretty easily be extended and cleaned up to add more flexibility, like writing the number value instead of the string value, writing to the top instead of the bottom of the text file, adding a prefix or suffix around the string written to the log, etc.

Return to “Lua Scripting”



Who is online

Users browsing this forum: No registered users and 1 guest