Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 7, 2012, 11:07 AM   #1
CountrySeacow
macrumors newbie
 
Join Date: Dec 2012
Using Applescript to reference target's desktop

Hello,
I am moderately new to applescript editor.
I have written code to copy a file from (for safety purposes named-) "DISK1". "DISK1" is a USB disk drive. A file, named "APPNAME.app", when the applescript is run, is supposed to be copied to the users desktop.
I know how to specify for one user, but I want to be able to run this script on any computer, and for it to still work without having to modify the script before running it.
My code is as follows:

Code:
tell app "Finder"
	activate
	set x to file "APPNAME.app" of folder "FOLDER2" of folder "FOLDER1" of disk "DISK1"
	set y to folder "Desktop" of folder "USERNAME" of folder "Users" of startup disk
	copy x to y
end tell
Any help would be useful, and i apologize if this topic is anywhere else on the forums.

Thanks!
CountrySeacow
CountrySeacow is offline   0 Reply With Quote
Old Dec 7, 2012, 11:49 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
http://lists.apple.com/archives/appl.../msg00798.html any help?
robbieduncan is offline   0 Reply With Quote
Old Dec 7, 2012, 07:28 PM   #3
CountrySeacow
Thread Starter
macrumors newbie
 
Join Date: Dec 2012
Quote:
Originally Posted by robbieduncan View Post
Okay, well i think the might normally work, but how to i put that into this script?
(in line;
if exists file "Macintosh HD:Users:USERNAME:Desktop Minecraft.app" then
)

Code:
tell application "Finder"
	activate
	if exists file "Macintosh HD:Users:USERNAME:Desktop Minecraft.app" then
		display dialog "it exists"
	else
		tell application "Finder" to move entire contents of folder "app" of folder "Minecraft_Mac" of disk "MINECRAFT" to folder "Desktop" of folder "USERNAME" of folder "Users" of startup disk
	end if
end tell
CountrySeacow is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iPad: Target vs Walmart for iPad Air (Target Sells it for $20 less) rampras iPad 2 Nov 1, 2013 10:25 AM
Applescript -hiding desktop drive icons macstatic Mac Programming 4 Aug 31, 2013 03:34 PM
Need applescript help - Copy files from desktop to NAS Polansky Mac Programming 1 Dec 24, 2012 02:08 PM
October 1st reference in media event reference to next media event for iPad? knemonic iPad 7 Sep 13, 2012 03:42 PM
reference by range. Applescript. fhill2 Mac Programming 2 Jun 23, 2012 04:43 PM

Forum Jump

All times are GMT -5. The time now is 07:57 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC