Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

phooodisgoood

macrumors newbie
Original poster
Aug 5, 2014
7
0
I'm trying to write a script that opens a movie that is packaged within the contents of the app on more than one computer. I can easily drag in the path to the movie on my computer but on another computer it wont work and if the app is placed in a folder or something of that sort it will break yet again because the path will change. How do I open the movie contained within the app regardless of where the app is?

Heres my code so far:
tell application "Finder" to set theMovie to "Users:MyName:Desktop:Bat Signal.app:Contents:Resources:Bat Signal MOV1.mp4"
tell application "QuickTime Player"
activate
open theMovie
play

end tell

any help would be greatly appreciated
 
Slow and requires admin access:
Code:
set aa to do shell script "find /Users -name Bat Signal.app" with administrator privileges
Fast but requires Spotlight:
Code:
set bb to do shell script "mdfind -name Bat Signal.app"
These'll give you the / delimited path to the file, if it exists.
 
Last edited:
I originally thought it worked correctly but that was because I happened to have the same file on my desktop but neither method works in finding the movie inside the package contents
 
Last edited:
You added the "Contents:Resources:Bat Signal MOV1.mp4" bit of path to the pathe the search returned, and converted all the / to :?
 
I'm trying to write a script that opens a movie that is packaged within the contents of the app on more than one computer. I can easily drag in the path to the movie on my computer but on another computer it wont work and if the app is placed in a folder or something of that sort it will break yet again because the path will change. How do I open the movie contained within the app regardless of where the app is?

any help would be greatly appreciated

Look at the path to resource section here

Example :

Code:
set theMovie to path to resource "DragFolderToOpenDialog.mov"

tell application "QuickTime Player"
	activate
	set movieDocument to open theMovie
	play movieDocument
end tell
 

Attachments

  • Screen Shot 2014-09-19 at 04.20.14.png
    Screen Shot 2014-09-19 at 04.20.14.png
    151.8 KB · Views: 57
  • Apple Script Paths on Multiple Computers-480p.zip
    2.3 MB · Views: 57
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.