# http api and applescript?

**URL:** <https://forums.plex.tv/t/http-api-and-applescript/1259>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [March 16, 2009, 9:02pm UTC](https://forums.plex.tv/t/http-api-and-applescript/1259 "2009-03-16T21:02:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Red\_Tape\_Media](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@Red\_Tape\_Media](https://forums.plex.tv/u/Red_Tape_Media)\
**Post date:** [March 16, 2009, 9:02pm UTC](https://forums.plex.tv/t/http-api-and-applescript/1259/1 "2009-03-16T21:02:38Z")

</div>

Is there a way that I am perhaps missing that applescript files can be run via the http api? The reason I am asking is I am creating an iPhone Plex Remote application and am trying to interface with my ZephIR blaster so I can change inputs on the TV / Receiver. Thanks.

---

<div class="post-metadata">

**Author:** ![kent](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/kent/32/184_2.png) [@kent](https://forums.plex.tv/u/kent)\
**Post date:** [March 16, 2009, 10:50pm UTC](https://forums.plex.tv/t/http-api-and-applescript/1259/2 "2009-03-16T22:50:30Z")

</div>

> [@](#):
>
> Is there a way that I am perhaps missing that applescript files can be run via the http api? The reason I am asking is I am creating an iPhone Plex Remote application and am trying to interface with my ZephIR blaster so I can change inputs on the TV / Receiver. Thanks.

  
  
I'd be terribly surprised if you could... running applescripts is a new Plex thing not an XBMC thing, and afaik there's been no work done on the http api for Plex specifically (I'd be delighted to be corrected if I am wrong), although, I've got a completely unsubstantiated feeling that there may be some work in that direction in the future.  
  
You can run python scripts though... a python script to call an applescript shouldn't be too hard...  
  
[http://xbmc.org/wiki/?title=List\_of\_Built\_In\_Functions](http://xbmc.org/wiki/?title=List\_of\_Built\_In\_Functions)  
  
Search for RunScript

---

<div class="post-metadata">

**Author:** ![Red\_Tape\_Media](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@Red\_Tape\_Media](https://forums.plex.tv/u/Red_Tape_Media)\
**Post date:** [March 16, 2009, 11:09pm UTC](https://forums.plex.tv/t/http-api-and-applescript/1259/3 "2009-03-16T23:09:35Z")

</div>

> [@](#):
>
> I’d be terribly surprised if you could… running applescripts is a new Plex thing not an XBMC thing, and afaik there’s been no work done on the http api for Plex specifically (I’d be delighted to be corrected if I am wrong), although, I’ve got a completely unsubstantiated feeling that there may be some work in that direction in the future.  
>   
>   
>   
> You can run python scripts though… a python script to call an applescript shouldn’t be too hard…  
>   
>   
>   
> [http://xbmc.org/wiki/?title=List\_of\_Built\_In\_Functions](http://xbmc.org/wiki/?title=List_of_Built_In_Functions)  
>   
>   
>   
> Search for RunScript

  
  
  
Thanks, I'll check that out!

---

<div class="post-metadata">

**Author:** ![jam](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/jam/32/186050_2.png) [@jam](https://forums.plex.tv/u/jam)\
**Post date:** [March 17, 2009, 12:41am UTC](https://forums.plex.tv/t/http-api-and-applescript/1259/4 "2009-03-17T00:41:39Z")

</div>

The new Plex features for running AppleScripts are extensions of the RunScript command - just put an AppleScript in your Scripts directory & pass the name into RunScript (e.g. Plex.RunScript(MyScript.applescript). You can also use Plex.RunAppleScript() to run script commands directly, although I don’t know if this will work with the HTTP API.

---

<div class="post-metadata">

**Author:** ![Red\_Tape\_Media](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@Red\_Tape\_Media](https://forums.plex.tv/u/Red_Tape_Media)\
**Post date:** [March 17, 2009, 6:20am UTC](https://forums.plex.tv/t/http-api-and-applescript/1259/5 "2009-03-17T06:20:22Z")

</div>

> [@](#):
>
> The new Plex features for running AppleScripts are extensions of the RunScript command - just put an AppleScript in your Scripts directory & pass the name into RunScript (e.g. Plex.RunScript(MyScript.applescript). You can also use Plex.RunAppleScript() to run script commands directly, although I don’t know if this will work with the HTTP API.

  
  
  
Hurrah! Thanks for that jam, managed to figure it out... the syntax for those who want to know is:  
  
http://{PLEX IP ADDRESS}:{PLEX PORT NUMBER}/xbmcCmds/xbmcHttp?command=ExecBuiltIn(RunScript({SCRIPTNAME}.applescript))  
  
By default the port is 3000.  
  
  
Thanks again Jam and Kent for your help!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 20, 2019, 8:23pm UTC](https://forums.plex.tv/t/http-api-and-applescript/1259/6 "2019-12-20T20:23:52Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
