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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old Feb 16, 2013, 09:56 PM   #1
AlexFW
macrumors newbie
 
Join Date: Feb 2013
Applescript error - stripping file extension

Hi, I'm using OS 10.6.8 on a Macbook Pro.

I'm trying to do something that should be really easy. All I want to do is strip the extension off a file that is sitting on the desktop and which has been selected.

This:
Code:
tell application "Finder"
	set OldName to selection
	set NewName to (characters 1 thru -4) as text
	set selection to NewName
end tell
yields this message:

Can’t make «class docf» "exp.jpg" of «class cfol» "Desktop" of «class cfol» "home" of «class cfol» "Users" of «class sdsk» of application "Finder" into type number.

I read on this forum that that kind of message usually has to do with misplaced parentheses but I tried all kinds of iterations and couldn't get it to work. But I'm not even sure the applescript itself is correct

Appreciate any help you can give,

Alex

Last edited by maflynn; Feb 17, 2013 at 12:45 PM. Reason: Code tags added
AlexFW is offline   0 Reply With Quote

 
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
System Extension Error ?? Washac Mac Pro 2 Apr 27, 2014 09:35 AM
Missing file extension spb3 Mac Basics and Help 4 Apr 3, 2014 12:30 AM
USB Mount Extension Error Slrunna OS X Mavericks (10.9) 0 Dec 10, 2013 03:51 PM
dce extension error? jgmacrum OS X 2 May 29, 2013 03:21 PM
Safari 6.0 extension error message rainbowizard Mac Applications and Mac App Store 1 Jul 29, 2012 10:56 PM

Forum Jump

All times are GMT -5. The time now is 09:35 PM.

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

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