Odd FileMaker/ProgressBar behavior

I have a script that is showing odd behavior that maybe someone could help me with. It is a script that controls FileMaker Pro and uses ProgressBar 1.0.1 to display the progress of its activity. The key part of the script is shown below. Here are my questions.

  1. How do I get the Progress Bar window to be frontmost? In Danny Goodman’s book I read about the ‘activate’ command, but I notice that in the 1.3.7 AppleScript Language Guide there is no mention of that command. Has it been retired? When I run my script, the progress bar window gets opened behind all the other windows and I can’t see how to move it forward except to do it with my mouse (which kind of defeats what I had in mind).
  2. Why is FileMaker so slow when it’s window is frontmost? When I run my script, it seems to take one or two seconds per record being processed. However, if I click on the progress bar window to bring it to the front, the processing suddenly speeds up tenfold. What is going on here?
    Any help will be appreciated. Here is the relevant script code:
try
tell document 1 of application "FileMaker Pro"
  set FieldList to name of every field
  set Ans to choose from list FieldList with prompt "Export which fields?" with multiple selections allowed
  if Ans = false then return
  set cursor to busy cursor
  set FieldList to Ans
  set MaxFieldLen to 0
  repeat with FieldName in FieldList
    set cursor to busy cursor
    set FieldLen to length of FieldName
    if FieldLen > MaxFieldLen then set MaxFieldLen to FieldLen
  end repeat
  set recordcnt to (count records)
  tell application "Progress Bar 1.0.1"
    make new window with properties {Name:"Output Progress", Position:{100, 50}}
    tell first progress bar of window 1
      set caption to "Processing:"
      set minimum value to 0
      set maximum value to recordcnt
      copy 0 to x
    end tell
  end tell
  repeat with i from 1 to recordcnt
    tell application "Progress Bar 1.0.1"
      tell first progress bar of first window
      set current value to i
      set subcaption to "Record " & i & "/" & recordcnt
    end tell
  end tell
  set cursor to busy cursor
  tell record i
    my WriteText(return & DelimiterLine)
    repeat with FieldName in FieldList
      set FName to FieldName as string
      my WriteField(FName, (cellValue of cell FName) as string)
    end repeat
  my WriteText(return)
  end tell
end repeat
tell application "Progress Bar 1.0.1" to quit
end tell
on error errMsg number errNum
close access FD
if length of errMsg > 240 then
  set errMsg to text 1 thru 240 of errMsg
end if
display dialog errMsg & " ( " & errNum & ")" buttons "Cancel" default button "Cancel"
end try

: I have a script that is showing odd behavior that maybe
: someone could help me with. It is a script that
: controls FileMaker Pro and uses ProgressBar 1.0.1 to
: display the progress of its activity. The key part of
: the script is shown below. Here are my questions.
: 1) How do I get the Progress Bar window to be frontmost?
: In Danny Goodman’s book I read about the ‘activate’
: command, but I notice that in the 1.3.7 AppleScript
: Language Guide there is no mention of that command.
: Has it been retired? When I run my script, the
: progress bar window gets opened behind all the other
: windows and I can’t see how to move it forward except
: to do it with my mouse (which kind of defeats what I
: had in mind).
: 2) Why is FileMaker so slow when it’s window is
: frontmost? When I run my script, it seems to take one
: or two seconds per record being processed. However, if
: I click on the progress bar window to bring it to the
: front, the processing suddenly speeds up tenfold. What
: is going on here?
: Any help will be appreciated. Here is the relevant script
: code: try
: tell document 1 of application “FileMaker Pro”
: set FieldList to name of every field
: set Ans to choose from list FieldList with prompt
: “Export which fields?” with multiple
: selections allowed
: if Ans = false then return
: set cursor to busy cursor
: set FieldList to Ans
: set MaxFieldLen to 0
: repeat with FieldName in FieldList
: set cursor to busy cursor
: set FieldLen to length of FieldName
: if FieldLen > MaxFieldLen then set MaxFieldLen to
: FieldLen
: end repeat
: set recordcnt to (count records)
: tell application “Progress Bar 1.0.1”
: make new window with properties {Name:“Output
: Progress”, Position:{100, 50}}
: tell first progress bar of window 1
: set caption to “Processing:”
: set minimum value to 0
: set maximum value to recordcnt
: copy 0 to x
: end tell
: end tell
: repeat with i from 1 to recordcnt
: tell application “Progress Bar 1.0.1”
: tell first progress bar of first window
: set current value to i
: set subcaption to "Record " & i &
: “/” & recordcnt
: end tell
: end tell
: set cursor to busy cursor
: tell record i
: my WriteText(return & DelimiterLine)
: repeat with FieldName in FieldList
: set FName to FieldName as string
: my WriteField(FName, (cellValue of cell FName) as string)
: end repeat
: my WriteText(return)
: end tell
: end repeat
: tell application “Progress Bar 1.0.1” to quit
: end tell
: on error errMsg number errNum
: close access FD
: if length of errMsg > 240 then
: set errMsg to text 1 thru 240 of errMsg
: end if
: display dialog errMsg & " ( " & errNum
: & “)” buttons “Cancel” default
: button “Cancel”
: end try
Well, the activate command is the one to bring a app to the foreground, and it’s part of an application’s dictionnary. Well I think. Just try to type it in the tell statement of the Progress thingy app.