AS 和 FMPA 运行时构建失败

发布于 2024-09-12 05:56:45 字数 1421 浏览 4 评论 0原文

好吧,我有一个似乎没有得到答复。 我将跳过整个脚本

问题出在 TRY 上。由于它发生在 Finder 中,我正在尝试将一些信息传递回 FM。这作为 FM 脚本可以正常工作,但在运行时会失败。据我所知,唯一的解决方案是更改所有 Filemaker Pro Advanced 对运行时应用程序的引用,但我不能这样做,因为 FMPA 希望我向它展示该应用程序,当然它还没有构建!所以我想我可以构建运行时,然后编辑它的脚本来工作。但这似乎是一个时髦的解决方法。我尝试使用“me”,但我认为因为它是仍在 Finder 中运行的尝试的一部分,所以失败了。

-- script to copy files to PT directory 1/21/02

set copysounds to ""  
set thetarget to ""  
set x to ""  
set filename to ""  
tell application "FileMaker Pro Advanced"  
--activate  
 set recordCount to count of records  
end tell  
choose folder with prompt "Pick a destination folder"  
set thetarget to result  
repeat with x from 1 to recordCount  
tell application "FileMaker Pro Advanced"  
  set copysounds to cell "Find Path" of record x  
  set effectName to cell "Effect Name:" of record x  
  set filename to ((thetarget as text) & (cell "Effect Name:" of record x))  
  set cell "error flag" of record x to ""  
  set notFoundError to ""  
  set DupOK to ""  
  -- find out if file esists  
  tell application "Finder"  
   activate  
   try  
    alias copysounds  
   on error  
    set notFoundError to "true"  
    display dialog effectName & "  file was not found.  Check     Path." buttons {"OK"} default button 1 with icon stop  
   tell application "FileMaker Pro Advanced"  
     set cell "error flag" of record x to "Path Invalid"  
    end tell  
    --return  
   end try  

OK I have one that doesn't seem to be answered.
I'll past the whole script

The problem is with the TRY. Since it is happening in the Finder and I am trying to pass some info back to FM. THis works fine as a FM script but fails in the runtime. As far as I can tell the only solution would be to change all the Filemaker Pro Advanced references to the runtime app BUT I can't do that because FMPA wants me to show it the app and of course it isn't built yet! So I guess I could build the runtime and then edit IT'S scripts to work. But that seems like a funky workaround. I tried using "me" but I think because it's part of a try still running in the Finder it fails.

-- script to copy files to PT directory 1/21/02

set copysounds to ""  
set thetarget to ""  
set x to ""  
set filename to ""  
tell application "FileMaker Pro Advanced"  
--activate  
 set recordCount to count of records  
end tell  
choose folder with prompt "Pick a destination folder"  
set thetarget to result  
repeat with x from 1 to recordCount  
tell application "FileMaker Pro Advanced"  
  set copysounds to cell "Find Path" of record x  
  set effectName to cell "Effect Name:" of record x  
  set filename to ((thetarget as text) & (cell "Effect Name:" of record x))  
  set cell "error flag" of record x to ""  
  set notFoundError to ""  
  set DupOK to ""  
  -- find out if file esists  
  tell application "Finder"  
   activate  
   try  
    alias copysounds  
   on error  
    set notFoundError to "true"  
    display dialog effectName & "  file was not found.  Check     Path." buttons {"OK"} default button 1 with icon stop  
   tell application "FileMaker Pro Advanced"  
     set cell "error flag" of record x to "Path Invalid"  
    end tell  
    --return  
   end try  

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧城烟雨 2024-09-19 05:56:45

没有数据库的副本使我很难测试,但让我们从这里开始。你有很多东西不合适,所以我修复了你的代码,

试试这个

  -- script to copy files to PT directory 1/21/02

  set copysounds to ""
  set thetarget to ""
  set x to ""
  set filename to ""
  set thetarget to choose folder with prompt "Pick a destination folder"
  tell application "FileMaker Pro 10"
    set recordCount to count of records
    repeat with x from 1 to recordCount
        set copysounds to cell "Find Path" of record x
        set effectName to cell "Effect Name:" of record x
        set filename to ((thetarget as text) & (cell "Effect Name:" of record x))
        set cell "error flag" of record x to ""
        set notFoundError to ""
        set DupOK to ""
        try
            tell application "Finder" to alias copysounds
        on error
            set notFoundError to "true"
            display dialog effectName & "  file was not found.  Check     Path." buttons {"OK"} default button 1 with icon stop
            set cell "error flag" of record x to "Path Invalid"
        end try
    end repeat
  end tell

