Please help converting filenames
Thanks a lot for your help
I am trying to set the creation date as the new file name in series of files within a folder
I try to modify various scripts I found for my purpose
[applescript]
set source_folder to choose folder with prompt "Please select directory."
set destination to choose folder with prompt "Please select directory."
tell application "Finder"
set file_list to every file of folder source_folder
end tell
tell application "Finder"
launch
try
duplicate source_folder to destination
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try
repeat with aFile in file_list
set file_info to info for (aFile as alias)
set file_creation_date to creation date of file_info
set tPath to quoted form of (POSIX path of aFile)
set tName to name of (info for aFile)
set MD to do shell script "mdls -name kMDItemContentCreationDate " & aFile
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "= ("
set tDates to text item 1 of MD
set AppleScript's text item delimiters to ")"
set tDates to (text item 1 of tDates) as text
set AppleScript's text item delimiters to TID
set dateInfo to text 30 thru -1 of tDates
set newFilename to dateInfo
try
tell application "Finder" to set name of aFile to newFilename
end try
end repeat
end tell
[/applescript]
the error I get is:
Can’t make «class docf» "10 - TXT.doc" of «class cfol» "result" of «class cfol» "newfolder" of «class cfol» "ecco" of «class cfol» "my folder" of «class cfol» "Documents" of «class cfol» "ZZZ" of «class cfol» "Users" of «class sdsk» of application "Finder" into the expected type.
OK, to do that you just need to tell the Finder to duplicate the file first (you had originally set a destination folder, but didn't do anything with it) - note that there isn't any error handing (a duplicate file name for example), the script just logs the error:
set source_folder to (choose folder with prompt "Please select source directory.")
set destination to choose folder with prompt "Please select destination directory."
tell application "Finder"
set file_list to every file of folder source_folder as alias list
end tell
repeat with aFile in file_list
set tPath to quoted form of POSIX path of aFile
set newFilename to (do shell script "mdls -name kMDItemContentCreationDate -raw " & tPath)
set TID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set pieces to text items of newFilename
set AppleScript's text item delimiters to "-"
set newFilename to pieces as text
set AppleScript's text item delimiters to TID
try
tell application "Finder"
set copiedFile to (duplicate aFile to destination)
set name of copiedFile to newFilename
-- set name of copiedFile to text 1 thru 19 of newFilename -- strip off time offset
end tell
on error errorMsg number errorNum
log errorMsg
end try
end repeat
You can find information about the AppleScript language in the AppleScript Language Guide, and an application's scripting dictionary (if it has one) can be opened in the AppleScript Editor to view the additional commands that it provides.
Similar Messages
-
Please help convert 8.2 vi to 8.0 (urgent)
Hi all,
Could anyone please help me convert the attached vi to labview 8.0. Thanks
Attachments:
Google_Earth-LV.llb 199 KBTry this...
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Google_Earth-LV_80.llb 197 KB -
Please help convert MSSQL Stored Procedure to Oracle PL/SQL
Hi there to all,
this be my first post to these forums. I have already posted this question on a microsoft msdn forum, until someone advised that I ask my question here - dunno why I didnt think of that! ?:|
Im working with an Oracle 10g Database from an ASP.NET 2.0 application, and want to know if it Oracle supports OPENXML (rhetorical question I fear!). The reason I ask is because I want to create an Oracle Stored Procedure that will accept an XML string as an input parameter, prepare it, select from it, and then insert it into an Oracle table.
I have done this successfully in SQL server using the following as an example:
CREATE PROCEDURE [dbo].[Employee_INSERT]
bq. @INSERTRECORD XML
AS
BEGIN
bq. DECLARE @XDOC INT; \\ EXEC sp_xml_preparedocument @XDOC OUTPUT, @INSERTRECORD; \\ INSERT INTO [dbo].[REC_Employees] (
bq. bq. [EMPTITLE], \\ [EMPFNAME], \\ [EMPLNAME], \\ [EMPDEPTID], \\ [EMPBEGINDATE], \\ [EMPACTIVE], \\ [EMPDATEADDED]
bq. )
bq. SELECT
bq. bq. [EMPTITLE] = Title, \\ [EMPFNAME] = Firstname, \\ [EMPLNAME] = LastName, \\ [EMPDEPTID] = DepartmentID, \\ [EMPBEGINDATE] = StartDate, \\ [EMPACTIVE] = IsActive, \\ [EMPDATEADDED] = GETUTCDATE()
bq. FROM
bq. bq. OPENXML(@XDOC, '/EMPREC/Table', 2) \\ WITH (
bq. bq. Title VARCHAR(10), \\ FirstName VARCHAR(50), \\ LastName VARCHAR(50), \\ DepartmentID INT, \\ StartDate DATETIME, \\ IsActive BIT
bq. bq. );
bq. EXEC sp_xml_removedocument @XDOC;
END
I would sincerely appreciate any help in this regard!
PS - Please excuse the formatting!
Much Thanks!
regards
shalanAssuming your table is named DESTINATION
Name Null? Type
TITLE VARCHAR2(10)
FIRSTNAME VARCHAR2(50)
LASTNAME VARCHAR2(50)
DEPARTMENT NUMBER
STARTDATE DATE
ISACTIVE NUMBERYou can use a procedure like:
create or replace
procedure test (p_xml in xmltype)
is
begin
insert into destination
select title
, firstname
, lastname
, department
, to_date (startdate, 'yyyy-dd-mm hh24:mi:ss') startdate
, isactive
from (xmltable ('/EMPREC/Table' passing p_xml
columns title varchar2(5) path 'Title'
, firstname varchar2(10) path 'FirstName'
, lastname varchar2(10) path 'LastName'
, department number path 'Department'
, startdate varchar2(20) path 'StartDate'
, isactive number path 'IsActive'
) temp
end test;to create records in the table
Removed a unnecessary SELECT FROM DUAL...
Edited by: Alex Nuijten on Jan 19, 2009 2:24 PM -
I never learnt as2 and I just purchased a fla file from a stock sight thinking it was in as3 and it isn't!!! doh
can anyone help me convert this from as2 to as3:
stop();
import flash.filters.*;
//--------------variables to change--------------------------//
//set this value to true if you want sparkles to be created from the mouse
//and false if you want automatic sparkles
var createSparklesFromAnyMouse:Boolean = true;
//set to true if you want sparkles to stop being created when the mouse
//is still
var createSparklesFromClick:Boolean = false;
//modify the size of the sparkles
var maxSparkSize:Number = 18;
var minSparkSize:Number = 8;
//increase this value to shorten the life, 0 to live forever
var fadeSpeed:Number = 10;
//the speed the sparkles fall, higher number quicker the speed
var speed:Number = 1;
//choose whether you want the sparkle colour to be random
var randomColour:Boolean = true;
//if you don't want a random colour pick a default colour
defaultColour = 0xFFffFF;
//do not modify code below here...
var sparkle:Number = 0;
var mousePosX:Number;
var mousePosY:Number;
var whichBat:Number;
var count:Number = 0;
this.createEmptyMovieClip("empty",this.getNextHighestDepth());
howToCreate();
function howToCreate() {
if (createSparklesFromClick == true) {
trace("create sparkles every time I click the mouse");
//create sparkles from mouse clicks
activateClick();
} else {
if (createSparklesFromAnyMouse == true) {
trace("create sparkles from the mouse");
//create sparkles from the mouse
this.onEnterFrame = function() {
createSparkle();
createSparkle();
} else {
trace("create sparkles every time I move the mouse");
//create sparkles ONLY when the mouseMoves
createWhenMoving();
function createWhenMoving() {
this.onEnterFrame = function() {
if (mousePosX != _root._xmouse && mousePosY != _root._ymouse) {
createSparkle();
mousePosX = _root._xmouse;
mousePosY = _root._ymouse;
function activateClick() {
empty.onMouseDown = function() {
this.onEnterFrame = function() {
createSparkle();
empty.onMouseUp = function() {
delete this.onEnterFrame;
function createSparkle() {
movingSparkle = this.attachMovie("colouredSparkle", "s_"+sparkle, sparkle);
movingSparkle2 = this.attachMovie("colouredSparkle", "ss_"+sparkle, sparkle+100);
sparkle++;
if(sparkle>100){
sparkle = 0;
setParams(movingSparkle);
setParams(movingSparkle2);
function setParams (movingSparkle){
movingSparkle._x = _root._xmouse+randRange(-8, 8);
movingSparkle._y = _root._ymouse+randRange(-15, 0);
movingSparkle._xscale = movingSparkle._yscale=Math.random()*maxSparkSize+minSparkSize;
movingSparkle._rotation = randRange(0, 360);
if (randomColour == true) {
col = Math.round(Math.random()*0xFFFFFF);
} else {
col = defaultColour;
colouredFill = new Color(movingSparkle.colour_mc);
colouredFill.setRGB(col);
colouredFill = new Color(movingSparkle.white_mc);
colouredFill.setRGB(col);
moveSparkle(movingSparkle);
function moveSparkle(movingSparkle) {
var ySpeed = randRange(0, speed);
var rot = randRange(-15, 15);
var blurX = randRange(2, 5);
var blurY = blurX;
var blurFilter = new BlurFilter(blurX, blurY, 3);
movingSparkle.white_mc.filters = [blurFilter];
movingSparkle._alpha = randRange(85, 100);
var alphaDrop = randRange(1, fadeSpeed);
movingSparkle.onEnterFrame = function() {
//change speed
this._y += ySpeed;
//change rotation
this._rotation = this._rotation+rot;
//make it smaller
this._xscale = this._yscale=this._xscale*0.98;
//fade the sparkle
this._alpha = this._alpha-alphaDrop;
//remove the movieclip if it get tiny
if (this._alpha<10) {
this.removeMovieClip();
delete this.onEnterFrame();
if (this._height<4) {
this.removeMovieClip();
delete this.onEnterFrame();
function setColour(mc, col) {
colourIt = new Color(mc);
colourIt.setRGB(col);
function randRange(min:Number, max:Number):Number {
var randomNum:Number = (Math.random()*(max-min))+min;
return randomNum;Zhanbolat,
In theory, conversion of this code is not difficult, especially because it is clear what the logic is designed to do. The issue is that you will not have an expected result once only this code is converted in isolation. This puppy uses some other objects that are written in AS2 including entities in the FLA library.
In short, it looks like this application needs a total overhaul at every level in order for it to properly function as an AS3 program.
With that said, although this is, again, not a difficult task, it is unlikely to find someone to do it for free. You may have a better luck if you start conversion yourself and post focused questions as you go. -
Please help - convert Flash8 to MX 2004
I really need a tutorial file converted from Flash 8 to MX
2004. Can someone help? My students await.... :)PM me. Maybe I can help.
-
Please help converting i-tunes from old computer to new computer!!?
Hi there,
Please keep in mind I am not very computer literate and therefore although I am sure this is a very easy question I can't do it and I need some help!!!
I have upgraded my old computer. This had my i-tunes on it, however after a while it got so slow I started to keep music on an external hard drive, which resulted in my music files being split. I have now dragged and dropped everything on to my hard drive under one folder (I think) and I now want to put this on to my new computer.
Well actually I want to keep my library on the hard drive so that anything I download etc goes on to there (this computer is just a stop gap for now). I have changed the file location in preferences but cannot seem to get it to pick up the music from the hard drive!!!
What do I do!!? Any help appreciated...!
Thanks in advanceHello and Welcome to Apple Discussions.
This Apple article (link) explains how to move your music library between computers and in addition it explains how you can ensure all your music is consolidated into one location. Hopefully that will cover everything you need.
kind regards
mrtotes -
Please help-converting 7 to 8 project
Can you convert a Captivate 7 project to Captivate 8 seamlessly? My videos will not play in Captivate 7 in the HTML browser but work when I tried in in Captivate 8. I''ve built the course in 7 and don't want to ruin anything converting to 8
So you converted your CP7 project and saved it in 8 and had no issues? I opened my project up in CP8 (not realizing I was in CP8) and it worked flawlessly. My worry is that since I built the project in 7, converting to 8 would cause more issues.
-
I really need someone to help me. I have been trying to figure out how to select a PDF document to convert to a Word doc. When I go to select a PDF file, all that shows up is the WORD docs. does not show ANY of my PDF files... Please help me figure out what is going on? We have it set on auto renewal so I know its not that we haven't renewed this subscription, because we pay automatically.
Hi olivias,
It sounds like there may be some confusion on your system about what application should be associated with PDF files. You can reset filename associations by following the steps in these articles (depending on your operating system):
How to change the default application for a file type | Macworld
http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
Please let us know if you have additional questions.
Best,
Sara -
Hello,
I honestly have tried reading the other answers and researching to try to solve this problem. I'm sorry for my ignorance in this area. Please help!!!
I'm trying to make a script (for Illustrator CS2) that will batch convert several files to PNG files. The source folder has several subfolders and I need the script to go into the subfolders and convert those files as well. The destination directory should be an entirely separate folder but with the same hierarchy as the original source folder.
The script I have been using (that converts just as I need) is below. The only problem is it doesn't do the subfolders.
Any help would be so amazingly appreciated!
ADOBE SYSTEMS INCORPORATED
Copyright 2005 Adobe Systems Incorporated
All Rights Reserved
NOTICE: Adobe permits you to use, modify, and
distribute this file in accordance with the terms
of the Adobe license agreement accompanying it.
If you have received this file from a source
other than Adobe, then your use, modification,
or distribution of it requires the prior
written permission of Adobe.
ExportDocsAsPNG24.jsx
DESCRIPTION
This sample gets files specified by the user from the
selected folder and batch processes them and saves them
as PNGs in the user desired destination with the same
file name.
// Main Code [Execution of script begins here]
// uncomment to suppress Illustrator warning dialogs
// app.userInteractionLevel =
UserInteractionLevel.DONTDISPLAYALERTS;
var destFolder, sourceFolder, files, fileType,
sourceDoc, targetFile, pngExportOpts;
// Select the source folder.
sourceFolder = Folder.selectDialog( 'Select the folder
with Illustrator files you want to convert to PNG', '~'
// If a valid folder is selected
if ( sourceFolder != null )
files = new Array();
fileType = prompt( 'Select type of Illustrator files
to you want to process. Eg: *.ai', ' ' );
// Get all files matching the pattern
files = sourceFolder.getFiles( fileType );
if ( files.length > 0 )
// Get the destination to save the files
destFolder = Folder.selectDialog( 'Select the
folder where you want to save the converted PNG files.',
'~' );
for ( i = 0; i < files.length; i++ )
sourceDoc = app.open(files[i]); // returns
the document object
// Call function getNewName to get the name
and file to save the pdf
targetFile = getNewName();
// Call function getPNGOptions get the
PNGExportOptions for the files
pngExportOpts = getPNGOptions();
// Export as PNG
sourceDoc.exportFile( targetFile,
ExportType.PNG24, pngExportOpts );
sourceDoc.close
(SaveOptions.DONOTSAVECHANGES);
alert( 'Files are saved as PNG in ' + destFolder
else
alert( 'No matching files found' );
getNewName: Function to get the new file name. The
primary
name is the same as the source file.
function getNewName()
var ext, docName, newName, saveInFile, docName;
docName = sourceDoc.name;
ext = '.png'; // new extension for png file
newName = "";
for ( var i = 0 ; docName[i] != "." ; i++ )
newName += docName[i];
newName += ext; // full png name of the file
// Create a file object to save the png
saveInFile = new File( destFolder + '/' + newName );
return saveInFile;
getPNGOptions: Function to set the PNG saving options of
the
files using the PDFSaveOptions object.
function getPNGOptions()
// Create the PDFSaveOptions object to set the PDF
options
var pngExportOpts = new ExportOptionsPNG24();
// Setting PNGExportOptions properties. Please see
the JavaScript Reference
// for a description of these properties.
// Add more properties here if you like
pngExportOpts.antiAliasing = true;
pngExportOpts.artBoardClipping = true;
pngExportOpts.horizontalScale = 300.0;
//pngExportOpts.matte = true;
//pngExportOpts.matteColor = 0, 0, 0;
pngExportOpts.saveAsHTML = false;
pngExportOpts.transparency = true;
pngExportOpts.verticalScale = 300.0;
return pngExportOpts;You can turn off some of the dialogs with: app.displayDialogs = DialogModes.NO;
#target photoshop
if (app.documents.length > 0) {
//Turn display dialogs off
app.displayDialogs = DialogModes.NO;
//=============Find Current Documents path================//
var CurrentPath = activeDocument.path;
//=============Establish current documents destination===============//
var folder1 = Folder(CurrentPath + '/' + 'Flats');
//=============Check if it exist, if not create it.============//
if(!folder1.exists) folder1.create();
//=============Establish current documents file name=========//
//Current filename without the extension
var CurrentFileName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
//=============Modify current file name================//
var modifiedFileName = CurrentFileName +"Flat.psd";
//=============Establish save path====================//
var saveFileCurrentPath = new File(folder1 + '/' + modifiedFileName);
//=============Flatten document ====================//
activeDocument.flatten();
//=============Rotate document if in 'Landscape'====================//
var myDocument = app.activeDocument;
if (myDocument.width > myDocument.height) myDocument.rotateCanvas(90);
//============Save File=======================//
psdSaveOptions = new PhotoshopSaveOptions();
activeDocument.saveAs(saveFileCurrentPath, psdSaveOptions, true, Extension.LOWERCASE);
//Close Document
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); -
problem opening mail attachments...were opening seamlessly on os 7.0...get an error
Filename
Office open XML document/presentation
File size
Does anyone have a solution? Please help.Hi Charlotte,
You don't say what your version of Windows you have. Assuming XP, go to Start | Run, type DXDIAG and click OK. Click the Sound tab and run the tests to eliminate a hardware problem first of all. If you don't hear anything, check your cables first of all. Also make sure "Mute" isn't checkmarked in your sound setup. You'll find that in Windows Control Panel.
Which browser do you use? If you have Firefox 4, sign up to the HTML5 trial @ http://www.youtube.com/html5
HTML5 is the latest video standard and doesn't require Flash player. Google is in the process of converting all its files to work with the new format. It may solve you problem. If you don't have Firefox 4, you can get it from here: http://www.mozilla.com/en-US/firefox/fx/
IE8 doesn't support HTML5.
To clean out your temp files, go to Start | Run, type: CLEANMGR and click OK. Click OK again to start the utility. Tick all the boxes except "Compress old files" because the latter takes too long, and then click OK. You can run this utility any time you wish by the way.
The above steps will hopefully fix your problem. If not, post here again please. -
Not able to convert string attribute to number and date please help me out
not able to convert string attribute to number and date attribute. While using string to date conversion it shows result as failure.As I am reading from a text file. please help me out
Hi,
You need to provide an example value that's failing and the date formats in the reference data you're using. It's more than likely you don't have the correct format in your ref data.
regards,
Nick -
Very confused Mini DVI to Video Converter - please help!
I have a iBook G4 that I use as my home ents hub, I purchased a DVI to Video converter which worked well for about a week until one day my Mac started recognising it as a VGA adapter.
When the adapter's plugged in the only options in the displays preferences panel are for VGA resolutions, no PAL or NTSC settings and I get a squiggly black screen on my TV.
The adapter works perfectly well with my friend's identical iBook and on his iMac too.
The mini DVI port on my mac works fine when hooked up to a VGA monitor.
HELP!!!! Until I get this fixed I'm stuck watching Lost on a 12" screen, which *****.I have the exact same problem. For years my iBook has output happily to the tv via the Mini-VGA -> Composite/SVIDEO adaptor. Suddenly it stopped working and recognizes the adaptor as a VGA-Monitor.
I've tried resetting the PMU, flashing the PRAM and NVRAM, "shoving" the cable into the socket, deleting com.apple.windowserver.plist files...
Please help... -
I have tried everything I can try, I figured downloading them from Itunes they would go straight onto my Nano, but it wont let me put any of them on there, I cannot find anything anywhere on the internet, nothing, I am so furious, I have converted them to any and every possible format, and this fking thing will not load one of them, so before I finally lose it(my temper) and destroy my brand new Nano, can someone please please help me, I am generally pretty well versed in this kind of stuff, and can figure things out, but nothing I do will let me do anything, I am stuck, and this is not acceptable, and will possibly be the last time I purchase anything other then a desktop from Apple, they are not making things easier and more convienent, they are making things harder and more monotonous, can somebody please point me to what im doing, or not doing? thank youj
In iTunes, do Store->View my AppleID
Click "Deuthorize ALL"
Then, on any computers you still have, do Store->Authorize this computer. If there are less than 5, you will have no problem.
You can only do "deauthorize all" once a year, so in the future, if you ever throw a computer away, remember do to "Store->Deauthorize this computer" first. -
as per title - i have a multipage PDF that i want to transfer into a multilayered PSD.
not one by one - but automatically.
my attempts of recording a set of actions failed.
Please help.This would likely need Scripting at least.
But like station_two indicated people might feel more inclined to help if the necessity for the process were clearer.
And converting pdfs into pixel images is often a bad choice. -
I know that how to convert any documents to pdf file, but don't know how to get barcode on it. I am using windows 8.1. and want to see barcode on my documents before the print. Please help.
Hi Frank ,
Please refer to the following link and see if this helps.
https://helpx.adobe.com/acrobat/kb/error-organizer-database-damaged-reset-1.html
Regards
Sukrit Dhingra
Maybe you are looking for
-
I am currently running an Solaris 10 x86 Beta 6 on an ASUS A7V600-X mainboard. This mainboard supports SATA of which I have two 160gig drives installed. Is my understanding correct that these drives are not supported?? Solaris 10 recognizes that thei
-
Hi everyone, My problem is I just cant organize my regions in the way I want and I'm wondering if someone could help me out. This is a sketch of what I'm trying to do: !http://img682.imageshack.us/img682/294/regions.jpg! As you see I want 2 regions o
-
Hi, this is he requirement for ISU non energy price which is maintained in SD . the requirement is as follow 1 Need to add a new field for special type of customer PSR..which is not available in standard sap. 2 I need to detrmine pricing custo
-
Removing free space in DMG file
I have a 7GB .dmg file that I'm trying to burn to a DL DVD. When mounted (and in Disk Utility), the file shows as having 1.2GB of free space. If I try to burn it in Toast 10 or Disk Utility, I get an error saying that my blank DL DVD can't fit the 8.
-
Unable to receive verification email in apple I'd?
Why can't my main email not receiving verification email ? My rescue email could receive verification email immediately after iPad setup.