Jump to content
Server Maintenance This Week. ×

When you need a robot and you have to test the connection


This topic is 2733 days old. Please don't post here. Open a new topic instead.

Recommended Posts

When i use a local robot to create pdf files or other, i have a problem when the connection go down, filemaker loose every reference to the remote file.

The only way is to close the file and open again, i solved this problem on Mac using this apple script.

1)  The AS check the connection if ok open the file.

2)  If the connection go down then the AS close the file and wait until the connection is up, at that time it reopen the file.

3) if you close the file then the applescript quit it self. 

I am not a Apple script developer, i assembled it using few examples, then probably  isn't well done but it work.

-------------------------------------------------

tell application "Finder" to set ThePath to POSIX path of ((container of (path to me)) as alias)

set VarRepeat to "Yes"

tell application id "com.filemaker.client.advanced12"

    activate

    try

        set window_name to the name of every window whose visible is true

    on error

        set window_name to "Error"

    end try

end tell

 

---------------------------------------------------

repeat

    set testIP to chkUP("http://www.apple.com") or chkUP("http://www.google.com")

    ---------------------------------------------------

    if testIP as text = "False" and window_name contains "Robot" then

        tell application "System Events"

            activate

            set {procesList, pidList} to the {name, unix id} of (every process whose name contains "Filemaker Pro")

        end tell

        delay 5

        set VarLoop to "OK"

        try

            --tell application "FileMaker Pro Advanced" to close every window

            --on error

            do shell script "kill -KILL " & pidList as text

            set window_name to "Error"

            set VarRepeat to "Yes"

        end try

        

        

    end if

    

    

    ---------------------------------------------------

    if testIP as text = "True" then

        try

            tell application id "com.filemaker.client.advanced12"

                activate

                delay 5

                set window_name to the name of every window whose visible is true

            end tell

        on error

            set window_name to "Error"

        end try

        --display dialog testIP as text

        --------------------------    

        if testIP as text = "True" and window_name contains "Error" and VarRepeat = "Yes" then

            

            tell application id "com.filemaker.client.advanced12"

                activate

                try

                    open ThePath & "Robot.fmp12"

                    set window_name to "Robot"

                    set VarRepeat to "No"

                on error

                    quit

                end try

            end tell

            

        end if

    end if

    ---------------------------------------------------    

    --with timeout of 60 * 60 * 24 seconds

    delay 5

    if VarRepeat = "No" and window_name contains "Error" then quit

end repeat

to chkUP(theURL)

    return (count (get ((theURL as URL)'s host & {dotted decimal form:""})'s dotted decimal form)) > 0

end chkUP

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.