Dantist Posted March 12, 2006 Share Posted March 12, 2006 Ok. Just like IE in Windows Does $) In our lan there are sevaral searh engines, that give such links as a result. It's quite annoying to copy link, then switch to finder, then paste it etc sereral times an hour... In windows it's possible to open such links from opera/firefox with total commander. It's using java script as a template or something like this. Actually i've never used java script and it's not reallyclear for me how it works. And it's not clear, howto implement the same thing in OsX. Here are the solutions for Windows: For FireFox: add file tc.js в chrome/browser.jar/content/browser code: function OpenTotalcommander(link) { var href = link; var targetFile = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile); targetFile.initWithPath('C:\\Program Files\\totalcmd\\TOTALCMD.EXE'); var process = Components.classes['@mozilla.org/process/util;1'].getService(Components.interfaces.nsIProcess); process.init(targetFile); var arguments= [] ; href = href.replace("file://", "\\\\"); href = replaceAll(href, "/", "\\"); href = replaceAll(href, "%20", " "); var cmd = "/L=%1"; cmd = cmd.replace("%1", href); arguments.push("/O"); arguments.push(cmd); process.run(false, arguments, arguments.length,{}); return true; } function replaceAll(text, pattern, str) { for (var text1 = ""; text1 != text;) { text1 = text; text = text.replace(pattern, str); } return text; } add to file chrome/browser.jar/content/browser/browser.xul near the bunch of alike strings the folowing one: code: <script type="application/x-javascript" src="chrome://browser/content/tc.js"/> th the same file (chrome/browser.jar/content/browser/browser.xul) after these strings <menuitem id="context-savelink" ... <menuitem id="context-copylink" ... add the folowing code: <menuitem id="context-openlink-in-tc" label="Open Link in TC" oncommand="OpenTotalcommander(gContextMenu.linkURL())"/> That's all about firefox. In Opera it all looks almost the same, but probably poisoned by ActiveX: We need to create the file "TC_from_Opera.js" in some secure place, where "totalcmd" is the path to TotalCommander; code: var href = WScript.Arguments(0); var totalcmd = "\"c:\\Program Files\\totalcmd\\TOTALCMD.EXE\""; var shell = new ActiveXObject("WScript.Shell"); if (href.indexOf("file://")==0) { href = href.replace("file://", "\\\\"); href = replaceAll(href, "/", "\\"); href = replaceAll(href, "%20", " "); var cmd = totalcmd + " /O \"/L=%1\""; cmd = cmd.replace("%1", href); shell.Exec(cmd); } function replaceAll(text, pattern, str) { for (var text1 = ""; text1 != text;) { text1 = text; text = text.replace(pattern, str); } return text; } to file "\Program Files\Opera\defaults\standard_menu.ini" to section [Link Popup Menu] we need add the string: code: Item, "Open in Total Commander" = Execute program, "c:\SafePlace\TC_from_Opera.js","%l" Attention: Path in var totalCmd shall be given with double slashes Path in file standart_menu.ini - with single There's also variant like IEView in firefox - in opera that could be done by inserting in ../profile/menu something like that: [Link Popup Menu] & [image Link Popup Menu] Item, IExplorer"="Execute program, "iexplore", "%l", "IExplorer", "IE Start"" можешь и в [Hotclick Popup Menu] Item, IExplorer"="Execute program, "iexplore", "%t", "IExplorer", "IE Start"" But just replacing Ie with finder didnt work How do i mount&open smb/cifs share from commandline? it would be great also to open shared document with default prog... The main problem is that finder doesnt understand 1) Command to open smb link (it can probably mount share with some args, but i don't know how 2)Even if we mount share - there's still a problem - finder mounts only "upper level" shares. I.e if i have a link like smb://OsX/something/something/file.avi. then to open that file in QTPlayer one needs a)mount smb://Osx Cd to /Volumes/OsX/something/something/ c) open file.avi. if there's no file in link - only a folder, then one needs only cd %) I'm not a programmer in anything exept Pascal (a little bit in school , but i easily managed to make an automator workflow, which did almost the same - i just select link in safary, then parse current selection, mount share via Finder Action in automator, then Cd/Open with bash. But it's not very useful - select, swith to finder, select automator plugin- there's no less actions, than just do it all by hands... Anyways i think it can be done and it shall be done - because many many people meet smb (or file://) links every day. And Finder doesn't seem to handle em good. Any help appreciated, i'll continue to experiment and will post results here But if noone'll help it can take alot of time Link to comment https://www.insanelymac.com/forum/topic/11813-smb-links-in-osx/ Share on other sites More sharing options...
Recommended Posts