Not having a copy of the database makes it hard for me to test but lets start here. You have allot of things out of place so I fixed up your code

try this

  -- script to copy files to PT directory 1/21/02

  set copysounds to ""
  set thetarget to ""
  set x to ""
  set filename to ""
  set thetarget to choose folder with prompt "Pick a destination folder"
  tell application "FileMaker Pro 10"
    set recordCount to count of records
    repeat with x from 1 to recordCount
        set copysounds to cell "Find Path" of record x
        set effectName to cell "Effect Name:" of record x
        set filename to ((thetarget as text) & (cell "Effect Name:" of record x))
        set cell "error flag" of record x to ""
        set notFoundError to ""
        set DupOK to ""
        try
            tell application "Finder" to alias copysounds
        on error
            set notFoundError to "true"
            display dialog effectName & "  file was not found.  Check     Path." buttons {"OK"} default button 1 with icon stop
            set cell "error flag" of record x to "Path Invalid"
        end try
    end repeat
  end tell
牵你手 2024-09-19 05:56:45

更新:请原谅一个简单的问题,但是当您将脚本作为应用程序或其他方式运行时,您是否打开了数据库。我在 Applescript 中得到相同的“未找到对象”错误的唯一方法是如果我没有打开数据库。请参阅下面的示例...

tell application "FileMaker Pro"
    set theRecords to records --> if a database isn't open in Filemaker, this gets an "object not found" error.
    return theRecords --> if a database is open, a list of records is returned.

结束告诉

我不禁认为这里遗漏了比运行时更基本的东西。


据我所知,唯一的解决方案是更改所有 Filemaker Pro Advanced 对运行时应用程序的引用,但我不能这样做,因为 FMPA 希望我向其展示该应用程序,当然它并未构建然而!所以我想我可以构建运行时,然后编辑它的脚本来工作。但这似乎是一个时髦的解决方法。

您可以将脚本另存为应用程序并保存,以便您可以在脚本编辑器应用程序中对其进行编辑。我以前已经做过很多次了。为了进行调试,您可以写入文件并在脚本完成其操作后读取该文件,而不是转到活动查看器。它很时髦,但对于 Applescript 来说却并不不同寻常。

我尝试使用“me”,但我认为因为它是仍在 Finder 中运行的尝试的一部分,所以失败了。

mcgrailm 的代码更加简洁,但在我看来,无论您是否使用 me,您仍然会在 try 上收到错误;如果路径每次都不正确,则尝试获取文件的别名将返回错误。如果错误在这里......

 try
    tell application "Finder" to alias copysounds
 on error

那么您需要调查值copysounds以及该值是如何生成的。我同意 mcgrailm 的观点,即来自 FM DB 的示例数据在这里非常有用,并且您从尝试中得到的确切错误也将非常有用。像这样的东西将有助于捕捉......

try
    -- insert actions here
on error the error_message number the error_number
    -- do something with the strings error_message and error_number
end try

UPDATE: Pardon a simple question, but do you have the database open when you run the script as an application or otherwise. The only way I can get the same "object not found" error in Applescript is if I don't have database open. See the following example...

tell application "FileMaker Pro"
    set theRecords to records --> if a database isn't open in Filemaker, this gets an "object not found" error.
    return theRecords --> if a database is open, a list of records is returned.

end tell

I can't help but think that something more fundamental than runtimes is being missed here.


As far as I can tell the only solution would be to change all the Filemaker Pro Advanced references to the runtime app BUT I can't do that because FMPA wants me to show it the app and of course it isn't built yet! So I guess I could build the runtime and then edit IT'S scripts to work. But that seems like a funky workaround.

You can save the script as an application and save it so that you can edit it in the Script Editor application. I've done this numerous times before. For debugging, instead of going to the activity viewer, you can write to a file instead and read that when the script is done doing its thing. It's funky but not out of the ordinary for Applescript.

I tried using "me" but I think because it's part of a try still running in the Finder it fails.

mcgrailm's code is much cleaner, but it seems to me you're still going to get an error on the try regardless if you use me or not; trying to get the alias of a file will return an error if the path is incorrect every single time. If the error is here...

 try
    tell application "Finder" to alias copysounds
 on error

...then you need to investigate the value copysounds and how that value is generated. I agree with mcgrailm that sample data from your FM DB would be really helpful here, and so would the exact errors you are getting from the try. Something like this will help capture that...

try
    -- insert actions here
on error the error_message number the error_number
    -- do something with the strings error_message and error_number
end try
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文