Javascript 复制XREExeF并粘贴为文件快捷方式
在我的插件中,我通过以下方式启动Firefox配置文件:Javascript 复制XREExeF并粘贴为文件快捷方式,javascript,file,firefox-addon,desktop-shortcut,Javascript,File,Firefox Addon,Desktop Shortcut,在我的插件中,我通过以下方式启动Firefox配置文件: var exe = FileUtils.getFile('XREExeF', []); //this gives path to executable var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess); process.init(exe); var args = ['-P', profName, '-no-remote']; //-
var exe = FileUtils.getFile('XREExeF', []); //this gives path to executable
var process = Cc['@mozilla.org/process/util;1'].createInstance(Ci.nsIProcess);
process.init(exe);
var args = ['-P', profName, '-no-remote']; //-new-instance
if (url) {
args.push('about:home');
args.push(url);
}
process.run(false, args, args.length);
因此,这会添加命令行参数并启动它。然而,这导致了一些问题。用户想要锁定图标,它只需锁定另一个firefox.exe
。用户也会尝试更改图标
维基百科称所有操作系统都支持快捷方式:
所以我想复制XREExeF
并将其粘贴为快捷方式,然后向其中添加命令行参数
编辑:
感谢@nmaier,我现在知道没有跨操作系统的方法。您能告诉我操作系统的具体方法吗。不,没有跨平台的方法来创建快捷方式。事实上,甚至没有跨浏览器的快捷方式格式,正如您已经提到的那样。相反,每个平台使用自己的链接类型:
- 窗户:有时候
- *尼克斯:(符号)链接(
,man 3链接
,`man ln)man符号链接
- 某些*nix桌面环境:
- 其他*nix桌面环境:任何他们想要的,如果有的话
- 如何转换为ico:
- (基于)此主要要点还有一个取自MXR的processIcon函数
使用AppleScript here:显然是在Win7中,如果您使用命令行参数
-p“Profile Name here”-no remote
启动快捷方式,则无法右键单击以锁定它。所以这个想法已经过时了。但我仍在学习,我不知道如何制作如此感兴趣的快捷方式。有没有办法通过FF XPCOM per os制作快捷方式?还是必须转到js ctypes?我不知道有哪家XPCOM会为您创建这样的链接。对于*nix,我只需要支持桌面环境,因为firefox只支持带桌面的*nix?在mac中制作类似于.desktop
的文件有什么想法吗?
Cu.import('resource://gre/modules/FileUtils.jsm');
var exe = FileUtils.getFile('XREExeF', []);
var myShortcut = FileUtils.getFile('Desk', ['Mozilla Firef ya.lnk']);
var myShortcutWin = myShortcut.QueryInterface(Ci.nsILocalFileWin);
var myScIcon = new FileUtils.File('C:\\Users\\Noitidart\\Downloads\\amo-puzzle.ico'); //myScIcon must be converted to ico if it isnt an ico
myShortcutWin.setShortcut(exe, null, '-P "ya ya"', 'Launches Mozilla Firefox with "ya ya" Profile', myScIcon);