Script for Zoom In and Out at specific intervals
I've dabbled with javascript in the past, but I'm a total newb to Photoshop scripts.
What I need is a script I can use to zoom in at specific intervals and another to zoom out to the same frequency. I intend to use these two scripts in conjunction with configurator to make some buttons to do the tasks.
For example...
Current zoom is 30%. Zoom in Script has an array of zoom levels: 12.5%, 25%, 50%, 100%, 200%, 300%, 400%. The script should detect the current level of zoom in and find the next higher zoom level, 50%, and then assign this new zoom window.
Similarly, Zoom out would do the same operation by selecting the next zoom low, 25 percent.
That's all in order to get back some of the features of CS5 CS6. I used the menu to zoom at the top of the screen TO move preset zoom levels when you draw on my Wacom Cintiq. This Configurator Panel would give more this feature back.
One of you gurus of coding can help me with this? Or at least give me a hint on how to handle the zoom percentage in Photoshop using javascript?
Thank you!!!
Matt
That 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 ); };};
Tags: Photoshop
Similar Questions
-
Zoom in and out on a picture when I only have a touch screen?
Hi all
I'll put up a request for inspection, taking a touch screen. However the user want to zoom in and out on images. Zoom is OK - just grab the magnifying glass lens and click - but I don't see how to zoom with no shift key.
Anyone got any suggestions?
Maybe keep a logical button/contol and connect it to enlarge the property indicator of the image factor.
-When the operator presses the button/control, you can change the zoom level
-
BlackBerry Smartphones zoom in and out on e-mails and sms
Hello. New user here and away from nokia. Question: I have read the manual and see how to zoom in and out of photos and pages in the browser, but how do I Zoom in and out one opened by e-mail or sms?
thnx
You can't zoom in and out of an email or a text Message, but you can set a size larger font for your device, Options > keyboard/screen.
-
Artifacts when zoomed in and out
Hello
I have a new MBP for a few days. I can not complain. Great machine to work with design/photography. However, I think the experience of this kind of problem, I'm not able to solve so far.
When you zoom in and out, I get these blocks of solid color. Sometimes, it is white and it is sometimes black.
I have Intel Iris Pro graphics.
Here is a link to see what it looks like: Microsoft OneDrive - access to files anywhere. Create docs with Office free online.
Does anyone know how to fix it or will there be an update to fix it?
I'm lucky I've got Photoshop on a PC, but also a Mac and the problem is not present on the PC. I really like MACs, but I think the Achilles heel is not being able to easily add third-party hardware. I think a third graphics card might just solve the problem of the mysterious black squares but Apple likes to keep manufacturing in the House. Also, it does not help that Yosemite is such a new OS.
Have you tried pressing cmd 3 followed by cmd 2 when this happens because some people report it clears. All you do is put in the Red layer and RGB so you don't make any changes to the image.
Terri
-
Hello! I m trying to develop an application of miself. A kind of world Hello for now. All very well, but when I put the code (extract) to zoom in and out, I run the application and, Yes, it zooms in and out, but image of DEFORMATION. He doesn´t the scale ". What should I do? Thank you very much!
Have you tried that?
movieClip_10.scaleX * = event. scaleY;
movieClip_10.scaleY * = event. scaleY;
-
Zoom in and out of the Web site Windows no dependencies a mouse - windows 7 pc
I do not use a mouse on my laptop. Each time the window zoom in or out because that weighs a finger on the touchpad. How do I Zoom in and out in order to control the size of the window?
Hello JRStef, you can reset the level of zoom of a page by pressing CTRL + 0 ("zero"). CTRL + -/ + decreases / increases the zoom.
-
clock appears, zoom in and out, the mouse not responding pluse
Randomly, the clock will be displayed in the lower right of the screen, the scren performs a zoom in and zoom out and the mouse goes haywire. What is going on?
Have you tried to test with another mouse that your current mouse is perhaps faulty?
On the keyboard if you press the Ctrl Key and spin the mouse wheel at the same time this causes the screen to zoom in and out in some windows, such as Internet Explorer or on the desktop (if an icon is highlighted or selected).
As you mention that the fault is random it will be difficult to solve the problems in the usual way. See if you can detect some rhyme or reason to explain why it is being implemented.
-
cannot zoom in and out in the content viewer
I finished my ebook with indesign, but it can't zoom in and out in my ipad form adobe content viewer, it just show me can not Zoom icon on center to my ipad, please help, thanks a lot
Pinch and zoom only works with PDF articles.
Bob
-
Smooth zoom in and out of an image
Hello
I would like to make a zoom in and out of images like this
any ideas?
is it
ActionScript and 1 or 3?
See you soon
Rick
To zoom in and out of the images is placing them in movieclips and gradually adjust clips values x and y scale.
-
Hello!
I need a simple solution to the ability to zoom in and out in and out of the image.
It is not a card, just an image of 6400 x 4800 with a few 4-5 levels of zoom max.
The solutions/tips/tricks/what whether?
Thank you!
Discover «localToGlobal»
-
Hello
in labview 8.6 by what I know that I can zoom in and hold ctrl + alt + do drag, but I don't know how to zoom out.
How to give the presentation in labview as anything other than the browser window
Take a look at The Code of Capture tool (and here). The file that I attached definintely does not fit on a single screen; I made the image using the CTC in the LAVA.
The Capture of Code (or TDC) tool is a LabVIEW development tool for LabVIEW users to capture images of their code and make it easier to share these images in online forums.
tmdar wrote:
Shortly, you create block and becomes so big that it is not on a single screen shot, how to adapt or eviction.
You can ALWAYS make it fit on a single screen.
Jim
-
Webcam keeps zoom in and out.
Webcam
I use the webcam on this windows 7 and for some reason any it keeps buzzing in and out randomly. He has been doing for weeks.
Hello baby VN.
The camera is integrated, you can check the manual or PC with the PC manufacturer for the steps to set the parameters of the camera zoom. You can also verify that the latest drivers available and software for the PC manufacturer for the camera is installed.
Thank you
Mary
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think. -
My policy on Facebook got suddenly very LOW. In the past, when this happened in Firefox, I simply went to the bar and clicked on DISPLAY and then zoom in or out. NOW, there is NONE of the old wanted and loved tabs at the top of the new horrible page. WHERE is the DISPLAY tab or the zoom FRONT and ZOOM back tab?
Usually, you have the orange Firefox button or the classic menu bar, but not both at the same time.
You should be able to switch at the back of this way:
If the classic menu bar is not displayed, press the Alt key to display it, and then use
View > toolbars > Menu bar
to make it persistent. It should replace the orange Firefox button. To switch back, uncheck the box
View > toolbars > Menu bar
Does it work?
---
In addition, you can zoom in now the CTRL key and scrolling your mouse wheel. It is an adjustment of finder, but can be more difficult to control.
-
Zoom in and out on a sensitive site
Hi all
I browsed a few sites and noticed some can be zoomed in and zoomed out, while read on mobile devices. Example, www.sonos.com and www.jamindustries.com. While other sensitive sites cannot zoom... example: www.braven.com & www.windcarrier.com.
I created a sensitive site and I realized, that it can also zoom in/out. How can prevent that from happening?
I created a sensitive site and I realized, that it can also zoom in/out. How can prevent that from happening?
You do not have. Many people need Zoom to be able to see the things on these small mobile device screens. If you disable the Zoom & I can't read the page, I leave your site in anger & disgust and never come back. Don't mess with popular web devices.
It's the correct one to use meta viewport tag.
Nancy O.
-
Stretch script for time so layer out-point is set at the time of model determined.
Hello world!
After doing some reading on the documentation and thinking through this problem, I thought I would ask some advice. I'm curious to know if it is possible with ExtendScript, temporal layer such as its land to outpoint s on a point determined in the timeline panel. I see that we set the value of a layer .stretch property, but I guess I wan to know if there is a way of thinking that this percentage is based on where I want the layer .outPoint meet.
Let's say I have a layer including inPoint starts at 0 and out-point ends at 5. Now, let's say I want to stretch the negative layer so the out-point ends at 3.25. What is the best way to determine the stretch value for the layer?
Thank you
ArieI guess it depends on how general you need, but for the situation you described, perhaps like this:
var layer = app.project.activeItem.layer (1);
var d = layer.outPoint - layer.inPoint;
Layer.Stretch = (3.5/d) * 100;
Dan
Maybe you are looking for
-
Hi, my HP Photosmart C310b connected to the iMac often loses the print connection
When I go to print, I get a msg saying "cannot find printer" when everything is connected. It's like if it disconnects after a period of time. I have to completely restart the iMac and go through the tools/network/Wireless configuration wizard... so
-
Outlook Express conecting I am trying to use Outlook Express to send pages and web sites to your friends but get messages that failed because my p.o. box address is wrong. How will I know what is my mailing address? My other e-mail - but which I acce
-
Help MY hp update dot4 scrubber does not
Help MY dot4 hp Update window washer does not and therefore do not install it - I have an office pro 7500 Lseries - all-in-one
-
I want to install MS Money under Vista. Program downloads, installs, then stops. NTo ask Prouct Key and box contains. Cannot make it work after that. Box appears and announces that the programahas has stopped working. Need to work. Help, please.
-
SE CHAPIDemo the work of browser
Hi all I am trying to use the API Content Manager to have my 3rd party app launch when the user navigates to a URL that points to the type of native document of my application. I had the CHAPIDemo and work at first just try to get the browser to call