Has anyone created an AppleScript/Application to launch PlexConnect at startup?

When i did this step 

Show package contents of your new app PMS and rename Applications/PMS.app/Contents/MacOS/Plex Media Server to PMS

Plex app would not launch, I had to rename it back

You dont have to rename /applications/plex media server.app to pms.app if you dont want to it works either way as long as you change the plist accordingly to whatever name u like same goes for renaming the other portion to pms as well


UPDATE!

AND THE PLEX MEDIA SERVER PLIST IS BORN! Made by me icon_razz.gif

1. Copy your plex app and rename it to PMS in /applications
2. Show package contents of your new app PMS and rename Applications/PMS.app/Contents/MacOS/Plex Media Server to PMS
3. Copy the com.plex.pms.plist to /library/lauchdaemons
4. Fire up terminal and sudo su enter password.
5. Change directory to /library/launchdaemons
6. Enter this in terminal: chown root:wheel com.plex.pms.plist
7. Then this: sudo launchctl load /Library/LaunchDaemons/com.plex.pms.plist
8. I also added this to plexconnect.py above (import sys, time) at the beginning of the file I dont know if its needed but I wanted to be sure PMS was up and running prior to PLEX CONNECT Launchctl plist:

import time
time.sleep(.5)

Hope this help you guys enjoy smile_osx.png

Here is the link for the plist:

http://www.tonymacx86.com/other-apple-hardware/105363-plexconnect-fully-functioning-plex-client-apple-tv-3.html

What do you explaining in this guide? there is the code for the applescript editor in page 9 that works perfect for me. Is there anything even better. so what does this guide do? can you please make him better?

I'm not sure how making Plex Media Server a launchAgent is useful?...

Can't we just select "Open at Login" from the menubar icon to achieve the same thing?

