Feature Request: Poll a text file

Discussion forum for G-Force users

Moderators: BTT, andy55, b.dwall, juxtiphi

Post Reply
J-Walk
Posts: 4
Joined: Sat Oct 16, 2010 8:18 pm
Location: United States

Feature Request: Poll a text file

Post by J-Walk »

I just bought the Platinum edition because of the standalone player. I'm impressed.

I use it to provide visuals for a customized embedded Windows Media Player app I use in my home theater. See: http://j-walk.com/mp/

As with most 3rd-party visualizations, G-Force doesn't work with embedded WMP. But that's OK. I've got it set up so it works fine. I just have both apps running full screen, and switch between them with Alt-Tab. But it would be nice to see the artist/track/album info in the G-Force display.

My feature request is have the software open a text file (stored at a known location) and display the information found in the file. G-Force could poll this file every few seconds, and if the file has changed, then update the display with the new text. It could be an XML file (to handle artist, track and album info), or just a plain text file.

I'm not much of a programmer, but it seems do-able. Is it?

J-Walk
Posts: 4
Joined: Sat Oct 16, 2010 8:18 pm
Location: United States

Post by J-Walk »

I've made some progress. My software now writes a file named CTRL 1.txt, every time the track changes. This file has the commands to display the track info as a test overlay. For example, here's the file contents after a Dylan song started playing:

Code: Select all

StartTextOverlay("Bob Dylan","Arial", 95, 0, 3, 2, .5, .6,  -1 );
StartTextOverlay("\"The Boxer\"","Arial", 80, 0, 3, 2, .5, .74, -1 );
StartTextOverlay("Self Portrait","Arial", 65,	0, 3, 2, .5, .82,  -1 );
PurgeFileCache();
I can press Ctrl+1 to see the track info when using standalone mode. Works great, but it would still be nice to have G-Force recognize when a file has changed.

J-Walk
Posts: 4
Joined: Sat Oct 16, 2010 8:18 pm
Location: United States

Post by J-Walk »

OK, everything is working smoothly, thanks to Auto Hotkey.

http://www.autohotkey.com/

I'm now able to control my music player when G-Force is running standalone: Next, Previous, Pause/Play. And it displays track info overlay when the track changes -- something that seems impossible unless you resort to some trickery.

So that's probably the last you'll hear of me.

jerohm
Senior Member
Posts: 421
Joined: Fri Jan 09, 2009 5:19 pm

Post by jerohm »

This is a WINDOWS only solution ... Sorry for not a more timely reply ... busy on something else...

Okay ... this deserves its own post, just because it took me so ridiculously long to figure out. I found the answer in a couple of minutes, but refused to believe that there wasn't a simpler soluton to a problem that MANY others must have crossed over the years. This actual procedure was easy; hiding the stupid cmd.exe window proved to be next to impossible. This solution ASSUMES your system has no problems executing a *.vbs file.

Externally created (per song change) "\Program Files\SoundSpectrum\G-Force\Scripts\song.txt":

Code: Select all

StartTextOverlay("Bob Dylan","Arial", 95, 0, 3, 2, .5, .6,  -1 ); 
StartTextOverlay("\"The Boxer\"","Arial", 80, 0, 3, 2, .5, .74, -1 ); 
StartTextOverlay("Self Portrait","Arial", 65,   0, 3, 2, .5, .82,  -1 ); 
Create "\Program Files\SoundSpectrum\G-Force\Scripts\dspd_song.vbs":

Code: Select all

Set WshShell = CreateObject("WScript.Shell") 
WSHShell.Run chr(34) & "Scripts\dspd_song.cmd" & chr(34) & " /silent",0,true
Set WshShell = Nothing
Create "\Program Files\SoundSpectrum\G-Force\Scripts\dspd_song.cmd":

Code: Select all

del "Scripts\CTRL 1.txt"
ren Scripts\song.txt "CTRL 1.txt"
Create "\Program Files\SoundSpectrum\G-Force\Scripts\poll.txt":

Code: Select all

0:00

if( Run( "song.txt", 1, 1 ) == 0)
{
	Open("Scripts\\dspd_song.vbs");
}
PurgeFileCache();


0:15
Run( "poll.txt" );
Edit (append to) "\Program Files\SoundSpectrum\G-Force\Scripts\Startup.txt":

Code: Select all

 :
 :
Run( "logo.txt" );
Run( "poll.txt" );  // THIS line (... do'h!)

Once again, I did this in the spirit of the original post ... The names can be changed to protect the innocent.
(God, I HATE trying to edit in this itty bitty window!)
Last edited by jerohm on Sat Oct 23, 2010 6:57 am, edited 1 time in total.

J-Walk
Posts: 4
Joined: Sat Oct 16, 2010 8:18 pm
Location: United States

Post by J-Walk »

Thanks a lot jerohm, but my AutoHotKey solution is now working perfectly. It does everything I want, and is a LOT simpler.

BTW, if you use Chrome, you can resize that itty bitty window by dragging the resizer control in the lower right corner.

Post Reply