A script for moving files to folder ? or relaunch photoshop

I'm looking for a very simple java script to check file corruption
it should:
1.open a file I send to it (via droplet)
2.if it works > close the file > send the file to a folder like c:/checked/
3.if the open sequence crashes or doesn't work > re launch photoshop
4.mark the file as beeing corrupt or send it to a another folder
I don t know how to move a file via java script without saving
I don t know how I can relaunch ? force-quit photoshop ? is this even possible ?
Regards

Anstellos1 wrote:
xbytor2 > thats the exact problem I'm having. If there is a "wrong" file into my batch, photoshop stop/ crash, is waiting for an action on my side... the whole idea of using photoshop droplets is to do it without me.
Should I parse the files (I have jpegs; png and raws... parsing raws ?)? Would it be better like someone said to use a script that "try catch"? (no idea what it is or how to write this). I also red that photoshop image processing is skipping bad files, is that true ? how could I apply this technique ?
bad file > skip > no crash > process continue running would be even better than the original validation idea
"Unfortunately, there are types of jpeg corruptions that cause PS to  throw up a 'Broke File' dialog in spite of how you open the file or have  your DialogModes preferences set. PS just stops cold waiting for user  interaction. I'll see if I can locate one of these that I used to test  with. The last time I looked at this problem in depth (CS2 or CS3) PS  was still misbehaving.
xbytor2 if much more of an expert than I am in the script area so will have to defer to him"
I would have to defer to xbytor2 since he is much more of an expert than I in scripting.  If the Try....Catch construct does not work, than Image Processor in PS and also accessed by Bridge would fail under the same circumstances since that is the construct  that script uses.  Interesting
"How would you write that ? Are you saying that if I use this script  at the beginning of my photoshop droplets, it won't crash on a bad file and continue looping on the next ?:"
If you want to use the Try...Catch constructs looking at the Image Processor Code from ExtendScript ToolKit (or other script editor) would let you see how it operates.  They use the Try...Catch construct in multiple locations in that script.
At the highest level in Image Processor here is the basic code below for the Try...Catch construct with most everything else stripped out.
There are two main steps. One is to set the app.displayDialogs mode to NO. The second is to use the try...catch construct below.   The error routine is the catch portion of the code just displays the error code.  Then the dialog mode is reinstated to the original settings set by the User.   The same construct is used deeper into the code so that would be a source of at least the approach Image Processor uses.
try {
    // remember the dialog modes
    gSaveDialogMode = app.displayDialogs;
    app.displayDialogs = DialogModes.NO;
    Code you want to execute goes here
// Lot's of things can go wrong
// Give a generic alert and see if they want the details
catch( e ) {
    if ( e.number != 8007 ) { // don't report error on user cancel
        alert( e + " : " + e.line );
// restore the dialog modes
app.displayDialogs = gSaveDialogMode;

Similar Messages

  • Need script for moving files to specific directories base on csv

    Hi,
    I have a question. I have about 2000 files (pdf), which I need move to specific directories and subdirectories, which are based on csv file.
    Csv is looking like this:
    filename;directoryname;subdirectoryname;subdirectoryname;.......etc.
    I have a script for creating directories with subdirectories from csv file, but I need this script for moving files to this directories.....
    Thanks a lot for every help.
    Best Regards
    Petr, OS X Mavericks

    private function snapshotLastFrame():void
    gotoAndStop( this.totalFrames );
    _bitmapData                         = new BitmapData( stage.stageWidth, stage.stageHeight );
    _bitmap                              = new Bitmap( _bitmapData );
    _bitmapData.draw ( stage );
    saveImageJPG( _bitmapData, "test.jpg", 96 );
    public function saveImageJPG( bitmapData:BitmapData, fileName:String, quality:int ):void {
                this.jpgEncoder = new JPGEncoder( quality );
                this.fileReference = new FileReference();
                this.fileReference.save( this.jpgEncoder.encode( bitmapData ), fileName + ".jpg" );
    Keep in mind that you need a few extra libraries to be able to create a jpeg.. (AS3CoreLib) can be found at googleCode.

  • Script for moving files and directory to archive

    Hi,
    I've search the web for good working script to archive my files and folder with no luck.
    do you have a script that move and preserve the structure of older files and folders that have not been accessed for X days?

    Hello, I found this quite quickly in the TechNet Gallery. It seems like it would do what you're looking to do.
    https://gallery.technet.microsoft.com/Archive-old-files-with-042f859a
    # Powershell script - move old files to an archive location.
    # Writes log files to $logpath
    # Ver 0.6
    $path = "C:\TEMP"
    $archpath = "D:\TEMP-ARCH"
    $days = "30"
    $logpath = "C:\Temp"
    $date = Get-Date -format yyyyMMddHHmm
    write-progress -activity "Archiving Data" -status "Progress:"
    If ( -not (Test-Path $archpath)) {ni $archpath -type directory}
    Get-Childitem -Path $path -recurse| Where-Object {$_.LastWriteTime -lt (get-date).AddDays(-$days)} |
    ForEach { $filename = $_.fullname
    try { Move-Item $_.FullName -destination $archpath -force -ErrorAction:SilentlyContinue
    "Successfully moved $filename to $archpath" | add-content $logpath\log-$date.txt }
    catch { "Error moving $filename: $_ " | add-content $logpath\log-$date.txt }

  • How to display the Get info window for a file or folder

    Hello,
    How can I display the Get Info window for a file or folder using Applescript - instead of selecting it in the finder and using Command-I ?
    Thanks.
    lenpartico

    The item property that the Get Info was opened for is read only, so it doesn't look like you can just throw a file path at it. You could do something like telling the Finder to reveal the item, then keystroke the command, e.g.:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Finder"
    reveal "Path:to:your:file"
    activate
    end tell
    tell application "System Events" to keystroke "i" using {command down}
    </pre>
    ... but this doesn't seem to be much different than the regular method. There are other methods to get various information, what are you wanting to do?
    Edit:
    Hmmm, I could have sworn (I do a lot of that these days) I tried Hiroto's method, but that does work. It still seems to be a roundabout way of doing something though.
    Message was edited by: red_menace

  • Nikon D750 can you tell me when you launch a camera plug in for Raw file, Then I can use photoshop elements 13. I have now a trail version

    can you tell me when you launch a camera plug in for Raw file, Then I can use photoshop elements 13. I have now a trail version

    For that Nikon model you need ACR 8.3 that means CS6 or CC.  Or you can download the DNG converter convert your Nikon RAW files to Adobe RAW files. And then process the Adobe RAW files with CS5 ACR version  6.7
    Camera Raw plug-in | Supported cameras

  • Shell script for moving and renaming files

    I'm not so familiar with shell scripts. I have created some simple scripts for various tasks but now I hit something I can't handle myself.
    My server receives every night a logfile from another server. This file I need to rename and move to another location. Problem is that a simple mv with new filename isn't enough, I need to insert date in filename. Format for date should be ddmmyy. Also the name of incoming file changes every night. The output always starts with same letters, let's say "log", and the date is used to identify files.
    For example I receive a file /Input/filename.log and I need to move the file to the folder /Output with name log130308.txt.
    Any tips how to insert the date as part of of filename while renaming or moving the file? I prefer shell script as I'll use launchd for scheduling the script.

    Hi again,
    so far I've constructed this:
    cd /input
    for file in `ls *log`
    do
    echo "Copying " $file
    cp $file /output/log.$file.`date +%d%m%y`
    done
    Quite there. I'm cding to directory, i'll focus later how to set some environmental parameters.
    Problem with zipping is that I don't know exact logfiles names. Each day there's a new name. So zip -q filename.zip filename.log isn't quite enough and it's impossible to use wildcards. The switch -q and checksums were welcome suggestions.
    Thanks again,
    Juha
    Message was edited by: J.Otava

  • Catalog corruption when moving files in folder view

    LR 1.3.1 MacOS 10.5 (although also happened with 10.4)
    I've been using LR since the free beta and have over 6,000 images in my catalog. I shoot Nikon cameras almost always in RAW + JPEG. I used to add the jpegs as separate images, but now use them as my previews.
    I recently became low on space on my system hard drive and attached an external FW 800 500GB disk that I decided to store my photos on. Using LR, using the folder view, I moved my images from the hard drive onto the external FW disk. Now, all the NEF's that I imported as NEF+JPEG are "corrupted". Specifically, when I look at them in Grid view, the thumbnails look "OK", however underneath the file name (eg: _DSCXXXX) it now says "JPG+JPEG" instead of "NEF+JPEG". When I go into Edit mode to look at the preview though, the initial image looks "normal" however I get a message saying "Rendering: Settings changed ..." and then the image looks ..... weird, perhaps cross processed or something, and then going back to Grid mode the thumbnail is now changed. If I say to show the file in Finder, it shows me the JPG file, not the NEF file. It's like the NEF file has disappeared. All the NEF's that I loaded without the accompanying JPEG are fine.
    I had the same problem over 1 year ago and we filed a bug against LR but never heard anything back. I'm hoping that someone else has encountered this problem and can suggest how to fix the corrupted database. Otherwise, I will have to revert to a backup catalog and try "re-finding" the files on the new FW drive.
    Thanks,
    Janice

    I'm simply using the JPEG's as previews so there is no separate "file" in LR for them so I can't delete them from LR. I suppose I could delete all the files out of the catalog and reimport them .... that sounds fun ... since they are keyworded and some are modified it makes more sense to revert to a backup and hope I can refind them. Perhaps deleting the ... Previews.lrdata file (not folder) might do it as you suggest but I'm a bit reticent just yet.
    I don't want to take this thread off topic, but will have to look around a bit to find out why someone would not want to have both as "originals" as you indicate.
    Thanks for taking the time to suggest,
    Janice

  • Run Script for opened files

    Hi,
    I once got a script by this thread (http://forums.adobe.com/thread/962689)
    That script gets Indesign files from a specific folder,
    now I want to change this script, so it can be used for allready opened Indesign files.
    Below is the original script (with huge thanks to Muppet Mark)
    #target indesign
    function exportFolder() {
               var i, inFolder, idFiles, doc, offSet, pdfPre, pdfFile;
               inFolder = Folder.selectDialog( 'Where\'s the folder of ID files?' );
               if ( inFolder == null ) { return };
              idFiles = inFolder.getFiles( '*.indd' );
              for ( i = 0; i < idFiles.length; i++ ) {
                        doc = app.open( idFiles[i] );
                        offSet = doc.documentPreferences.documentBleedTopOffset;
                        if ( offSet == 0 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 3 mm snit + slug' ) };
                        if ( offSet == 3 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 3 mm snit + slug' ) };
                        if ( offSet == 5 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 5 mm snit + slug' ) };
                        if ( offSet == 10 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 10 mm snit + slug' ) };
                        if ( offSet == 11 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 11 mm snit + slug' ) };
                        if ( offSet == 12 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 12 mm snit + slug' ) };
                        if ( offSet == 13 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 13 mm snit + slug' ) };
                        if ( offSet == 14 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 14 mm snit + slug' ) };
                        if ( offSet == 15 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 15 mm snit + slug' ) };
                        if ( offSet == 16 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 16 mm snit + slug' ) };
                        if ( offSet == 17) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 17 mm snit + slug' ) };
                        if ( offSet == 18 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 18 mm snit + slug' ) };
                        if ( offSet == 19 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 19 mm snit + slug' ) };
                        if ( offSet == 20 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 20 mm snit + slug' ) };
                        pdfFile = File( doc.fullName.toString().replace( '.indd', '.pdf' ) );
                        doc.exportFile( ExportFormat.pdfType, pdfFile, false, pdfPre, '', false );
                        doc.close( SaveOptions.NO );
    exportFolder();

    Hi jocstone_me,
    I modified your JS code, Please try the below code its working.
    #target indesign
    function exportFolder() {
    var i, inFolder, idFiles, doc, offSet, pdfPre, pdfFile;
    inFolder = Folder.selectDialog( 'Where to save the InDesign files?');
    if ( inFolder == null ) { return };
    idFiles = app.documents.length;
    for ( i = 0; i < idFiles; i++ ) {
        doc = app.documents[i];
        doc = app.activeDocument;
        offSet = doc.documentPreferences.documentBleedTopOffset;
        if ( offSet == 0 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 3 mm snit + slug' ) };
        if ( offSet == 3 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 3 mm snit + slug' ) };
        if ( offSet == 5 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 5 mm snit + slug' ) };
        if ( offSet == 10 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 10 mm snit + slug' ) };
        if ( offSet == 11 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 11 mm snit + slug' ) };
        if ( offSet == 12 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 12 mm snit + slug' ) };
        if ( offSet == 13 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 13 mm snit + slug' ) };
        if ( offSet == 14 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 14 mm snit + slug' ) };
        if ( offSet == 15 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 15 mm snit + slug' ) };
        if ( offSet == 16 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 16 mm snit + slug' ) };
        if ( offSet == 17) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 17 mm snit + slug' ) };
        if ( offSet == 18 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 18 mm snit + slug' ) };
        if ( offSet == 19 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 19 mm snit + slug' ) };
        if ( offSet == 20 ) { pdfPre = app.pdfExportPresets.itemByName( 'LANNOO 20 mm snit + slug' ) };
        pdfFile = File(inFolder+"/"+doc.name.toString().replace( '.indd', '.pdf' ) );
        doc.exportFile( ExportFormat.pdfType, pdfFile, false, pdfPre, '', false );
        doc.close( SaveOptions.NO );
    exportFolder();
    thx,
    csm_phil

  • Script for moving multiple subtitle clips in the works - EXAMPLES NEEDED!

    Hi everyone!
    One severe deficiency of DVD Studio Pro is the inability to move multiple subtitle clips back or forward in a track by an arbitrary offset.
    I ran into this problem while I was creating a DVD from an EyeTV recording of a DVB broadcast, the subtitles from which have to be extracted to a SON file and a bunch of .bmp images with a separate piece of software, ProjectX. For some reason, ProjectX messed up the subtitle timecodes, so I had to move the entire track forward by a fixed amount. Unable to do this inside DSP, and unable to find tools that would do this for SON files, I set out to code my own tool with Python.
    Currently, I have a very simplistic working version of the script, which I successfully used to shift the timecodes of the aforementioned SON file.
    This got me thinking: I can't be the only one who has faced this problem. So, in the spirit of giving something back to the community, I thought I'd try my hand at turning this little script into a versatile tool for timescaling several different subtitle formats.
    If possible, I would like to receive real-life examples of several different plaintext (no binary formats, thanks) subtitle formats from you guys, both those that DSP supports and those that it doesn't.
    For now the tool only shifts entire tracks and works on the command line, but who knows, maybe I'll create a GUI at some point and add the ability to shift specific subtitle clips instead of whole tracks - time permitting, of course.
    If you think you might have some juicy subtitles laying around, please reply or contact me directly by e-mail: elamaton (at) nic.fi. Don't worry, I won't redistribute anything you send me, it will only be used as test data.
    iMac Core Duo 20"   Mac OS X (10.4.7)  

    Sounds like a very good idea... but have you seen Subtitler:
    http://www.versiontracker.com/dyn/moreinfo/macosx/26322
    Not to say you won't make a better version, and I'd be delighted if you did! Manipulating subs in DVDSP is not something I do any more - I use an external text editor for any job where more than a few subs are needed.
    The problem in DVDSP is that you cannot extract the subs directly, you have to export an track item description which has the subs and time code buried within the XML. You might find that PHP will give you a web based tool to extract the subs and time codes and write a text file, which you can then manipulate.
    In fact, wouldn't a web based tool be a good idea? People could upload the track description, it would export the subs and you could get it to adjust the timecodes and write a text file back in the correct format to import back in to DVDSP. Once the subs are in a text file it is a simple matter to manipulate them further...

  • Script for moving playhead to last frame, then exporting jpg?

    Hi,
    I have a lot of Flash files for which I need to export jpgs of their last frame. Could a kind soul out there guide me on how to write a command for moving the timeline's playhead to the last frame, then exporting a jpg (at Full Document Size, 72 dpi, 96% quality)?
    A million thanks,
    Kevin

    private function snapshotLastFrame():void
    gotoAndStop( this.totalFrames );
    _bitmapData                         = new BitmapData( stage.stageWidth, stage.stageHeight );
    _bitmap                              = new Bitmap( _bitmapData );
    _bitmapData.draw ( stage );
    saveImageJPG( _bitmapData, "test.jpg", 96 );
    public function saveImageJPG( bitmapData:BitmapData, fileName:String, quality:int ):void {
                this.jpgEncoder = new JPGEncoder( quality );
                this.fileReference = new FileReference();
                this.fileReference.save( this.jpgEncoder.encode( bitmapData ), fileName + ".jpg" );
    Keep in mind that you need a few extra libraries to be able to create a jpeg.. (AS3CoreLib) can be found at googleCode.

  • Script for downloading files from pdf placed on web, script for printing for exchange-

    Looking for java script command to set on button in pdf. We have mp3 and pdfs on our web site, example of URL: http://www.uzlicek.cz/download/Pohadky/O_holcicce_ktera_si_prala_byt_dospela.mp3
    By clicking on button/link in reader I would like to appear a dialog box with offer to Safe file as…
    Any suggestion? In case of using “link tool” the file starts downloading to cache and this is not the objective. In case of using “sound tool”, the file does not appear for saving.
    For exchange the script for Print the current page:
       var n = this.pageNum;
        var pp = this.getPrintParams();
        //pp.pageSubset = pp.subsets.all;
        //pp.printContent = pp.constants.printContent.doc;
        pp.firstPage = n;
        pp.lastPage = n;
        this.print(pp);
    Cheers Martin

    It can't be done using only a PDF file - any link to a URL will simply open your web browser, and whatever handler that browser uses when presented with MP3 files will be triggered (download, play, etc.) - nothing in the PDF can override that handler and force a "save" operation.
    Instead you'll need to configure your website to force downloads (using HTTP headers) and link to those URLs instead; which is a subject outside this forum.

  • Logon Scripts for copying files in Windows 7

    Issues using Logon scripts to copy files in windows 7.  Its default is to append the file rather than copy and replace, which is what XP did.  How can I achieve the same results using
    logon scripts in W7 to copy any files to specified folders and replacing old files.  The reason for this is that we use a software that performs offsite/onsite updates and the only way all the users can have the correct version/tables is to either manually
    update each user in a 90+ user environment or use a logon script to perform the coping of the updates.  Unfortunately the software support won’t create a (while logging in to software) patch for this.  So we have to force it during the user logon.

    Hi Novice,
    It should depend on your script content. it's recommended you ask in the official scripting guys forum for professional help:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG
    Karen Hu
    TechNet Community Support

  • Project Online - Cube script for building files

    Hi
    We have to use Project Online for our solution and we need to build a reporting database in SQL.
    Instead of building the schema manually,are there any pre built 2013 ones for use?
    Also, would there be any ETL scripts for building the cubes available or are all of these only developed through paid services - ie Project Hosts, Agorain?
    Regards
    Sean 

    Hello,
    There are some SSIS package examples / blog posts you can start with but each organisation would have different requirements so it would be difficult to have a pre-built production SSIS package that suited all. The links below might help get you started
    with creating your custom SQL Reporting database / data warehouse:
    http://pwmather.wordpress.com/2014/03/26/projectonline-data-via-odata-and-ssis-in-sql-database-table-on-premise-msproject-sharepointonline-bi-ssrs-office365-cloud/
    http://nearbaseline.com/blog/2014/04/project-site-custom-list-reporting-using-ssis-odata-connector/
    http://msdn.microsoft.com/en-us/library/office/dn794163(v=office.15).aspx &
    http://www.microsoft.com/en-us/download/details.aspx?id=43736
    To create an OLAP cube from you custom data warehouse would required you to create the code to do that. You could look at using one of the Microsoft partners to do all of this for you as a paid service.
    http://office.microsoft.com/en-gb/project/microsoft-project-partner-resources-ms-project-FX103802119.aspx
    Paul
    Paul Mather | Twitter |
    http://pwmather.wordpress.com | CPS

  • Can anyone recommend a process for moving just my OS and Adobe Photoshop and Lightroom to the SSD?

    I have an early 2011 MBP running Mountain Lion. I just removed the superdrive and added an SSD. I want to use it to boot from and also run Photoshop and Lightroom from. Can anyone recommend a process for moving my OS and those programs to the SSD?

    I'm assuming your doing this because of data you don't want pernament on the SSD as they can' be scrubbed like hard drives can.
    Disconnect any other drives.
    1: Format the SSD 1 partition, click the box, option GUID and OS X extended journaled as the format.
    2: Download Carbon Copy Cloner.
    3: Clone your MacintoshHD partition to a blank powered external drive also formatted the same as above.
    4: Hold option/alt key and boot the machine (wired or built in keyboard) and then select the clone to boot from,
    5: Once in the clone, click it's drive name and change the name if it's the same as the OS X boot volume.
    6: On the clone, head to System Preferences > Accounts and create a new Admin account.
    7: If you need to move files between accounts on the clone, see this. Combine two+ Users Accounts on the same machine   (be careful that your selecting the correct clones other account)
    8: Once your moving files on the clone is complete, then log into the new user account and delete the old user account.
    9: Use Carbon Copy Cloner to clone the clone to the SSD.
    10: Use Disk Utiltiy to repair permissions on all drives.
    The SSD should be moved to the HD slot and the HD to the optical slot and used as a file drive.
    CCC has a option to not include certain folders like the other user account you don't want, however I tend not to recommend things that are not too far out of line with Apple's ways of doing things as it usually results in bad things occuring. Somewhere in OS X it's recorded of that other user account, so it might still show up in logins and such.
    Also you may want to transfer some files to the other account, so that's why I recommend this method.
    Good Luck

  • Script for moving & deleting files

    Hi
    I'm quite new to scripts & looking for a script to move selected files with time-stamp & also a script to delete selected file/s in a directory. Below is an example of my requirement
    Move
    Ex:  c:\work\source\test.txt to c:\work\target\test.txt_04202015022100
    Delete
    Ex: c:\work\target\test-1.txt
    Could someone help me please.
    Thank very much
    Neil

    This forum is for scripting questions rather than script requests.
    Please start by reading the following:
    Posting guidelines
    Handy tips for posting to this forum
    How to ask questions in a technical forum
    Rubber duck problem solving
    How to write a bad forum post
    Help Vampires: A Spotter's Guide
    -- Bill Stewart [Bill_Stewart]

Maybe you are looking for