![post-43769-0-11998600-1379321687.png|284x261](upload://gQ1pAEydMPEUobAek6VxSAtQdcU.png)

I'm not sure how making Plex Media Server a launchAgent is useful?...

Can't we just select "Open at Login" from the menubar icon to achieve the same thing?

attachicon.gifScreen Shot 2013-09-16 at 6.51.50 PM.png

I created this plist to automatically start PMS similar to checking the box open at login. The only difference is if PMS ever crashes the plist will automatically open PMS without having to goto the app and reopening it. Also if PMS is ever designed to boot prior to login this will be the plist you need.

This is why plex media center is not starting at boot prior to login on osx:

The Plex Media Server is an application that runs on your Macintosh or Windows PC. You can only access your Plex media while the server is running, so we recommend you allow the application to launch when you log-in. You must login to the user account for the server to load.


http://wiki.plexapp.com/index.php/Plex_Media_Server_Preferences

Please forgive my pure novice skill level.

Would you elaborate which parts of the script, in the green font I assume, need to be changed to things of my choosing?

the path to the .py file

the username

how about "pw"?

anything else?  What about the statement with "find-generic-password"?

Thanks,

Joe

Hi,

Great update. I installed the plist yesterday, it works great ! Just don't forget to install/launch also the PlexConnect plist (and also modify path in it) or PMS will not be accessible through ATV  :D

Just a small question, I also get the "No Plex Media Server in proximity" message when I start Trailers on ATV. If I start again it then works. Is there a way to avoid it ?

Thanks a lot

SOLVED!

http://forums.plexapp.com/index.php/topic/81127-plex-media-center-automatic-startup-applescript-login-option-osx/

WINDOWS

   Add Plexconnect.py to your Windows Startup menu folder

OSX

Use Automator http://forums.plexapp.com/index.php/topic/81127-plex-media-center-automatic-startup-applescript-login-option-osx/

Just installed Mavericks and now the Applescript doesn't work anymore. In Console i see a few errors:

10/6/13 4:06:47.585 PM authexec[631]: executing /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/MacOS/uid
10/6/13 4:06:47.000 PM kernel[0]: screen: guarded fd exception: fd 15 code 0x1 guard 0x7fff8d1b1c48
10/6/13 4:06:47.624 PM ReportCrash[632]: DebugSymbols was unable to start a spotlight query: spotlight is not responding or disabled.
10/6/13 4:06:47.774 PM ReportCrash[632]: Saved crash report for screen[631] version 22 to /Library/Logs/DiagnosticReports/screen_2013-10-06-160647_Office-iMac.crash

And here's the crash report. I've never seen an EXC_GUARD exception type. Anyone have any ideas?

Process:         screen [631]
Path:            /usr/bin/screen
Identifier:      screen
Version:         22
Code Type:       X86-64 (Native)
Parent Process:  applet [630]
Responsible:     applet [624]
User ID:         0

Date/Time:       2013-10-06 16:06:47.618 -0700
OS Version:      Mac OS X 10.9 (13A598)
Report Version:  11
Anonymous UUID:  28CD39B2-0A36-1694-4C1A-2C901DF92B2E


Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_GUARD
Exception Codes: 0x400000010000000f, 0x00007fff8d1b1c48

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff8a05f0c2 close + 10
1   screen                        	0x000000010e9102d8 0x10e8f4000 + 115416
2   screen                        	0x000000010e91d588 0x10e8f4000 + 169352
3   libdyld.dylib                 	0x00007fff8ce5f5fd start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000001  rbx: 0x000000000000000f  rcx: 0x00007fff5130b4e8  rdx: 0x0000000000000000
  rdi: 0x000000000000000f  rsi: 0x00007fff5130bcd0  rbp: 0x00007fff5130b500  rsp: 0x00007fff5130b4e8
   r8: 0x0000000000000000   r9: 0x00007fff5130ae00  r10: 0x00007fff8a05f0c2  r11: 0x0000000000000293
  r12: 0x00007fff5130bcd0  r13: 0x0000000000000000  r14: 0x0000000000000000  r15: 0x0000000000000007
  rip: 0x00007fff8a05f0c2  rfl: 0x0000000000000293  cr2: 0x000000010e92c084
  
Logical CPU:     0
Error Code:      0x02000006
Trap Number:     133

Just installed Mavericks and now the Applescript doesn't work anymore. In Console i see a few errors:

I am having the same problem.  I am not sure where to start.  Anybody else resolve this issue in Mavericks yet?

I am having the same problem.  I am not sure where to start.  Anybody else resolve this issue in Mavericks yet?

I actually downgraded back to ML because i rely on PlexConnect on this system. From what i could tell, it's not specific to anything in the PlexConnect scripts. It is caused by launching the "screen" command with administrator privileges from the applescript.  The exception is a guarded file descriptor, which i have no clue what that means and haven't found any useful information on the apple developer forums.

Maybe now that plexconnect has daemon support we won't need the applescript but i haven't had time to test that yet.

Yea, I was trying to mess around with the daemon and different plist but could not get it to work correctly yet.  I don't think the code is where it needs to be yet.  I have a few other python scripts auto starting with launch daemons and they all work fine but the plexconnect will not.  Wanted to switch back to this in the mean time but I cannot get the app i created to work with Mavericks.  I guess I will have to manually launch it until the daemon code works properly.

Yea, I was trying to mess around with the daemon and different plist but could not get it to work correctly yet.  I don't think the code is where it needs to be yet.  I have a few other python scripts auto starting with launch daemons and they all work fine but the plexconnect will not.  Wanted to switch back to this in the mean time but I cannot get the app i created to work with Mavericks.  I guess I will have to manually launch it until the daemon code works properly.

Ok i figured out how to fix this to work on Mavericks. By using the daemon script that has been added to the most recent version of PlexConnect, you can modify the applescript to use it instead of using the "screen" command. Here's the changes you need to make.

1. In PlexConnect_daemon.bash script, change the INSTALL_DIR variable to the fully path of your PlexConnect directory

INSTALL_DIR="/Users/rob/Development/PlexConnect"

2. In the applescript, change the "py" variable to point to the daemon script

set py to "/Users/rob/Development/PlexConnect/PlexConnect_daemon.bash"

3. In the applescript, change the "do shell" and "on quit" sections to pass the start and stop parameters to the daemon script. Take notice that there is a space before "start" and "stop"

do shell script py & " start" user name un password thePassword with administrator privileges

on quit
do shell script py & " stop" user name un password thePassword with administrator privileges
continue quit
end quit

Ok i figured out how to fix this to work on Mavericks. By using the daemon script that has been added to the most recent version of PlexConnect, you can modify the applescript to use it instead of using the "screen" command. Here's the changes you need to make.

Thanks for the help.  I made the changes you suggested and everything worked perfect.  I can at least use this AppleScript until we figure out the best way to use the daemon with launchd.

Thanks for the help. I made the changes you suggested and everything worked perfect. I can at least use this AppleScript until we figure out the best way to use the daemon with launchtl


I'm not 100% sure but I believe you can't have a user agent that needs root privileges since they run as the logged in user. It should be possible to run as a global daemon but since you need to be logged into a user account to run PMS, I don't see much benefit in launching as a global daemon.

I'm not 100% sure but I believe you can't have a user agent that needs root privileges since they run as the logged in user. It should be possible to run as a global daemon but since you need to be logged into a user account to run PMS, I don't see much benefit in launching as a global daemon.

I have actually been trying to launch it as a user.  I have a headless Mac mini server that runs all my scripts.  The plists are all in the /Users/Dan/Library/LaunchAgents and running at login but when trying to use the plists that people have posted on here and the plexconnect_daemon code I have not been able to get it to work.  It will run but just crashes and trys to stay alive every 10 seconds.  Probably should move this talk over to that forum though.

not the best solution but for now why not just add plexconnect.py to your login items. if you want to password protect and start pms use this app, it requires you to enable fast user login for the password portion, but it works for osx. once you figure out launchctl or automator switch to that in the future.

not the best solution but for now why not just add plexconnect.py to your login items. if you want to password protect and start pms use this app, it requires you to enable fast user login for the password portion, but it works for osx. once you figure out launchctl or automator switch to that in the future.

Why? We have an Applescript that can be saved as an application and launched as part of the login process. It's actually a pretty good solution. It looks and behaves just like any other application. If you just tried adding plexconnect.py to the login items, it wouldn't run as root and would fail. 

Didnt see your updated posts, my fault.

Hi, didn't followed really last pages and want to catch up, so a few things:

i am using the script from post #97 i think, and PlexConnect app created with this script open on login and it's all good. Except of the fact that PMS will open without a password in the login screen with your guide, Will there be anything else different?

Thanks :)