Help! Fix my javascript to save a bmp with suffix in the same folder as the previous save.

Here's my current javascript:
#target photoshop
// sets document preferences to inches
app.preferences.rulerUnits = Units.INCHES
// these are our values for the END RESULT width and height (in inches) of our image
var fWidth = 11.73;
var fHeight = 5.97;
var CurrentDLPFile=app.activeDocument
var CurrentDLPFileName= CurrentDLPFile.name
var CurrentDLPFilePath="~/Desktop/fetch"
var f = File.saveDialog('Save Where?',''); 
// in case we double clicked the file
app.bringToFront();
// resizes the canvas to 11.73 x 5.97 inches
CurrentDLPFile.resizeCanvas(UnitValue(fWidth,"in"),UnitValue(fHeight,"in"));
// flattens all layers
CurrentDLPFile.flatten();
// saves as photoshop file
if (f!=null) CurrentDLPFile.saveAs(f,undefined);
// splits channels
CurrentDLPFile.splitChannels();
// converts active K seperation to bitmap form
var bitsaveoptions = new BitmapConversionOptions()
bitsaveoptions.method = BitmapConversionType.HALFTONESCREEN
bitsaveoptions.angle = 45
bitsaveoptions.frequency = 55
bitsaveoptions.resolution = 300
bitsaveoptions.shape = BitmapHalfToneType.ROUND
app.activeDocument.changeMode(ChangeMode.BITMAP,bitsaveoptions);
// THIS IS WHERE I'M HAVING ISSUES- I want to save the file (which at this point is a bmp), with a suffix of 1 in the same folder; and then close the file.
var doc = app.activeDocument;
var docName = doc.name;
docName = docName.match(/(.*)(\.[^\.]+)/) ? docName = docName.match(/(.*)(\.[^\.]+)/):docName = [docName, docName];
var suffix = '_1';
var saveName = new File(decodeURI(doc.path)+'/'+docName[1]+suffix+'.bmp');
function saveFile(app.activeDocument, saveName);

I figured it out, here's for anyone else who is struggling with a similar problem:
var CurrentDLPFile=app.activeDocument
// saves active doc as photoshop file
if (f!=null) CurrentDLPFile.saveAs(f,undefined);
//renames active document to whatever was saved
var CurrentDLPFile = app.activeDocument.name
//assigns the location of the saved psd
var psdPath = activeDocument.path
saveBMP = new BMPSaveOptions();
saveBMP.alphaChannels = false;
saveBMP.depth = BMPDepthType.ONE;
saveBMP.flipRowOrder = false;
saveBMP.rleCompression = false;
saveBMP.osType = OperatingSystem.WINDOWS;
var doc = app.activeDocument; 
var Name = doc.name.replace(/\.[^\.]+$/, '');  
var Suffix = "1"; 
var saveFile = File(psdPath + "/" + Name + Suffix + ".bmp");
activeDocument.saveAs(saveFile, saveBMP, true, Extension.LOWERCASE); 
activeDocument.close( SaveOptions.DONOTSAVECHANGES );

