display dialog ... giving after integer
After updating to Mountain Lion I experienced some problems with the AppleScript scripts I use in a Filemaker Pro environment.
This necessitated me to change from QTP to QTP 7.
The following script reflects the FMP environment; when I try to abstract from the FMP environment, I encounter other problems.
tell application "QuickTime Player 7" to launch
--------------------------------------------------------------
tell application "FileMaker Pro"
activate
set url_path to cell "bestandspad" of current record
end tell
set tekst to ""
--------------------------------------------------------------------------------
tell application "QuickTime Player 7" to getURL url_path
delay 0.1
tell application "System Events"
set visible of process "QuickTime Player 7" to false
repeat until visible of process "QuickTime Player 7" is false
end repeat
end tell
tell application "QuickTime Player 7" to set doc1Exists to (exists document 1)
if not doc1Exists then
set tekst to "next"
else
tell application "QuickTime Player 7" to play document 1
end if
set the clipboard totekst
set tekst to ""
--------------------------------------------
repeat
display dialog "Interrupt" buttons {"Stop", "Pauze"} giving up after (my secLeft())
set {b, fin} to {button returned, gave up} of result
if fin then exit repeat
if b = "Stop" then
set tekst to "Stop"
exit repeat
else
tell application "QuickTime Player 7" to pause document 1
display dialog "Verder gaan ?" with title "" buttons {"Stop", "Hervat"} default button 2
set b to button returned of result
if b = "Hervat" then
tell application "QuickTime Player 7"
tell document 1
if duration = current time then exit repeat
play
end tell
end tell
else
set tekst to "Stop"
exit repeat
end if
end if
end repeat
set the clipboard totekst
on secLeft()
tell application "QuickTime Player 7"
tell document 1
set d to (duration - current time)
end tell
end tell
set d to rounddroundingup
if d < 1 then set d to 1
return d
end secLeft
------------------------------------------------------------------------
tell application "QuickTime Player 7" to close document 1 saving no
tell application "QuickTime Player 7" to quit
Everything works fine, but.
The problem is with the 'display dialog ... giving up after (my secLeft())'
This is supposed to return fin=true when current time equals duration or when my secLeft=0; it always returns fin=false
This program runs fine on the AppleScript editor; 'current time' sometimes poses a problem in other programs.
Any idea how to correct 'dispaly dialog (without moving back to QTP)?
iMac, OS X Mountain Lion (10.8.2), FileMaker Pro 11