Script to Zoom In and Out at specific increments

I have dabbled with javascript in the past, but I'm a total newb at scripting Photoshop.
What I need is a script I can use to zoom in at specific intervals and another to zoom out at the same intervals.  I plan to use these two scripts in conjunction with Configurator to make a couple buttons for doing the tasks.
Example...
Current zoom is 30%.  The Zoom In Script has a an array of zoom levels: 12.5%, 25%, 50%, 100%, 200%, 300%, 400%.  The script would detect current zoome level and find the next higher zoom level, 50%, and set the window to that new zoom.
Likewise, Zoom Out would do the same operation selecting the next lower zoom level, 25%.
This is all in an effort to get back some of the functionality moving from CS5 to CS6.  I used the zoom menu at the top of the screen a LOT to move to preset zoom levels when drawing on my Wacom Cintiq. This Configurator panel would give most of that functionality back.
Can one of you coding gurus help me with that?  Or at least give me a hint as to how to manipulate zoom percentage in Photoshop using javascript?
Thanks!!!
Matt

This should do it...
main();
function main(){
Use either
zoomIn();
zoomOut();
if(!documents.length) return;
var zoomLevels=[12.5, 25, 50, 100, 200, 300, 400];
zoomIn();
//zoomOut();
function zoomIn(){
var zoomLevel = getZoomLevel();
for(var z in zoomLevels){
    if(Number(zoomLevels[z]) > Number(zoomLevel)){
        setZoomLevel(zoomLevels[z]);
        break;
function zoomOut(){
var zoomLevel = getZoomLevel();
zoomLevels.reverse();
for(var z in zoomLevels){
    if(Number(zoomLevels[z]) < zoomLevel){
        setZoomLevel(zoomLevels[z]);
        break;
function getZoomLevel(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
return Number(desc.getDouble(stringIDToTypeID('zoom'))*100).toFixed(1);
function setZoomLevel( zoom ) {
    if(zoom < 1 ) zoom =1;
   var ref = new ActionReference();
   ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
   var getScrRes = executeActionGet(ref).getObjectValue(stringIDToTypeID('unitsPrefs')).getUnitDoubleValue(stringIDToTypeID('newDocPresetScreenResolution'))/72;
   var docRes = activeDocument.resolution;
   activeDocument.resizeImage( undefined, undefined, getScrRes/(zoom/100), ResampleMethod.NONE );
   var desc = new ActionDescriptor();
   ref = null;
   ref = new ActionReference();
   ref.putEnumerated( charIDToTypeID( "Mn  " ), charIDToTypeID( "MnIt" ), charIDToTypeID( 'PrnS' ) );
   desc.putReference( charIDToTypeID( "null" ), ref );
   executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
   activeDocument.resizeImage( undefined, undefined, docRes, ResampleMethod.NONE );

Similar Messages

  • Pinch in and out on trackpad not working to zoom in and out in firefox

    Ever since i bought my macbook pro (early 2011) I was able to use the pinch in and out trackpad feature to zoom in and out in firefox. This suddenly stopped working a couple of days ago. It still works in safari so this seems to be Firefox specific. All other trackpad features are still working too.
    I uninstalled Firefox on my mac by moving the Firefox icon to the trash and downloaded/installed it again. Note that i didn't delete my profile (just deleted the Firefox icon) so all bookmarks were preserved even after downloading and installing Firefox from scratch. This didn't help fixing the issue.
    Any ideas on this problem ? how to fix it?
    Thanks!

    All these programs seem to be for windows. I am facing the issues with firefox on a macbook pro.
    I wasn't suggesting resetting Firefox. I have already done this step a couple of days ago as I was facing connectivity issues with some websites completely freezing and not loading. reset didn't help. I started seeing the trackpad issue around the time i did the reset.
    I am wondering if uninstalling Firefox and deleting all data associated with it (profiles etc) would fix the issue. Can you advise on what should be deleted with firefox?

  • Zoom in and out with ActionScript

    I have a map of a place with several locations that I need to
    zoom in for a close up then playing a video clip; after finishing
    the video, zooming out again to another location and go on until
    done without any interactions.
    Please tell me how do I program this with the scripts...
    Otherwise I have to manually zoom in and out which is not
    very elergant.
    Please give me a thought will be much appricaited.
    Lau

    For the best result use Imaging Lingo
    http://www.lingoworkshop.com/Examples/imaging.php
    http://nonlinear.openspark.com/tips/imaging/index.htm
    If not, you need to figure out a custom behavior to attach to
    each sprite of the scene. The behavior on sendsprite all can move
    the sprite X pixels to the left or right when panning, and to zoom
    you have the change the width and height of each sprite and the
    relative distance between the sprites.
    If I were you I'd stick to using one sprite and update it's
    image with imaging lingo since you need zoom.

  • I know I've heard that iPads/iPhones can't get viruses but is it possible that they can? While using my iPad, it keeps going in and out of apps. On Facebook, status and profiles keep getting clicked and it keeps zooming in and out. Can anyone help

    I Have an iPad mini, iOS 8.1. When I'm on my iPad, it keeps going in and out of random apps. Going to settings is the worse. As soon as I click settings and it opens,it starts clicking different things and tries turning on and off settings! In Facebook, profiles and status get clicked. The screen zooms in and out multiple times. It reminds me of when you call the help desk for a computer or a computer at work and they gain access and move around clicking and you're doing nothing. Basically things are being clicked and I'm not doing it.....can anyone help?

    At this point, I would go for reset to its factory default condition, using the iTunes program to get a clean system install. That way you'll clean everything out and just have it set up the way it would come from the factory. You'll need to do your backup (on the iTunes program too) and be sure you understand which stuff will be saved and which will not (from the links below). Also turn off any anti-virus program you may have on your desktop. Then when you reset it to the factory default condition, don't restore your backup just yet ... until you check it out without your data put back on it. Verify its operation first, to make sure that you know it's okay. Hopefully everything is okay at that point, otherwise you'll have to take it into Apple to check it out for any hardware failure.
    Here are the links, and the last one pertains to the reset to factory default condition ...
    Choosing an iOS Backup Method (Should I Use iTunes or iCloud to back up ...)https://support.apple.com/kb/HT5262
    Back up and Restore your iOS Device with iCloud or iTunes
    http://support.apple.com/kb/ht1766
    iTunes: About iOS Backups
    http://support.apple.com/kb/ht4946
    Create and Delete iPhone, iPad and iPod Touch Backups in iTunes
    http://support.apple.com/kb/ht4946
    iOS: Troubleshooting Encrypted Backups
    http://support.apple.com/kb/TS5162
    Use iTunes to Restore your iOS Device to Factory Settings
    http://support.apple.com/kb/ht1414

  • I have model A1458...been acting possessed.... apps opening and closing on their own...zooming in and out... not always responsive to my touch... what could be the problem?

    i have model A1458...been acting possessed.... apps opening and closing on their own...zooming in and out... not always responsive to my touch... what could be the problem?

    The two most likely culprits would be a faulty cable/charging block or a bad digitizer. Try charging the device with a different charger and cable. If the problem goes away, then the problem is with your charger. If it does not, try the basics of resetting, restoriing from back up, restoring as new. If you still have the problem, make an appointment at the Genius Bar at your local Apple Store for evaluation.

  • How do I zoom in and out on a clip using final cut pro 6?

    I have searched around and I haven't found anything about how to zoom in and out on non-still video. I am sure there is some simple explanation as of how to do this but I can't seem to find it. If you guys could help me out that would be great. Thanks.

    Double click the clip in the Timeline, to place it in the viewer.
    In the Viewer window click the Motion tab. Adjust the "Scale" control and set keyframes as needed.

  • How do I zoom in and out on my iPad videos

    How do I zoom in and out using my ipad video?

    Double click the clip in the Timeline, to place it in the viewer.
    In the Viewer window click the Motion tab. Adjust the "Scale" control and set keyframes as needed.

  • I am have problems with the ipad mini, it is a little crazy. It controls by itself, opens and closes application zooms in and out, end my facetime calls, Also Un certain part of the screen is no longer responsive to the touch.

    I am have problems with the ipad mini, it is a little crazy. It controls by itself, opens and closes application zooms in and out, end my facetime calls, Also Un certain part of the screen is no longer responsive to the touch, it Should be having so much problems. Thanks for your help.
    iPad, iOS 7.0.4

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • In version 4.0 I can't use the pinch feature on my trackpad to zoom in and out. Is there a setting in Firefox for this?

    I installed v4.0 of Firefox and can no longer use the pinch feature on the trackpad of my MacBook. It seems to work OK in Safart and I'm wondering if there is a setting in Firefox to enable me to use that feature. The way the feature works is that you pinch your thumb & forefinger together or spread them apart to zoom in and out.

    Some gestures have been removed in Firefox 4.
    You can restore the zoom feature by changing the values of the related prefs on the <b>about:config</b> page.
    browser.gesture.pinch.in cmd_fullZoomReduce
    browser.gesture.pinch.in.shift cmd_fullZoomReset
    browser.gesture.pinch.out cmd_fullZoomEnlarge
    browser.gesture.pinch.out.shift cmd_fullZoomReset

  • Can't zoom in and out in camera mode on blackberry curve 8520

    Hi IM Carlos and im new to this phone and I had a couple weeks now and I used the camera on my phone and was able to zoom in and out before but now it wont let me zoom in and out and I tried the shortcuts that it came with but nothing works can anyone help please

    With the BlackBerry device powered ON, remove the battery a few seconds and then reinsert the battery to reboot.
    Now, try the camera zoom again.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • I can't zoom in and out using the scroll wheel

      so i want to zoom in and out on photoshop how i always have...using ctrl and scroll wheel...
    but when i went to do it how i naturally do it, it didnt work..after some research i found you go into preferences, general and tick the box about zoom scroll or somthing.
    Yet when i go onto it i dont have any options about zooming !!?? from what ive seen i have less options than others.
    and im pretty sure it isnt only available on newer version..because i have done it before on really old photoshop versions.
    so any help would be appriciated, thanks

    Photoshop 7 doesn't have a preference for using  Zoom With Scroll Wheel like cs2 and later do, but holding down the Alt key and using the scroll wheel should work
    to zoom in or out.
    Does the Alt key work if you make a selection and then use Alt+Ctrl+D to bring up the Feather dialog?
    Does the scroll wheel work to change the layer blend modes by duplicating the layer and highlighting
    the layer blend mode of Normal in the layers palette and then using the scroll wheel to change blend modes?

  • How do i turn off new zoom in and out function on IOS 7?

    Hi Apple support people
    How do i turn off the IOS 7 new zoom in and out function when opening and closing applications. The movement makes me sick and gives me a head ack when i use it.
    I can not find the option anywhere
    Thank you very much for your help

    I don't believe it can be totally disabled. Send feedback to Apple here:
    http://www.apple.com/feedback/

  • How to Zoom in and Out on PDF files in Safari?

    Safari help is not helpful since it gives inaccurate information on how to Zoom in and Out on a PDF file that has opened in Safari. The help says to control click the page and choose the zooming level you desire. However control clicking the PDF file in Safari brings up a save page box. I tried some of the other keys with clicking and they did not work. Thanks in advance to those who helped me save a PDF file to the desktop so I can view in Preview.- But often I just need to be able to zoom in to read the tiny text that is displayed.

    Thanks for getting back to me-
    the website I am trying to zoom into a PDF on is:
    http://www.beedocuments.com/software/Timeline/screenshots.html
    I click on one of the screenshots- it loads into a safari window.
    When I control key click on the image- a pop up menu comes up asking me to save the image to deskotp- add it my image library and 2 other save options. No zoom in or Zoom out. I only have an apple pro mouse and my track pad- so right clicking isn't an option.

  • How do I zoom in and out in a photo

    I am complete new to using a MAC and Iphoto. Can I zoom in and out of a photo to do close up editing?
    Is Iphoto the only program I need to edit and retouch photos? If not, can someone recommend a simple and inexpensive program?

    I find the zoom slide quite easily when using the computer screen on my Macbook. However, when I project the images onto a screen the slide for some reason disappears. Any ideas?
    Welcome to Mac. The iPhoto tutorial is a good place
    to start:
    http://www.apple.com/ilife/tutorials/iphoto/
    Yes, you can zoom in. At the bottom of the iPhoto
    window is an icon that looks like a box with arrows
    pointing out. Select a photo and click that icon to
    enter the Full Screen Edit mode. At the bottom of
    that window, rt. of center, is a size slider which
    will zoom your photo. To see the edit tools, move
    your curser to the bottom of the window. Those tools
    will show you what kind of edits you can do with
    iPhoto. To keep the tools or thumbnails in view, go
    to View > Show toolbar or Show thumbnails.
    I use iPhoto in combination with PhotoShop Elements
    4. It is relatively inexpensive, at around $60 - $80.
    Many of its functions are simple and easy to use, but
    with some study and practice you'll find it is as
    complex and powerful as you need it to be. You can
    read about it here:
    http://www.adobe.com/products/photoshopelmac/

  • Ipad screen keep on moving and zooming in and out

    My iapd 2 screen keep zooming in and out. At the  same time, it also moving . How could i solve this problem?

    As with everything hardware related you need to either return your device to the place of purchase or contact Xperia care and ask for a pressure/vacuum test to be carried out http://www.sonymobile.com/global-en/support/contact-us/
    For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled.   Richard P. Feynman

Maybe you are looking for

  • Login to Portal by webdynpro application

    I want two input fields in my web dynpro application for userid pwd. after pressing the button i want to retrieve the information of that particular user like assigned Roles to the user. How can i do this?

  • How do I copy all iTunes data from ext to ext disc

    Hi, my RAID mirroring system had a defect. Now I bought a new 1000 GB disc (two discs seem to be safer than a RAID mirror system after all) and want to copy all my iTunes data (approx. 400 GB) from that RAID mirroring system to the new disc. How can

  • What is the role of OHS in OFM

    Hi, I am new to oracle fusion middle ware. I cannot understand the need for OHS which there is already OAS or weblogic available

  • Oracle BI Installation OUI-10185

    Hello Guys, I am trying to install oracle on my Toshiba laptop dual core 2GB RAM. At some step about 14% completed installation, some files can be found in disk 4, but I just continue. At about 44%, I get an error below: OUI-10185: +"...\Disk4\stage\

  • Working with TimeZone variables in UCCx script

    Hi Team I'm wondering if you guys could help me to find out the best way to work with TZ variables in UCCx script. Because of different countries customer has a branches, I need to setup different TimeZones for each country handled by the same centra