Similar Messages

  • Exchange Personal Archive - When Replying To A Message That Is Not In the Inbox, Save The Reply In The Same Folder

    -Settings
    Exchange 2010 enterprise on-premise
    Outlook 2013 std
    Exchange Personal Archive
    Feature : Option/Email/When Replying To A Message That Is Not In the Inbox, Save The Reply In The Same Folder
    Hi,
    the feature works fine in the mailbox of the user but not from within the exchange personal archive.
    Instead the reply is saved in the send items folder of the mailbox.
    Any suggestions how to make this work?
    Best Regards,
    zrvb

    AFAIK, that is how it is intended to work. The archive is considered as "old-emails" so the newly created reply doesn't fall within that category.
    Contact Microsoft Support by phone to submit it as a bug when it is "unexpected behavior" from your point of view or otherwise as a feature request/design change.
    Robert Sparnaaij
    [MVP-Outlook]
    Outlook guides and more: HowTo-Outlook.com
    Outlook Quick Tips: MSOutlook.info

  • One-click 'Save as jpeg' shortcut script please! - saved in the same folder

    Hi, I've been re-directed here because I was told a script could solve my problems - but I have no scripting experience/knowledge/ability! Below is my original problem and post. I got as close as 2 button presses, but I'm after that sweet, sweet single-button, double-my-productivity shortcut! Thanks!
    http://forums.adobe.com/thread/1106992
    I use 'Save as .jpeg' ALL the time (Photoshop CS6, Mac ML), and it really feels like I should just be able to press one button (a shortcut) and the name/quality dialogs don't appear and it just saves a .jpeg into the folder that my original .PSD/file is in.
    So basically:
    - Press one button to save my open .PSD/file as a .jpeg
    - Automatically save it in the same folder as my .PSD
    - Save it as '10' quality in the jpeg settings
    - No dialog boxes, as soon as I press the button, it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.
    I've tried using 'Actions', but it seems to save it wherever my original Action folder was - it doesn't change to whatever the current folder the .PSD is in...
    Thanks!
    Adam

    File -> Scripts -> Script Events Manager
    Click Enable Events at the top
    Select Save Document from Photoshop Event  drop down
    Select Save Extra JPEG from Script drop down
    Click Add
    Click Done
    EVERY document you save, except JPEG files, will save a jpg file. Saving will be slower.
    You will need to modify line 62 of the Save Extra JPEG.jsx file located here: <YOUR_PHOTOSHOP_INSTALL_LOCATION>\Presets\Scripts\Event Scripts Only
    In order to boost your quality to '10'. Here is the line in question
    jpegOptions.quality = 2; // really low
    Change it to
    jpegOptions.quality = 10; // really high
    You will need to modify the script to get this problem solved as well: it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.
    You can steal code out of Image Processor that finds a file name that is unique for the folder so you don't get overwrites.
    Are you sure you want that? If you do lots of saves you are going to fill up your disk fast.

  • JavaScript is not from the same origin as the Java code

    When trying to log into my school website with Safari, I get the following error from the console:
    sun.plugin.liveconnect.OriginNotAllowedException: JavaScript is not from the same origin as the Java code, caller=http://tychousa3.umuc.edu/WebTycho.nsf/setJVMCookie?OpenPage, callee=https://tychousa3.umuc.edu/sys/
    This keeps me from logging in. In order to get it to work, I have to disable Java, log in, then reenable Java after logging in.
    I am able to log in successfully with Firefox but I really prefer to use Safari.
    Does anyone else experience this problem and do you know how to fix it? Any help would be very much appreciated. Thanks.
    iBook 933 - PPC   Mac OS X (10.4.5)  

    I'm reposting. No answer.

  • When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder". How can i fix this?

    When i double click itunes it doesn't open it just comes up with an error saying " The itunes library.itl file cannot be found or created. The default location for this file is in the 'itunes' folder in the 'music' folder. How can i fix this problem?

    Anyone can help to advice how to solve this issue ?

  • Everytime i click on a link in my email in opens in the same tab, before the update it would open in a seperate tab like i wanted it to. Can someone please help

    for instance when i get an email from amazon regarding a special sale, i open the email in outlook and when i would click on a picture or a link it would would automatically open in another tab and allow me to check the rest of my emails in my current tab, now however it opens in the same tab as outlook it doesnt switch almost like when you are searching something on google and the link you choose loads in the same tab which is fine, but this is not, i dont want to have to press the back button to get back into my logged account!!

    I don't have that problem in Firefox 29 when I read Gmail or AOL (aim''.''com) webmail. When I click on a webpage link in an email I'm reading (example: http://www.tworivertheater.org/ ) the link opens in a separate Firefox tab.
    Are you saying this doesn't happen in outlook''.''com webmail and the link opens in the same Firefox tab as the email itself? I don't use outlook''.''com webmail myself. Hopefully someone will be along who does, or see [[Problems with email and how to find help]].
    It might help if you would confirm the type of link that is opening in the same tab as the email you are reading in your outlook webmail. If I misunderstood your problem, please explain it better.
    It might also help if you could furhish more troubleshooting information. Please do the following:
    *'''For Firefox 29.0 and above''': Click the menu button [[Image:New Fx Menu]], click help [[Image:Help-29]] and select ''Troubleshooting Information''.
    Now, a new tab containing your troubleshooting information should open.
    *At the top of the page, you should see a button that says "Copy text to clipboard". Click it.
    *Now, go back to your forum post and click inside the reply box. Press Ctrl+V to paste all the information you copied into the forum post.
    If you need further information about the Troubleshooting information page, please read the article [[Use the Troubleshooting Information page to help fix Firefox issues]].

  • How to save files (example:csv) from the different subVI to the same folder of main VI?

    I would like to save files (example:csv) from the subVI to the same folder of main VI? Please help! Thanks.

    CP_AT wrote:
    I would like to save files (example:csv) from the subVI to the same folder of main VI? Please help! Thanks.
    I don't understand the problem. You write in the program where to save files, and it saves them there. Do you mean something else?
    Cameron
    To err is human, but to really foul it up requires a computer.
    The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
    Profanity is the one language all programmers know best.
    An expert is someone who has made all the possible mistakes.
    To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
    LabVIEW Unit 1 - Getting Started
    Learn to Use LabVIEW with MyDAQ

  • I have added the Documents folder to the Dock, however when I save a document it doesn't appear in the Documents folder on the Dock, only the Documents folder in the Finder.  Is this a quirk, so am I doing something wrong?

    I like having my Documents folder on the Dock so I added the Documents folder from the Finder to the Dock.  When I save a document to the Documents folder, the saved document appears in the Documents folder from the Finder and not in the Documents folder on the Dock.  Why is this happening?  And how can I change this?

    newbieAK wrote:
    I opened the Finder, selected Documents, then right clicked and selected Add to Dock.
    Oooh. I never new that was there.

  • Hi, I need help and advice. Basically me and my ex partner both had iphones and synced it with the same computer under the same ID. We split i have a new laptop and now it keeps asking for the old ID or it'll erase my apps bought on theold account.

    Hi, I need help and advice. Basically me and my ex partner both had iphones and synced it with the same computer under the same ID. We split up and now im trying to get all my apps and info onto my new laptop with a new account but it keeps asking me for the old apple ID which she is still using and she changed the password. i tried backing it up but still nohing. When i try to back up purchased items being apps etc its keeps asking for the old one. help

    See Recover your iTunes library from your iPod or iOS device. But you'll still need the password.
    Once you have the computer authorized to use the account she could change the password again to stop you buying apps on her card (assuming it's not on yours!). It would lock you out of upgrading them too but they should work unless she uses the deathorize all feature.
    It depends on how amicable the split is...
    tt2

  • I was doing some thing on my mac and the normal link to the applications folder from the bottom right hand corner disappeared, I cant find it anywhere, Can you help me?

    I was doing some thing on my mac and the normal link to the applications folder from the bottom right hand corner disappeared, I cant find it anywhere, Can you help me?

    Simple process. If an iPhone go to the Apple Store and not Verizon
    the phone from Verizon will be a refurbished device and not new unless under the 14 day worry free guarantee
    good luck

  • Hi,  I backed up my ipad and iphone on the same computer, will it be shown on the same folder or different? Mine is window 7, try to find the back up file follow the step that apple provided, it shown only iphone instead of ipad. Pls help.

    I backed up my ipad and iphone on the same computer, will it be shown on the same folder or different? Mine is window 7, try to find the back up file follow the step that apple provided, it shown only iphone instead of ipad. Pls help.

    What do you see under Edit > Preferences > Devices?
    tt2

  • In Final Cut Pro I was trying to move an Event Library from one hard drive to another as explained in the Help section.  After doing so, I received a message that my event is already open with the same identifier as the new one I just creat

    In Final Cut Pro I was trying to move an Event Library from one hard drive to another as explained in the Help section.  After doing so, I received a message that my event is already open with the same identifier as the new one I just created on the new disk.  It says the second document cannot be opened and to move one of these documents out of your Final Cut Events folder.  It also says to avoid this problem, copy events from within Final Cut Pro, but that is what I did in the first place.  What should I do to avoid the double opening conflict?

    What exactly are you doing and what version are you using with OS X 10.8?

  • After installing Mavericks I can no longer save a new word document or pdf by typing the name of the destination folder in the Finder window.  The save button greys out.  Solutions anyone?

    After installing Mavericks I can no longer save a new word document or pdf by typing the name of the destination folder in the Finder window.  The save button greys out.  Solutions anyone?

    Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in 10.8 there is only one. If you're running a version older than 10.8, this comment isn't applicable.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
              Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder—not just its contents—to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window.
    This action will delete any custom Mail stationery that you have created. If you want to preserve it, ask for instructions.
    If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
    ~/Library/Containers/com.apple.MailServiceAgent
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • How to remove 1797 emails. stuck in inbox.  but not showing anymore - and i have the same problem wit the sent.  please help

    how to remove 1797 emails. stuck in inbox.  but not showing anymore - and i have the same problem wit the sent.  please help

    This is a user supported frum, so making threats really doesn't help, besides which it's not like any of us can really make a dent in Toshiba's bottom line despite how many people we think we can influence. Unless those people were standing in line to buy a Toshiba product cash in hand, and you pulled them out, it really doesn't add up for them.
    At this point it would probably be better for you to use the 800 number. Have all your e-mails ready to forward, if needed, to whoever you end up talking to. Don;t let them off the hook. An hour on the phone is much better than weeks passing e-mails through a support site. Also contest the charge with your bank or credit card.

  • How to Save XML file in the same directory as the swf file automatically?

    Hi all,
    I'm really new here with flash and actionscript 3, so i might not make any sense, probably. Any input is greatly appreciated.
    So here's my problem, i'm trying to make a Top Score history for a flash game, which i load from an XML file. The problem comes to when i want to update the XML file. how do i do that automatically without prompting the user (ofcourse). I want it to be saved automatically to the same directory as the flash file.
    here's my code right now, but it prompts the user where it wants to be saved, which i don't want to happen:
    var xml:XML = <XML>
                        <topScoreList>
                        </topScoreList>
                  </XML>;
    for(var i:Number=0; i<10; i++)
         var Record:XML = <Record>
                             <score></score>
                             <playerName></playerName>
                        </Record>;
         Record.score.appendChild(topScores[i].toString()); //topScores[] -> class variable containing scores
         Record.playerName.appendChild(topNames[i].toString()); //topNames[] -> class variable containing names
         xml.topScoreList.appendChild(Record);
    var ba:ByteArray = new ByteArray();
    ba.writeUTFBytes(xml);
    var fr:FileReference = new FileReference();
    fr.save(ba, "topScoreList.xml");

    yeah that makes sense, actually - after reading a dozen more forums. It's really weird tho that flash doesn't have a Buffer writer, unlike other programming frameworks.
    But yeah, thanks. i'll start reading on flash.net.SharedObject, correct ? Thanks.
    Anyways, if anyone out there has a different input, will be greatly appreciated!!

Maybe you are looking for

  • Importing "Hi 8" footage

    I have a Sony Digital 8 camcorder that I've been using with FCE 2.0.3 for a long time now. Not the highest-end product in the world but it works great for my projects. Today for the first time I tried to use the Digital 8 camcorder to import into FCE

  • Hi please help

    i purchased my macbook pro a over a year ago my charger is not working?????? When i put it to charge this morning it didn't charge and in my computer it shows (not charging). the green lights turns on after a will but it still does not charge and whe

  • IMessage - iChat

    My old laptop is running Snow Leopard 10.6.8 with iChat. My other family Macs, iPhones & iPod touches all are using iMessage & everyone is using their Apple ID for the iMessage account. Is there anyway I can get my laptops iChat to join the party & c

  • Getting Dump in Production system

    Hi, we are getting dump in one customise program due to missing include program. how to transport this missing program.? regards, Ramesh

  • Photo books - unplaced photos

    Hi. I just created a photo book with 100 pages, but I have still have several hundred unplaced photos in my book.  I want to create another book using only the unplaced photos from the first book.  Does anyone know how to do this?  Thanks.