Well, it was quite challenging, but after one evening I made it!
In button fileld must be:
Find_Subtitles.vbs {file$|noext}
You also must specify where the VBScrip file is saved (in 'Start in' field)
[code]option explicit
Dim Args
Dim Pos
Dim Name
Dim CutName
Dim UrlToLaunch
Dim Shell
Dim regex
Set Args = WScript.Arguments
Set Shell = CreateObject("WScript.Shell")
Set regex = new RegExp
'Ignore Case-sensitive matching
regex.IgnoreCase = true
'All matches will be replaced, not just the first match
regex.Global = true
'Get 1st argument after script name: {file$|noext}
Name = Args.Item(0)
'Spaces are replaced by %20
regex.Pattern = " "
Name = regex.Replace(Name, "%20")
'Name of movie is cut off from its left part
'- 3 means %20 after dash
Pos = Len(Name) - InStr(Name,"-") - 3
CutName = Right(Name, Pos)
'Name of movie is cut off from its right part
if InStr (1, CutName,"(", 0) <> 0 Then
Pos = InStr(CutName,"(") - 4
CutName = Left(CutName, Pos)
elseif Instr (1, CutName,"[", 0) <> 0 Then
Pos = InStr(CutName,"[") - 4
CutName = Left(CutName, Pos)
elseif Instr (1, CutName,".", 0) <> 0 Then
Pos = InStr(CutName,".") - 1
CutName = Left(CutName, Pos)
end if
UrlToLaunch = "http://www.opensubtitles.com/cs/search2/sublanguageid-slo,cze,eng/moviename-" + CutName
Shell.Run UrlToLaunch[/code]
I must also thank to searcher123. His script helped me a lot:
[url]A question about rename scripting and RegEx]
Find_Subtitles.rar (662 Bytes)