Batch file processing with non-scripting app (Preview)

Well I RTFM and spent MANY hours on macscripter et al, the answer is just not going to come to me. I have some RAW files in an obscure Canon format that is only recognized by Preview, which is not scriptable. I'm dealing with hundreds of files from a stop-motion animation project so batch-processing is a must.
The Goal: Individually open several hundred RAW image files in Preview, then save them as .PICT files in a new directory.
Automator doesn't want to play - it simply refuses to do this as a batch job, so I'm left with manipulating the UI through Applescript. Below is what about 10 hours of head-beating has produced:
-- Start Finder tell block
tell application "Finder"
--Pick files to convert
set SelectedFiles to (choose file with multiple selections allowed)
set filesList to get every file of SelectedFiles
--Begin repeat loop for every file in selection
repeat with aFile in filesList
set theFile to aFile as alias --Set theFile as current target
tell application "Preview" --Open Preview, open the target file
(activate) and (open theFile)
end tell
--Need to manually select "save as PICT", so this opens the prompt
tell application "System Events"
keystroke "s" using command down and shift down
end tell
--Buy some time for the conversion and save process
--(there has GOT to be a better way!)
delay 30
end repeat --loop (with fingers crossed)
end tell
This is a HUGE advance from where I started, trying to repeat for "every file in folder..." which just ain't gonna work on my computer. But, it doesn't do anything beyond getting a list of input files. My output is below:
tell application "Finder"
choose file with multiple selections allowed
{alias "Macintosh HD:Users:mark:Pictures:LEGOS:IMG_0126.CR2", alias "Macintosh HD:Users:mark:Pictures:LEGOS:IMG_0127.CR2", alias "Macintosh HD:Users:mark:Pictures:LEGOS:IMG_0128.CR2"}
end tell
Thanks, my head hurts now. (Why couldn't they just have ported REXX???)

Hiroto, no I didn't have it checked. I don't know why I was able to get as far as I did but enabling access for assistive devices didn't change anything. I am able to emulate /almost/ any keystroke, except the up arrow, which normally allows me to move up in the "file type" selector button. The script below is ... functional ... except that it forces me to save each file as a 58MB uncompressed .tiff, and it refuses to respond to the "close front window" or 'keystroke "W" using command down' scripts. Getting through 300+ files this way will eat up my memory and hard drive in a matter of minutes. I suppose I could '$sh kill ####' from terminal if I could find the window process, but this is getting really hoaky!
THIS SCRIPT OPENS AND SAVES FILES, BUT DISALLOWS ANY TYPE SELECTION OR CLEANUP
set sFiles to (choose file with multiple selections allowed without invisibles)
repeat with aFile in sFiles
tell application "Preview" to run
tell application "System Events" to tell process "Preview"
tell application "Preview"
activate
open aFile
delay 8
tell application "System Events"
keystroke "S" using {command down, shift down}
delay 2 -- opens save as sheet
repeat 7 times
keystroke tab -- tab down to file selector (works fine)
end repeat
click down -- select button (doesn't do anything)
delay 1
keystroke up -- open file button menu (doesn't work)
keystroke up -- select next menu item above (doesn't work)
keystroke return -- shortcut to "save" button
delay 10 -- wait for save
keystroke "W" using command down -- close current window (doesn't work)
end tell
end tell
end tell
end repeat

Similar Messages

  • How to send an attached file containing with non-ascii code ?

    Hi,
    I want to send a attaced text file containing with non-ascii code(Traditional Chinese). Is there any way to solve the encoding problem?
    Currently, it transfer into non-meaningful code in receiving side.
    Thanks for the help in advance.

    Here is the code:
    Session _gSession = null;
    MimeMessage message = null;
    Properties props = new Properties();
    props.put("mail.smtp.host", smtpHost);
    _gSession = javax.mail.Session.getInstance(props, null);
    message = new MimeMessage(_gSession);
    message.setFrom(new InternetAddress(emailSender , emailSender));
    InternetAddress ia[] = new InternetAddress[1];
    ia[0] = new InternetAddress(emailReceiver, emailReceiver);
    message.setRecipients(Message.RecipientType.TO, ia);
    message.setSubject("Test Encoding Attached File");
    message.saveChanges();
    BodyPart messageBodyPart = new MimeBodyPart();
    DataSource fds = new FileDataSource("Big5_Code.txt");
    messageBodyPart.setDataHandler(new DataHandler(fds));
    messageBodyPart.addHeader("Content-ID","meme");
    MimeMultipart multipart = new MimeMultipart("related");
    multipart.addBodyPart(messageBodyPart);
    message.setContent(multipart);
    transport.connect();
    transport.send(message);

  • Q. Any command-line options for Digimarc and Elements 7 batch file processing?

    Q. Any command-line options for Digimarc and Elements 7 batch file processing?

    Are you a digimarc subscriber? You would be better off asking them, if so.

  • Functionality of Files Processed with Photoshop CC

    Adobe has stated that Photoshop CC users will have access to all files saved on their computers.
    What will be the functionality of files processed with Photoshop CC and saved on my computer if I no longer subscribe to Photoshop CC?
    Adobe will introduce new functions such as Camera Shake Reduction to Photoshop CC.  Let's say that I use a new function on a layer or as a Smart Object, and then save it on my computer, and then end my subscription to Photoshop CC.  Will I be able to open the file with my layers intact and editable in any program other than Photoshop CC?
    If I save the files with the layers merged as TIFFs or JPEGs I assume that I will be able to open them with most photo programs. Let's say that I do not save merged files and I am willing to sacrifice the layers.  Will Photoshop CC be required to merge the layers and save as files that can be edited in other programs?  What happens with other file types such as PSDs?
    Let's say I own CS6 or previous versions with perpetual licenses.  Will I be able to open and edit files in CS6 with layers created in Photoshop CC?

    Eric, you need to clear the URL filed before pasting another into it:
    http://davecrossworkshops.com/2013/05/10/moving-files-backwards-photoshop-cc/
    [EDIT]
    Having read the link, it is not quite the disaster Dave Cross makes it out to be.  While the new features would not be directly editable in CS6 or earlier, you could absolutely still use the image data in those layers, and make further edits using the features and tools in whatever copy of Photoshop you were using.  The Shape layer which used the new radius corners tool in CC, is still a shape layer, but even if it had been rasterised, you could select it and turn that selection into a path, and edit that path. 
    I am not so sure about the ACR filter layer.  I'd like to think that the results of using that adjustment layer would be apparent in whatever that adjustment layer had been applied to in Photoshop CC.  So you'd still have the benefit of the edit.  Dave made that over complex by nesting the ACR layer in a smart object, and I could only guess at the consequences of that.  But the bottom line is you could still open a PSD file created in CC, and have all the layers, and most of the information.  You might even have the outcome of all or most of the edits made in CC.  If you are worried, put a copy merged layer at the top of the stack while CC is still working for you, or just keep subscribing to what will continue to be the world’s best raster image editing program. 

  • Background threading + batch file processing

    Hello,
    I have 2 issues in the same project.
    Issue 1:
    I have a project accessing the Object API. I've created a DLL assembly using VB.NET. This assembly is instatiated from a VB form and one of the functions is called using a background thread worker from the from. This code runs normally when NOT running in the background worker. However running in the background worker throws an exception. I have attached some sample code. To test it would will need to create the an interop for the Object API compenent for GroupWise. It ws too big to attach here. My apologizes for that.
    Issue 2:
    In the same project using the same assembly, I am calling the application from a batch file. Again the code runs normally from the debugger, but running the batch file throws an exception instantiating an instance of the Application object.
    If anyone can shine some light on these issues that would be great.
    Thanks
    Tim

    Hiroto, no I didn't have it checked. I don't know why I was able to get as far as I did but enabling access for assistive devices didn't change anything. I am able to emulate /almost/ any keystroke, except the up arrow, which normally allows me to move up in the "file type" selector button. The script below is ... functional ... except that it forces me to save each file as a 58MB uncompressed .tiff, and it refuses to respond to the "close front window" or 'keystroke "W" using command down' scripts. Getting through 300+ files this way will eat up my memory and hard drive in a matter of minutes. I suppose I could '$sh kill ####' from terminal if I could find the window process, but this is getting really hoaky!
    THIS SCRIPT OPENS AND SAVES FILES, BUT DISALLOWS ANY TYPE SELECTION OR CLEANUP
    set sFiles to (choose file with multiple selections allowed without invisibles)
    repeat with aFile in sFiles
    tell application "Preview" to run
    tell application "System Events" to tell process "Preview"
    tell application "Preview"
    activate
    open aFile
    delay 8
    tell application "System Events"
    keystroke "S" using {command down, shift down}
    delay 2 -- opens save as sheet
    repeat 7 times
    keystroke tab -- tab down to file selector (works fine)
    end repeat
    click down -- select button (doesn't do anything)
    delay 1
    keystroke up -- open file button menu (doesn't work)
    keystroke up -- select next menu item above (doesn't work)
    keystroke return -- shortcut to "save" button
    delay 10 -- wait for save
    keystroke "W" using command down -- close current window (doesn't work)
    end tell
    end tell
    end tell
    end repeat

  • TS2296 How do I fix the trouble I am having with non-responsive apps?

    I have the iPhone4, and the ios7 update.
    My problem is that certain apps on my phone have been somewhat unresponsive since the ios7 update. Not even just slow. Things like snapchat will notify my screen that I have a reply, but then the reply doesnt show up in the app. I got one at one point but nearly 12 hours after it was sent and delivered to me according to the other persons phone. Some apps that are supposed to update are also simply not updating, the process starts but the apps stay that way and I can't delete them. Help?
    (I walked into my cellular store and they told me my best bet is to go back to the ios6, i am looking for another solution)

    Ok, now I am stuck:
    Why does my Mac boot its OS from the Flash Drive instead of the INTERNAL HARD DRIVE???a
       If I start up my MacBook Pro, It will have the flashing question mark folder UNLESS i plug in the OS-Boot flash drive. When I at the desktop screen and work on a program, When I unplug the Flash drive, THE OS WILL CRASH AS IF I TOOK it's soul (OS x Lion) out of the body (MacBook Pro Laptop)
    this is frustrating because when I did the INTERNET RECOVERY, When I install OS x Lion, the Flash Drive only show up as an option as opposed to the HDD.
    I cannot format the hard-drive in DISK UTILITY because it's grayed out. This is just frustating. I never had problems with PC Windows OS recovery but this (Mac OS).

  • How to create Batch file to execute sql scripts

    Hi friends,  
          i want to create batch file to execute all my .sql scripts.
    I have all table ( all table scripts in single file ) ,Udds ( all udds in single file ) ,Stored procedures( separate file for each SPs ),Functions ( Separate file for each Functions ),Triggers and views scripts in .SQL file.   
    can anybody tell me how to create batch file for executing all these scripts in sql server ?.   
       while executing, it should ask Database name,server name, password. if these details are given then it should execute my all scripts in given database
    , if any error thrown then that error and procedure name alone have to move to separate log file..
    Please help me if this possible or any other easy way to do this..
    Thanks - Ravi

    Hi  Mate.
    can i save the below details in my batch file parmantly, so that i don't need to provide the details agains again in CMD while i execute this. Please help
    set /p SName=Server Name :
    set /p UName=User Name :
    set /p Pwd=Password :
    set /p DbName=Database Name
    If  i am providing the details before execution of this bat file it will throw error.

  • How change the File Open With list of apps?

    In Bridge CS3, how does one edit the list of applications in the File > Open With menu (also available from the contextual menu for any image).
    The list contains a number of applications that I would never use to open an image, and I would like to add to it, a new image editor (pixelmator) that does not appear in it. I have looked in the Bridge Help and the Preferences dialog and don't see any option to do this.

    OK, I have now learned that Mac OS keeps the list of which apps to open what, in the "launch services database."
    This database can be cleaned up and reset which somewhat simplifies the list that is displayed by the Finder OR by Bridge CS3.
    Here is an article on how to reset the launchdb:
    http://www.macosxhints.com/article.php?story=20031215144430486
    Be sure to read all the way to the end as there are updated instructions down among the comments.
    Here is a thread in the Apple Support forums discussing the same issue, and it includes links to some 3rd-party programs that can reset launch services without use of a lengthy Terminal command:
    http://discussions.apple.com/thread.jspa?messageID=1289317
    Even after rebuilding the launchdb, I find that a large number of apps are "registered" to open JPG files, including Camino, Opera, TextWrangler and others with only a tenuous connection to JPG. I don't understand why this is, and I would still like to find a way to limit the JPG Open-With list to a few graphics programs. But cleaning up the launchdb as described in the linked pages, did get rid of some programs and added some missing ones.
    Hope this actually constructive info is useful to others.
    Dave Cortesi

  • Cfexecute, batch file, and a ftp script

    I have a batch file which works fine when entered in at the
    command prompt;
    C:/temp/mybat.bat
    but when I use cfexecute it fails.
    Now this may be more of a case of what I am calling than CF
    itself.
    here is the output:
    C:\CFusionMX7\runtime\bin>"C:\Program
    Files\Ipswitch\WS_FTP Professional\ftpscrpt" -f
    C:\temp\poolsite.scp Processing Line 1 [CONNECT pacmed -p] Finding
    Host poolsite... Address lookup of "poolsite" failed. It may be
    misspelled, or your computer may not be connected to the network or
    Internet. Also check that your DNS and local name servers are
    properly configured and responding. Failure in command [CONNECT
    poolsite-p] Processing Line 2 [ONSUCCESS SHELL C:/temp/remove.bat]
    Set [ONSUCCESS] action to [SHELL C:/temp/remove.bat] Processing
    Line 3 [MPUT c:/temp/apptTxfr/*.*] Not Connected Failure in command
    [MPUT c:/temp/apptTxfr/*.*] C:\CFusionMX7\runtime\bin>ECHO OFF
    the very odd thing, is again, when I call this from a command
    line, it works fine.
    are there any wrappers or special ways I need to encapsulate
    this when using cfexecute?

    Thank you for the suggestions. The odd thing though, is it
    looks like it calling the batch file just fine. It's just that for
    whatever reason, the ftp client isn't getting fed the paramters
    correctly. Ie
    Processing Line 1 [CONNECT poolsite-p] Finding Host
    poolsite...
    passing -p tells the ftp client to use a prefdefined site
    profile (poolsite), instead of using the hostname poolsite.
    Basically it is if for whatever reason the ftp program is not
    reading it''s scp file correctly when invoked from CF.
    I'll check out the permissions and report back.
    thanks for the suggestion.

  • Kill session through batch file but with DELAY/SLEEP

    respected forum members,
    i have a database 9i release 2 on windows server 2003.
    as we r working in a territory where load shedding (electricity failure) is big problem intervaly. as users r working so there computer shutdown while they are working when there is power failure.
    about 250 sessions are opened in peak hours and i want to kill these sessions.
    so i want to write a batch file which kill session but at the same time I WANT TO PUT DELAY IN THE BATCH FILE which delay for 2 seconds after killing 20 sessions.
    can any body help me to write such a batch file which delays for 2 seconds after killing 20 sessions. HOW to insert DELAY/SLEEP in batch file.
    thanks

    I'm not sure I understand the point of this script. If the power fails and the server goes down, obviously all sessions will be killed. If the power fails and the client goes down leaving database sessions, you would generally want to enable dead connection detection or limit the idle time of a session in the profile so that Oracle can automatically kill those sessions. Manually killing sessions should be a last resort.
    If you really want to write this sort of script, could the batch file simply call DBMS_LOCK.SLEEP to implement the delay? Or do you literally mean that you only want the delay to come from an operating system call?
    Justin

  • File upload with non-ascii name

    I'm designing a system that includes file-uploads. My problem is that any non-ascii chars in the filename are encoded strangely when saved. ä is encoded to å etc.
    I use Tomcat with the -Dfile.encoding="UTF-8" in the Catalina file. I get the same result despite method; my own implementation, apache commons or Javazoom's uploadBean. All the JSP charset parameters are set.
    Any ideas?

    Hi amitads,
    I'm sure u've used Java enough. Also, u must have learned about the \ (backslash) escape character ?
    So, if u want to include a string like a single quote, u can write \' and for a double quote u can write \".
    Try this ... I'm sure it will help.
    Keep me posted.
    Cheers !!
    Sherbir.

  • Need advise on large file processing with good performance

    Hi All,
    I am working on a program in which I have to read millions of records from application server file.For this, I am reading 1 million records each time and uploading into the DB-table.
    what is the best approach to process the millions of records.what I am currently doing is, I read 1 million records one by one , modify each and every record based on some conditions and store them in one internal table and update the DB table.
    I am also thinking alternate approach is,read 1 million into one internal table and after that within the loop, modify each and every records for given condition and update the DB table.
    which approach is the best one?
    you can advise me any other alternate approches with good performance.
    Regards,
    Nivas
    Edited by: Nivas4081 on Jul 24, 2008 2:55 PM

    Hi Joshi,
    Thanks for your reply reply. I have tested both ways as I mentioned in my query but reading record by reocrd and update data packets takes less time than reading into iternal table,then modify and update the DB table.
    Hi ralph,
    Thanks for the reply.
    The modifications are similar in all the lines.I get related data from other class/method,do some calculation and modify each each record.
    Are there any performnace tricks to be followed when processing large amount of data.by the way I am reading certail amount of records say 400K and updating DB table using parallel processing.
    Apart from this, any suggestions on this?
    Regards,
    Nivas

  • File Upload with ASP script

    I'm trying to upload file from Flex2 application using
    FileReference.upload("upload.asp") method. However in asp script I
    can't read any data - no file, no other parameters I'm sending with
    URLvariables. In asp I tried both "Request.Form" and
    "Request.QueryString" with no luck.
    Does anyone have similar example?

    Thanks, leotemp.
    Actually I was planning to have eDeveloper as a server engine
    and use it to accept and save file. Or, when I wasn't succesful,
    use asp script just to pass file to eDeveloper. But according to
    your reply it's not possible. I will use ASPUplad from Persits. Any
    tips will help!

  • Testing BPEL Processes with non-unique activity names

    Hello,
    I intend to use Oracles BPEL Test Framework for testing a set of BPEL workflows. I created a test suite for one process but during the deployment of the test suite i got the message:
    [Error ORABPEL-20043]: Non-unique activity name.
    In the workflow set are a lot of activties with equal names, at least 100, so renaming is not an option. Is there any possibilty to use the Test Framework nevertheless?
    Thanks for your answers.

    Here the answer from Oracle:
    Even if there is little documentation surrounding the need to have unique activity names, this issue will be treated
    as an enhancement from Development point of view.
    Therefore, I was asked to create an Enhancement Request, so that this will be considered for
    implementation in a future release.
    It's not a bug, it's a feature...

  • RAW file processing with Elements 9

    When I open a RAW image taken with a EOS 5D Mk III with Elements 9, I receive a message saying - cannot process file as it is the wrong file type?
    When I attempt to re-open the same file, I receive a message - Could not complete your request because of a program error
    The file size is 24 mb
    Any help wopuld be appreciated.
    Many thanks

    Hi,
    The 5D MK III is not supported by PSE 9. It requires ACR 6.7 or 7.1 which will not apply to PSE 9.
    You can either :-
    1) Update to a newer version of elements
    2) Use the Canon software to covert the raw files to TIF files and then import the TIF files
    3) Download and install the free Adobe DNG Converter. Convert the raw files to DNG files and then import the DNG files into elements.
    Brian

Maybe you are looking for

  • Automatic input of cost center in MIRO

    Hy everybody, I've done a substitution maintenance for automatic cost center input depending on the store of the purchase order and/or the store of inbound delivery. Everything is allright. Now when I go to the tc MIRO and I've a different amount bet

  • W2207 volume problem?

    Hi there, i was wondering if anyone could help me with a problem im having... it seems like my volume button/settings are stuck on my monitor.  It flashes on and off changing the volume (reducing it always) but it is getting worse and i cant get rid

  • Extracting unique values from (non-category) columns for chart

    Hello: I've created a worksheet to keep inventory of my Intellivision games.  It has the following columns: Publisher Class Network Title Quantity (misc...) The "Class" represents whether the game is "complete in box" or "loose cartridge."  The "Netw

  • DB row lock from servlet.

    Hi to all, we're developing a J2EE application (with NO Ejb, actually we cannot use them) in which users can select orders from a DB2 database, modify the order, or create a new order. Any order is implemented by a class (Order.java) that exposes met

  • Lost my project (.fla) but got my (.flv)

    Hi everyone, my problem is that my old computer *exploded* last week and i was making a project for my dad so I lost my (.fla) file. But, I have an animation of that same project in (.swf) on my USB Key because I've exported it just before my compute