Samurize Scripts

Soldato
OP
Joined
18 Oct 2002
Posts
18,175
Location
Santa Barbara, Californee
The UKTV.vbs files etc are actually incredibly easy to modify to your own needs,

All you need is to find a page that has the Sky listings in a table, and simply change a few setting, so the vbs file parses the info into a text file.

Samurize simply reads from the text file so it shouldnt be that hard to change.
 
Associate
Joined
18 Oct 2002
Posts
1,591
Location
Farnborough, UK
Originally posted by Rich_L
The UKTV.vbs files etc are actually incredibly easy to modify to your own needs,

All you need is to find a page that has the Sky listings in a table, and simply change a few setting, so the vbs file parses the info into a text file.

Samurize simply reads from the text file so it shouldnt be that hard to change.
Well, I modified the coolmon script so it output a file the same as used by the UKTV Samurize script. The new script is here.

The output looks like this:

Code:
ITV2
14:30 Chart Choice
14:40 Emmerdale
BBC Three
03:50 Close
19:00 Liquid News
Sky 1
14:00 Star Trek: The Next Generation
15:00 Star Trek: The Next Generation

The script just needs made into a function so that Samurize can be set to refresh it every 5, 10, whatever minutes. I'm not sure how to do that as just adding "Function Name" "[script]" "End Function" didn't work. :) If anyone can do this, please do!

Andy.
 
Associate
Joined
18 Oct 2002
Posts
1,591
Location
Farnborough, UK
Originally posted by MTA99
Could you run the script as a schuled task (in windows) then use the textfile function to get the corrcet lines from the file?
Yeah, it could be done that way now you mention it. It's a nice tempory measure, but getting the code into a function would be nicer so you can just set "Run every X mins" in Samurize.
 
Associate
Joined
18 Oct 2002
Posts
1,591
Location
Farnborough, UK
Originally posted by Rich_L
Andy, so close...

Just add Function Name () to the start and End Function to the end.
Tried that as well as various combinations...

Code:
Function GetLists ()
End Function

Function ()
End Function

Function GetLists ()
....
   For Each Match in Matches
      GetLists = Match.Submatches(0) etc.
      outFile.write GetLists
....
End Function

Samurize will see the fuction, but the script doesn't do anything :/
 
Soldato
OP
Joined
18 Oct 2002
Posts
18,175
Location
Santa Barbara, Californee
Hi,

Hmm thats odd, seems to be working here,

Though I changed your

Const Path = "..\UK_TV.txt"

to

Const Path = "UK_TV.txt"

The UK_TV.txt file is generated in the Samurize base directory, if I have the script in the scripts folder.

Code:
Function UKTV()

Const Separator = " " 
Const Path = "UK_TV.txt" 

set http = createobject("microsoft.xmlhttp") 
Http.open "GET","http://www.teletext.co.uk/tvplus/nownext.asp?High=3", false 
Http.send 
strng = Http.responsetext 
Dim regEx 
Set regEx = New RegExp 
regEx.Global = True 


regEx.Pattern = "<TD WIDTH=75><FONT SIZE=""-2""><A HREF="".*?"" style="".*?"">(.*?)</a>&nbsp;</FONT></TD>" & _ 
         "\s+<TD WIDTH=35><.*?>(.*?)&nbsp;</FONT></TD>" & _ 
         "\s+<TD WIDTH=150><.*?>(.*?)&nbsp;</FONT></TD>" & _ 
         "\s+<TD WIDTH=35><.*?>(.*?)&nbsp;</FONT></TD>" & _ 
         "\s+<TD WIDTH=155><.*?>(.*?)&nbsp;</FONT></TD>" & _ 
         "\s+</TR>" 


Set Matches = regEx.Execute(strng)


Set fs = CreateObject("Scripting.FileSystemObject") 
Set outFile = fs.CreateTextFile(Path, True) 


For Each Match in Matches
     outfile.write match.SubMatches(0) & VbNewLine & match.SubMatches(1) & Separator & match.SubMatches(2) & VbNewLine & match.SubMatches(3) & Separator & match.SubMatches(4) 
   outFile.WriteLine 

Next 

outFile.close 

End Function

Looks like that ^^^
 
Soldato
OP
Joined
18 Oct 2002
Posts
18,175
Location
Santa Barbara, Californee
hehe nice...

Never really occurred to me that all the Coolmon scripts are very easily interchangable, there seems to be a lot more support for coolmon scripts, so samurize has just got a whole lot more versatile for me :)
 
Associate
Joined
18 Oct 2002
Posts
1,591
Location
Farnborough, UK
There's still a problem though. We need some way of only getting data for the channels we want as it appears Samurize cannot read files longer than 40 lines. So, using the file our new script generates, we can't display say E4 as you cant specify lines 52, 53 and 54.

I guess it's time to try and add bits from the original Samurize script where it looks for channel names. :rolleyes:
 
Associate
Joined
18 Oct 2002
Posts
1,591
Location
Farnborough, UK
That was pretty simple, just change the script so that it reads like this:-

Code:
For Each Match in Matches

	If match.SubMatches(0) = "BBC 1" Then
		outfile.write match.SubMatches(0) & VbNewLine & match.SubMatches(1) & Separator & match.SubMatches(2) & VbNewLine & match.SubMatches(3) & Separator & match.SubMatches(4) 
   		outFile.WriteLine
   	End If
   	
	If match.SubMatches(0) = "ITV 1" Then
		outfile.write match.SubMatches(0) & VbNewLine & match.SubMatches(1) & Separator & match.SubMatches(2) & VbNewLine & match.SubMatches(3) & Separator & match.SubMatches(4) 
   		outFile.WriteLine
   	End If
   	
	If match.SubMatches(0) = "Sky 1" Then
		outfile.write match.SubMatches(0) & VbNewLine & match.SubMatches(1) & Separator & match.SubMatches(2) & VbNewLine & match.SubMatches(3) & Separator & match.SubMatches(4) 
   		outFile.WriteLine
   	End If
   	
	If match.SubMatches(0) = "E4" Then
		outfile.write match.SubMatches(0) & VbNewLine & match.SubMatches(1) & Separator & match.SubMatches(2) & VbNewLine & match.SubMatches(3) & Separator & match.SubMatches(4) 
   		outFile.WriteLine
   	End If

Next

... and so on for each channel you want.
 
Last edited:
Back
Top Bottom