首页 文章

如何动态定位不同的FileMaker应用程序

提问于
浏览
0

我正在编写一个系统范围的服务,它接受当前选定的文本,并在我们的内部FileMaker数据库中进行各种搜索 .

我写了一些在我的开发机器上工作正常的东西,其中FileMaker存在为“FileMaker Pro Advanced” . 现在我无法让它在安装了非开发人员版FileMaker(“FileMaker Pro”)的其他机器上运行 .

问题是,当脚本在其中一台客户端计算机上运行时,我会得到“Where is foo " dialog (I'd say) because of the " using terms”这一行,我不希望这样 . 是否可以将FileMaker作为目标,以便我可以编译我的脚本并在我的客户端上运行它?

这是我现在拥有的:

on run {input, parameters}
    set _target to null

    try
        tell application "Finder" to get name of application "FileMaker Pro Advanced"

        set _target to application "FileMaker Pro Advanced"
    end try
    if _target is null then
        try
            tell application "Finder" to get name of application "FileMaker Pro"

            set _target to application "FileMaker Pro"
        end try
    end if
    if _target is null then
        display alert "FileMaker cannot be found"
        return
    end if

    using terms of "FileMaker Pro Advanced"
        tell _target
            -- script goes here
        end tell
    end using terms of
end run

2 回答

  • -1

    如果您希望最终用户安装FileMaker在标准位置,则以下内容应该有效:

    set _fmpa to "/Applications/FileMaker/FileMaker Pro Advanced.app"
    set _fmp to "/Applications/FileMaker/FileMaker Pro.app"
    
    try
        tell application _fmpa to launch
        set _target to _fmpa
    end try
    
    try
        tell application _fmp to launch
        set _target to _fmp
    end try
    
    tell application _target
        ...
    end tell
    
  • 1

    这样一个简单的初始测试怎么样:

    try
      if exists application "FileMaker Pro Advanced" then
        set _target to "FileMaker Pro Advanced"
      else if exists application "FileMaker Pro" then
        set _target to "FileMaker Pro"
      else
        <handle error>
      end if
    end try
    

相关问题