Reflector 2 Broadcast name not appearing

Jaxson75
New Contributor II

How would i go about the below automator command into a bash script. As I packaged the software with composer correctly and remove the hostname from the Plist of the system I used to build the package, but I wanted for the package to fill in the users hostname under the Broadcast name field in Reflectors preferences.

on connectedDevice() tell application "Reflector 2" activate

end tell

tell application "System Events" keystroke "," using command down

end tell delay 2 tell application "Reflector 2" quit end tell

end connectedDevice
connectedDevice()

3 REPLIES 3

davidacland
Honored Contributor II
Honored Contributor II

I would try a user level custom config profile with a variable for the value you want.

If that doesn't work, a login script to set the value.

Jaxson75
New Contributor II

Where would I do that in? I was just looking for a quick script to add into casper admin when installing the package. As I want it to open the application and then do a Command , to open Preference for the application and then close it. The Automator works with the above commands but don't know how to make it into either a script or use the automator script into casper admin.

davidacland
Honored Contributor II
Honored Contributor II

A script that you could use in the JSS would be something like:

#!/bin/sh

osascript <<EOF
    on connectedDevice()
        tell application "Reflector 2"
            activate
        end tell
        tell application "System Events"
            keystroke "," using command down
        end tell
        delay 2
        tell application "Reflector 2"
            quit
        end tell
    end connectedDevice
    connectedDevice()
EOF

exit 0

If the user interferes or the finder isn't ready it may fail so I would probably look at config profiles, but hopefully this gets you something working in the mean time.