i'm trying to make applescript search for a file inside an application and then open it. The problem is that i want the file to open from anywhere in the mac eg. Desktop, library, downloads etc. No matter where it is.
This script works but the file has to be on the desktop only, it won't work anywhere else as the path is for the desktop
set theFile to ({path to desktop} as text) & "MagroXELA.app:Contents:Troll.mp3"
tell application "Finder" to open file theFile
Kind regards, Alex
There is an applescript line that returns the path of the process that is running the script, which works out to the physical location of a script file itself.
set appLocation to path to me as string
set theFile to appLocation & "Contents:Troll.mp3"
tell application "Finder" to open file theFile
Related
I want to open a local file from my appliaction.
I don't want to open the file directly in my application, I just want to make the command to open the specific file I have the path for.
The path to the file looks like this
/var/mobile/Containers/Data/Application/.../filename.pdf
Is is possible to open a path like this with an external application like the "Files" application?
Thanks
I'm making a script that automatically installs Vivaldi. I've put the .app file inside the package contents (in the resources folder), and I want it to move the app to the Applications folder. So, I have 2 questions:
Is this actually possible?
If so, how?
I have this so far:
set Vivaldi to ((path to me as string) & "Contents:Resources:Vivaldi.app")
set AppFolder to "Macintosh HD/Applications/"
tell application "Finder"
move application Vivaldi to AppFolder
end tell
If your trying to say the your making an Applescript Application that contains another application in the Resources folder that moves the contained application to the Applications Folder then YES This is possible :D!!! You can use this code here:
set vivaldiApp to POSIX path of (path to resource "Vivaldi.app")
do shell script "cp -r \"" & vivaldiApp & "\" /Applications/"
Thats IT!!!
Hope this Helped!!
I want to write a small app that does some data manipulation on the contents of a simple text file.
I just want to be able to right click such a file, choose 'Open with' in Windows, select my app, then the app opens, parses the file, does some stuff and closes immediately again.
Question: when my app starts, how do I get the file name that triggered the app to start?
Thanks!
You get the file as parameter number 1.
You can get it with the function ParamStr(1).
Have a look here for more details:
http://www.delphibasics.co.uk/RTL.asp?Name=ParamStr
For your information, ParamStr(0) is the filename (including complete path) of your EXE application.
I have a one script file in my current application.. The path for same look like this.
D:\myproj\Example\www\abc.js
while running my application in device it will download one file into my SDcard dynamically.
I need to parse my downloaded application and need to set this "abc.js" file path in this.
I can able to set path if my file is in SDCard , but dont know how to refer path which is in my current application..
If you have that file on SDCard, then the full path to it will be as follows:
file:///SDCard/myproj/Example/www/abc.js
ADDITIONAL INFO:
If your file is located in cod file, then there is a way, but it is not documented and it is not guaranteed that it will work on all devices and RIM OS versions.
Code below shows document.htm encapsulated in modulename.cod in BlackBerry browser.
BrowserSession session = Browser.getDefaultSession();
session.displayPage("cod://modulename/document.htm" );
Try to use cod://modulename/abc.js to specify path to your js file.
To reference an application embedded file (in this case an image file stored in images directory):
"file:///local/images/embedded_img.png"
I have four files (config.xml, index.html, scripts.js, and styles.css). The html has a canvas and a form for users input. I want to run on blackberry simulator (Torch version 6...). I create a zip file of all those files. Then create a bin folder. Now when I run the simulator and load the application, I have either blanc screen, either the following error: Resource does not exist.
Here is the config file code:
BlackberryTest
I had the same problem. You need to use local:/// prefix before the name of the local resource to access it.