code标志捆绑的应用程序与osacompile制成 [英] Code sign bundled app made with osacompile

查看:188
本文介绍了code标志捆绑的应用程序与osacompile制成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编程我想达致这在Mac OS X:文件在桌面上点击即会启动Firefox具有一定的配置文件时

Programmatically I trying to acheive this on Mac OS X: a file on desktop that when clicked will launch firefox with a certain profile.

我这样做与的AppleScript和bash。

I do this with AppleScript and bash.


  1. 打开脚本编辑器

  2. 写一些AppleScript的(做shell脚本/Applications/Firefox.app/Contents/MacOS/firefox -ProfileManager&放大器;>的/ dev / null的&安培;

  3. 保存新的AppleScript>另存为>应用程序捆绑

  4. 设置图标

此手动工作完全正常它遵循本教程: Asa Dotzler向您博客的Firefox快捷

This works perfectly fine manually it follows this tutorial: Asa Dotzler Blog Firefox Shortcut

不过编程我有一些问题。

However programatically I'm having some problems.

我成功地使文件,并把它放在桌面上使用 /斌/庆典/ osacompile -

I succesfully make the file and put it on desktop with /bin/bash/osacompile -.


  1. Progrmatcic第1步 - 创建一个桌面上的code进行script.txt文件

  1. Progrmatcic Step 1 - create a script.txt file with the code on desktop

var path_src = OS.Path.join(
    OS.Constants.Path.desktopDir,
    'script.txt'
);
var path_exe = FileUtils.getFile('XREExeF', []).path;
var write_file = OS.File.writeAtomic(
    path_src,
    'do shell script "' + path_exe + ' -P -no-remote &> /dev/null &"'
);


  • 编译.TXT名为.app来并把它放在桌面上code:

  • Compile the .txt to .app and put it on desktop code:

    var path_compile = OS.Path.join(OS.Constants.Path.desktopDir,'script.app');
    var osacompile = File.initWithPath("/usr/bin/osacompile");
    if (MacVersion <= 10.6) {
        osacompile.arguments = ["-o", path_compile, path_src]
    } else {
        //for >= 10.7
        osacompile.arguments = [
            "-t",
            "osas",
            "-c",
            "ToyS",
            "-o",
            path_compile,
            path_src
        ]
    }
    osacompile.run();
    


  • 但是,当用户点击它,他们得到这个错误:脚本不能打开,因为它是从一个身份不明的开发商。
    IMG:

    But when user clicks its they get this error: ""script" can't be opened because it is from an unidentified developer." img:

    我听说,也许这可能是code签名吗?能否请你帮我code签署,这样我就可以绕过这个错误,并开始设置图标的工作。

    I heard maybe this can be code signed? Can you please help me to code sign it so I can bypass this error and start working on setting icon.

    推荐答案

    一个简单的谷歌搜索的AppleScript code标志变成了大量的信息。

    A simple google search for "applescript code sign" turns up lots of info.

    另一种选择:如果code是在计算机上运行,​​你可以只关闭系统preference导致此。转到安全性与;与隐私>常规,选择勾选允许的应用程序从任何地方下载。当然意识到,这将做什么它说,所以这是一个可能的安全问题。我跑我的电脑这种方式,但你可能会觉得有所不同。

    Another option: if the code is to run on your computer you can just turn off the system preference that causes this. Go to Security & Privacy->General and choose the checkbox "allow apps downloaded from anywhere". Of course realize that this will do exactly what it says so it's a possible security issue. I run my computer this way but you may feel differently.

    因此​​,无论方法将解决您的问题。祝你好运。

    So either method will solve your issue. Good luck.

    这篇关于code标志捆绑的应用程序与osacompile制成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