3

I work with a colleague editing videos and I wish to trigger a dialog or a note document whenever he opens Final Cut, so I can leave messages for him to do the job. The machine has to stay always on, so I can't use any startup method.

It's the same workstation same user account, we share the room in different shifts.

El Capitan 10.11.6 - FinalCut Pro 7 -- He enters after 18pm

Any advice on how to display a message when opening an application?

  • 1
    where is he, how are you connected , what HW,SW are you using. Help us to help you. If same machine, does he has his own user account ? – Ruskes Sep 18 '18 at 18:54
  • 1
    please answer all my questions, specialty the one if he has his own user account. How would system know it was him opening the Final Cut and not you. We could use the time stamp if that does not changes. Always same shit. – Ruskes Sep 18 '18 at 18:57
  • 1
    Might I suggest leaving a note open on the desktop just before you leave so it's there for when he arrives ? Simplest solutions are often the most effective. – CJK Sep 18 '18 at 19:11
  • 1
    CJK I agree, its a good idea. However sometimes there are power failures and other people using the machine, so it would be nice to have a reliable method... – Mateus Ribeiro Sep 18 '18 at 19:27
  • 1
    thank you for the input. The problem is to have a programmable input message (imputed by you that changes) otherwise it is always the same message. – Ruskes Sep 18 '18 at 20:47
-1

Here is a Apple script (in your Utility folder Script Editor) that will open Notes if the Final Cut is opened.

I don't have Final Cut so I used Skype to test. Just copy and paste following, then save.

repeat until application "Final Cut Pro" is running
    delay 1
end repeat

delay 5
if application "Final Cut Pro" is running then activate application "Notes"

The Delay 5 (seconds) is to have Notes as Top window after Final Cut starts. You can increase that number. This script will run continuously until Final Cut is started, but we could go fancy and have it start at 18:00.

Prerequisite is you Quit the Final cut before you leave.

As always you can be very elaborate leaving a message and instructions in Note.

Also set Notes in Preference to sort by date created so to have the latest note on the top.

| improve this answer | |
  • 1
    "AppleScript" isn't in the "Utility" folder. However, Script Editor is in the "Utilities" folder of the "Applications" folder. Testing the app with Skype is reasonable, but why not then replace it with Final Cut yourself before submitting the answer, instead of suggesting the reader does it ? It makes no sense to leave it like that. The appName variable is superfluous: makes more sense to just say if application "Final Cut" is running then, and subsequently activate application "Notes". Cont'd... – CJK Sep 19 '18 at 3:05
  • 1
    ...Cont'd In fact, that is your entire script in one line: if application "Final Cut" is running then activate application "Notes". The rest of it is unneeded junk. That said, I don't believe this answer solves the OP's solution at all as it currently stands. If the OP runs your script as it is, it'll either launch Notes, or it won't, then it terminates. That's not especially useful. – CJK Sep 19 '18 at 3:06
  • 1
    open location is also not a Notes command. There's a command called open notes location but it requires a URL to a pre-existing note. As a final point, I just did a Google search and it turns out Final Cut (Pro) isn't scriptable (unless that information is out-of-date). This means you can't use the running property to check if it's running. Therefore, the script will fail to execute. I feel this answer needs to be radically improved with further details and corrections, or deleted as being insufficient and an example of incorrect AppleScripting. – CJK Sep 19 '18 at 3:20
  • 1
    You're welcome and well done for taking the critique on the chin. I noticed you revised your script. On a minor note, you don't need if application "Skype" is running then..., as if the script gets that far, it means the repeat loop has been broken, so you know the application is running. You simply need activate application "Notes". On a slightly less minor note, it's still not a practical script to use as it requires Script Editor to remain open and the script to be left running on a loop. Cont'd... – CJK Sep 19 '18 at 5:02
  • 1
    ...Cont'd I'm glad you ignored my comment about Final Cut Pro not being scriptable, as I was incorrect in assuming that was a necessary mandate for the running property to be readable. It turns out it is a core property for all application objects in AppleScript, regardless of scriptability. I still feel you ought to replace "Skype" with "Final Cut Pro" yourself. Leaving it in makes no sense and is confusing at a simple glance (most people head straight for the code first, and not the prose). – CJK Sep 19 '18 at 5:07
1

I don't have “Final Cut.app” so I tested this code with the TextEdit.app. If you save this code in Script Editor as a stay open application, on first run, this app will display a dialog box for you to input the message that you want the person opening “Final Cut” to read. If the Final Cut closes or unexpectedly quits…. On reopen of Final Cut, the original dialog you previously set, will be displayed again. When you quit the stay open app and then relaunch it again…. That dialog box will once again appear asking you to enter the message that you want the person opening “Final Cut” to read.

property theApp : "TextEdit" -- Change this
property theMessage : missing value
property appIsRunning : missing value

activate
set theMessage to text returned of (display dialog ¬
    "THE MESSAGE" default answer ¬
    "Message You Want To Display" buttons ¬
    "OK" default button ¬
    "OK" with title ¬
    "Message You Want To Display" with icon 2)

on idle
    repeat
        repeat until appIsRunning is true
            delay 5 -- avoids dialog and theApp (if relaunching) opening at same time
            set appIsRunning to application theApp is running
            if appIsRunning is true then
                activate
                -- Running A Display Dialog Within An Application Tell Block... 
                -- Inherits The Apps Icon To Be Used In The Dialog Window
                tell application theApp to display dialog theMessage buttons {"OK"} default button "OK" with icon 1
            end if
        end repeat
        -- next line necessary to re-trigger the "repeat until" loop again
        set appIsRunning to application theApp is running
        return 5 -- in seconds
    end repeat
end idle
| improve this answer | |
  • 1
    May I prod you to double-check to see whether you need the outside repeat loop in your on idle handler ? Given that the handler is, itself, executed every 5 seconds (from your return 5), I suspect it's superfluous. My second query is whether you would be getting rid of if appIsRunning is true then moving the contents of that block to just outside the inner repeat loop, which only really serves as a monitor on a delay cycle. Once the loop is broken, you know that appIsRunning is true, so the dialog can be displayed; then there's also no need to set appIsRunning a second time. – CJK Sep 19 '18 at 2:39
  • 1
    In fact, just bin the appIsRunning property altogether. You only effectively utilise it once, so it's not serving any real value. You can simply do: repeat until application theApp is running...delay 5...end repeat. Then activate and display dialog, then return 5. – CJK Sep 19 '18 at 2:41
  • 3
    Trimmed off as much of the fat as I could and added a few commented descriptions. Thank you all... for the pointers – wch1zpink Sep 19 '18 at 4:16
  • 1
    @CJK I tried your suggestion of repeat until application theApp is running ... Does not work correctly. Running the stay open application with the adjusted code that you suggested... Always forces the target application to open If it is closed – wch1zpink Sep 19 '18 at 4:54
  • 1
    I just tested your script with my two suggestions above implemented, as a Stay Open application, tested with TextEdit as the target application. The applet/script runs exactly as expected, and doesn't force the target application to launch (System info: AppleScript version: "2.7", system version: "10.13.6"). As I suspected, the outside repeat loop is demonstrably unnecessary in my test. Mind you, this is more "FYI". Your script does work, so I suppose all I'm doing is nitpicking. – CJK Sep 19 '18 at 5:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .