Kept trying to look at php code using run "Launch in Firefox" or "Launch in Chrome" or … and was annoyed that it didn't run a php interpreter on it. I created a script to help
c:\helpers\wrapper.vbs
'expects argument of form <browser>;<file_location>dimdatadimurldata=Split(WScript.Arguments(0),";")url=data(1)'if the file name ends in php replace c:\apache24\htdocs\ with 127.0.0.1 and replace all \ with /url=replace_directory("php","c:\apache24\htdocs\","127.0.0.1",url)'if the file name ends in php replace <network drive letter>:<path to root of web server> with <web server address> and replace all \ with /url=replace_directory("php","f:\var\www\html\","myserver",url)CreateObject("Wscript.Shell").Rundata(0)+" """+url+""""'if the file name ends in <extension> replace <directory> with <url> and replace all \ with / otherwise return data unmodifiedFunction replace_directory(extension,directory,url,data) If StrComp(LCase(Mid(data,Len(data)-(Len(extension)-1))),extension) = 0 Then If StrComp(LCase(Mid(data,1,Len(directory))),directory) = 0 Then replace_directory="http"+"://"+url+"/"+Replace(Mid(data,Len(directory)+1),"\","/") Else replace_directory=data End If Else replace_directory=data End IfEnd Function
then I edited his shortcuts.xml file to be as follows
%APPDATA%\Notepad++\shortcuts.xml
<Commandname="Launch in Firefox"Ctrl="yes"Alt="yes"Shift="yes"Key="70">wscript"c:\helpers\wrapper.vbs""firefox;$(FULL_CURRENT_PATH)"</Command><Commandname="Launch in IE"Ctrl="yes"Alt="yes"Shift="yes"Key="73">wscript"c:\helpers\wrapper.vbs""iexplore;$(FULL_CURRENT_PATH)"</Command><Commandname="Launch in Chrome"Ctrl="yes"Alt="yes"Shift="yes"Key="82">wscript"c:\helpers\wrapper.vbs""chrome;$(FULL_CURRENT_PATH)"</Command><Commandname="Launch in Safari"Ctrl="yes"Alt="yes"Shift="yes"Key="88">wscript"c:\helpers\wrapper.vbs""safari;$(FULL_CURRENT_PATH)"</Command>
My code could just as easily be used with perl or asp pages or anything.
I'd post the entire shortcuts file but this form doesn't allow anything with proper urls
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Wow that copies horribly. Sourceforge needs work on its forums.
let me try quotes instead of code and see if copying works any better
c:\helpers\wrapper.vbs
'expects argument of form <browser>;<file_location>
dim data
dim url
data=Split(WScript.Arguments(0),";")
url=data(1)
'if the file name ends in php replace c:\apache24\htdocs\ with 127.0.0.1 and replace all \ with /
url=replace_directory("php","c:\apache24\htdocs\","127.0.0.1",url)
'if the file name ends in php replace <network drive letter>:<path to root of web server> with <web server address> and replace all \ with /
url=replace_directory("php","f:\var\www\html\","www.mvdwebexpress.com",url)
CreateObject("Wscript.Shell").Run data(0)+" """+url+""""
'if the file name ends in <extension> replace <directory> with <url> and replace all \ with / otherwise return data unmodified
Function replace_directory(extension,directory,url,data)
If StrComp(LCase(Mid(data,Len(data)-(Len(extension)-1))),extension) = 0 Then
If StrComp(LCase(Mid(data,1,Len(directory))),directory) = 0 Then
replace_directory="http"+"://"+url+"/"+Replace(Mid(data,Len(directory)+1),"\","/")
Else
replace_directory=data
End If
Else
replace_directory=data
End If
End Function
replacement code for
%APPDATA%\Notepad++\shortcuts.xml
<Command name="Launch in Firefox" Ctrl="yes" Alt="yes" Shift="yes" Key="70">wscript "c:\helpers\wrapper.vbs" "firefox;$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in IE" Ctrl="yes" Alt="yes" Shift="yes" Key="73">wscript "c:\helpers\wrapper.vbs" "iexplore;$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in Chrome" Ctrl="yes" Alt="yes" Shift="yes" Key="82">wscript "c:\helpers\wrapper.vbs" "chrome;$(FULL_CURRENT_PATH)"</Command>
<Command name="Launch in Safari" Ctrl="yes" Alt="yes" Shift="yes" Key="88">wscript "c:\helpers\wrapper.vbs" "safari;$(FULL_CURRENT_PATH)"</Command>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Kept trying to look at php code using run "Launch in Firefox" or "Launch in Chrome" or … and was annoyed that it didn't run a php interpreter on it. I created a script to help
c:\helpers\wrapper.vbs
then I edited his shortcuts.xml file to be as follows
%APPDATA%\Notepad++\shortcuts.xml
My code could just as easily be used with perl or asp pages or anything.
I'd post the entire shortcuts file but this form doesn't allow anything with proper urls
Wow that copies horribly. Sourceforge needs work on its forums.
let me try quotes instead of code and see if copying works any better
c:\helpers\wrapper.vbs
dim data
dim url
data=Split(WScript.Arguments(0),";")
url=data(1)
'if the file name ends in php replace c:\apache24\htdocs\ with 127.0.0.1 and replace all \ with /
url=replace_directory("php","c:\apache24\htdocs\","127.0.0.1",url)
'if the file name ends in php replace <network drive letter>:<path to root of web server> with <web server address> and replace all \ with /
url=replace_directory("php","f:\var\www\html\","www.mvdwebexpress.com",url)
CreateObject("Wscript.Shell").Run data(0)+" """+url+""""
'if the file name ends in <extension> replace <directory> with <url> and replace all \ with / otherwise return data unmodified
Function replace_directory(extension,directory,url,data)
If StrComp(LCase(Mid(data,Len(data)-(Len(extension)-1))),extension) = 0 Then
If StrComp(LCase(Mid(data,1,Len(directory))),directory) = 0 Then
replace_directory="http"+"://"+url+"/"+Replace(Mid(data,Len(directory)+1),"\","/")
Else
replace_directory=data
End If
Else
replace_directory=data
End If
End Function
replacement code for
%APPDATA%\Notepad++\shortcuts.xml
how can I paste code on sourceforge so that you can copy the return characters?