Go Back   The Apple Blog Community > Apple/Mac > Development
Register Social Groups iSpy Members List Search Today's Posts Mark Forums Read FAQ

Development XCode, Cocoa, and all other development

Reply
 
LinkBack Thread Tools Search this Thread
04-12-2007   #1 (permalink)
TAB Author
 
jasonguthrie's Avatar
 
Join Date: Oct 2006
Location: Bay Area, CA
Posts: 104
jasonguthrie is on a distinguished road
Send a message via AIM to jasonguthrie Send a message via Skype™ to jasonguthrie
I'm hoping someone out there in the TAB community knows a lot more about Applescript than I do. In fact, you only need to know a little bit and I'm sure you could help

Anyway, I have this little piece of code, written to grab a bunch of files in a folder, and dump them into another folder, overwriting if necessary.

Here's just a piece:

Quote:
tell application "Finder"
if (exists folder "Applications:VE LXi Apprentice 7:Outputdrivers" of startup disk) then
duplicate files in folder "vinyl-updater:update-files" of desktop to folder "Applications:VE LXi Apprentice 7:Outputdrivers" of startup disk replacing yes
The problem is that when I run the script, I receive the following error in the event log:

Quote:
exists folder "Applications:VE LXi Expert 7:Outputdrivers" of startup disk
true
copy every file of folder "vinyl-updater:update-files" of desktop to folder "Applications:VE LXi Expert 7:Outputdrivers" of startup disk
"Finder got an error: Can't set folder \"Applications:VE LXi Expert 7:Outputdrivers\" of startup disk to every file of folder \"vinyl-updater:update-files\" of desktop."
Anyone have any suggestions as to why this is being so difficult?? This is driving me crazy!
jasonguthrie is offline   Reply With Quote
Sponsored Links
04-12-2007   #2 (permalink)
Mac Genius
 
Join Date: Feb 2007
Location: United Kingdom
Posts: 1,059
houltmac is on a distinguished road
Send a message via AIM to houltmac Send a message via Skype™ to houltmac
Okay, I am no scripter, but here's an option to overcome all these issues: get Automator to do it for you.

Try doing something like "Get Selected Finder Items" (or "Get Sepcified Finder Items" or "Get Folder Contents" or something, there are loads of options). Then try "Copy Finder Items" and choose to Show Action When Run and choose to show either, both or neither of the options "Replace Existing Files" and "To".

This will do the same thing without being capable of messing up. You can then save this as a workflow or application, add it to your AppleScript menu item or even save it as a plug-in for Finder where you can then right click and item, choose Automator and hey presto, there is the option.

Would this be suitable or I may have missed something?
__________________
MacBook Pro 15" Glossy, 2.6GHz, 4GB RAM, 320B HD | iPhone 3G 16GB (Black)
houltmac is offline   Reply With Quote
04-12-2007   #3 (permalink)
Concierge
 
mdmunoz's Avatar
 
Join Date: Nov 2006
Location: Davis, CA
Posts: 643
mdmunoz has disabled reputation
Send a message via AIM to mdmunoz
This worked for me:

Code:
tell application "Finder"
	duplicate files in folder "untitled folder" of desktop to folder "New" of desktop replacing yes
end tell
The second I use things like "Users:mdmunoz:Desktop:untitled folder" I get the same errors.

Try throwing in a lot of "of" statements. For example, "folder update-files of folder vinyl-updater of desktop"

Last edited by mdmunoz; 04-12-2007 at 04:31 PM.
mdmunoz is offline   Reply With Quote
04-12-2007   #4 (permalink)
TAB Author
 
jasonguthrie's Avatar
 
Join Date: Oct 2006
Location: Bay Area, CA
Posts: 104
jasonguthrie is on a distinguished road
Send a message via AIM to jasonguthrie Send a message via Skype™ to jasonguthrie
Matt - I would use Automator in a heartbeat... but in this case it's something I would like to distribute to other people. It's basically an update script for some specialized software that has crappy mac support and even worse customer service (another story). So they issue this patch, but he script doesn't actually work - so I was hoping to tweak it and put it back out there for people to actually use

I'm going to try mdmunoz's approach tonight... I'll see how many "of"s I can get in there. The reason the "Users:mdmunozesktop..." was in there was so that it could work on everyone's machine, since it was using the default install directory.

If I really wanted to get fancy, I could put in a little search string to actually find the folder it's installed in... hmmm...
jasonguthrie is offline   Reply With Quote
04-12-2007   #5 (permalink)
Mac Genius
 
Join Date: Feb 2007
Location: United Kingdom
Posts: 1,059
houltmac is on a distinguished road
Send a message via AIM to houltmac Send a message via Skype™ to houltmac
Okay, so I missed something. automator should still work though as it can easily adjust the locations and be saved to be sent to others however you'd like. (I have to back up my ideas to make myself feel better at least )
__________________
MacBook Pro 15" Glossy, 2.6GHz, 4GB RAM, 320B HD | iPhone 3G 16GB (Black)
houltmac is offline   Reply With Quote
04-13-2007   #6 (permalink)
Concierge
 
mdmunoz's Avatar
 
Join Date: Nov 2006
Location: Davis, CA
Posts: 643
mdmunoz has disabled reputation
Send a message via AIM to mdmunoz
Quote:
Originally Posted by houltmac View Post
Okay, so I missed something. automator should still work though as it can easily adjust the locations and be saved to be sent to others however you'd like. (I have to back up my ideas to make myself feel better at least )
But you need to have Tiger to run it.

Automator is awesome, though. GUI scripting with visual feedback is the way of the future. You heard it here first!

I could try and write an Automator action out of whatever Applescript you come up with, if you want.
mdmunoz is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -6. The time now is 06:14 PM.




Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5
© 2004-2008