A little change is required in the script, please help.
I am using a script named as <Zoom to Width> that I found on web. This script does two jobs
(1) zoom to a specific percentage
(2) and center the page horizontally as well vertically at that zoom level.
I have changed the zoom value to 170% in it. Now the problem is that when script center the page at 170% it shows the middle of the page (horizontal as well as vertical). I need horizontal center but not vertical center of page, so I have to move to the top of page by scrolling or by moving cursor. I want a little change in it that vertically top of the page should appear instead of the middle of page i.e.
I want 170% zoom + horizontal page center + vertical page top.
I would appreciate any help. I am on Windows 64bit. Here is the script
//DESCRIPTION: Zooms to the width of currently selected object or the current page. http://www.in-tools.com
ZoomToWidth();
function ZoomToWidth(){
var kAppVersion=parseFloat(app.version);
try{
if(File.fs == "Macintosh"){var isMac = true}
else{var isMac = false}
if(kAppVersion>=6 && app.generalPreferences.useApplicationFrame){
var usesApplicationFrame = true;
else{var usesApplicationFrame = false}
var sel=app.selection[0];
var window = app.activeWindow;
if(! (window instanceof LayoutWindow) ){return}
var doc = app.documents[0];
var horizViewPrefs = doc.viewPreferences.horizontalMeasurementUnits;
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
var theWidth = doc.documentPreferences.pageWidth;
var theHeight = doc.documentPreferences.pageHeight;
var theSpread = window.activeSpread;
var pagesLength = theSpread.pages.length;
if(isMac){
var windowWidth = window.bounds[3]-window.bounds[1]-35;
if(usesApplicationFrame){
window.zoom(ZoomOptions.fitSpread);
var spreadZoom = window.zoomPercentage;
windowWidth = (spreadZoom/170)*(theWidth*pagesLength);
else{
var windowWidth = window.bounds[3]-window.bounds[1]-50;
if(usesApplicationFrame){//|| pagesLength>1 || theWidth>theHeight
window.zoom(ZoomOptions.fitSpread);
var spreadZoom = window.zoomPercentage;
windowWidth = (spreadZoom/170)*(theWidth*pagesLength);
if(sel && (sel.hasOwnProperty("parentTextFrames") || sel.hasOwnProperty("visibleBounds")) ){
if(sel.hasOwnProperty("parentTextFrames")){
var textFrame = sel.parentTextFrames[0];
var frameBounds = textFrame.visibleBounds;
app.select(sel.parentTextFrames[0]);
else{frameBounds = sel.visibleBounds}
theWidth = frameBounds[3]-frameBounds[1];
else{window.zoom(ZoomOptions.fitPage)}
window.zoomPercentage = (windowWidth/theWidth)*170;
doc.viewPreferences.horizontalMeasurementUnits = horizViewPrefs;
app.select(sel);
catch(e){}
Hi,
Basically your function is zooming base to width (selected object or window) so instead of modifying I suggest to create a new a "base to scale" function.
To keep top window content shown after scaling one can use a trick and select temporalily created object in a center (remove it after), so:
function zoomToScale(myScale) {
if (isNaN(myScale) || myScale > 4000 || myScale < 4) myScale = 100;
var
window = app.activeWindow,
mDoc = app.activeDocument,
mZeroPoint = mDoc.zeroPoint,
mHorizViewPrefs = mDoc.viewPreferences.horizontalMeasurementUnits,
mActiveSpread = window.activeSpread,
mSpreadPages = mActiveSpread.pages.length,
mWidth, theRec, mTopCenter;
mDoc.zeroPoint = [0,0];
mDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
mWidth = mDoc.documentPreferences.pageWidth;
theRec = mActiveSpread.rectangles.add();
mTopCenter = mWidth*mSpreadPages / 2;
theRec.move(undefined,[mTopCenter,0]);
window.zoom(ZoomOptions.fitSpread);
window.zoomPercentage = myScale;
app.selection = theRec;
theRec.remove();
mDoc.zeroPoint = mZeroPoint;
mDoc.viewPreferences.horizontalMeasurementUnits = mHorizViewPrefs;
call it i.e. this way:
zoomToScale(170);
myScale is reset to 100 if it is out of range or is not a number
Jarek
Similar Messages
-
My friend changed my password as a joke and when I asked her what it was she had forgotton and I am trying to change it on the computer but do not know how to any ideas?
If you're talking about your lock screen passcode, you can't "change it on the computer". You have to restore the phone.
-
iCal failing to run applescripts: The 'Open' button does not change to 'Run', and the script file is opened but not executed.
Calendar (not called iCal anymore) does not include that capability any longer, apparently. What you have to do now is go to Automator and create a Calendar Alert action. You can add a Run AppleScript object to the action and paste in your script there, then when you save it, it will become available as a choice in the alert menu in Calendar.
-
I've added a pdf to itunes and i want to change it so its visible with an album (digital booklet). But for some reason, when i click get info, its all greyed out and the little box for read only is unticked. please help - urgent! thanks
Hi
My first thoughts are
• iMovie ill behaving - Trash the iMovie pref file - use to set things right
• in reg. to Photos - Did You change iPhoto Photo Library - Then iMovie get's lost as it peeks into iPhoto on start up to see where photos are stored. Set iPhoto back to first Photo Library (when iMovie is not running) then start iMovie.
Yours Bengt W -
My macbook air 13inch got shutdown 3 times by itself. I tried installing SMC package as suggested but my computer is telling the update is not required. Could you please help me on fixing this issue. Thanks.
What version of OS X are you using? Exactly which MBA model do you have?
-
I am unable to access information from the internet as I am unable to install the lastest adobe flash player that is now required. Can you please help?
I fould a hack that makes the sites think you have the latest (Intel) version of Flash installed. So I installed it & it works with Firefox, TenFourFox & Safari. Here's the info.
Download this http://www.steelbin.com/FPforFBPPC.zip to your desktop, unzip it, and replace the current Flash Player plug-in which is in your main/Library/Internet Plug-Ins folder, (not the user Library). Save the old one just in case this one doesn't work.
Cheers, Tom -
hi,
As iam changing the ical message allert date to "daybefore" automatically it is changing to "on the date"
please help me,You could simplify the decode(... into to_char(sysdate + 1,'d')
select sysdate + level input_date,
TRIM(TO_CHAR(SYSDATE + level,'DAY')) the_day,
DECODE(TRIM(TO_CHAR(SYSDATE + level,'DAY')),
'SATURDAY',1,
'SUNDAY',2,
'MONDAY',3,
'TUESDAY',4,
'WEDNESDAY',5,
'THURSDAY',6,
'FRIDAY',7
) daynumber,
to_char(sysdate + level + 1,'d') alternative
from dual
INPUT_DATE
THE_DAY
DAYNUMBER
ALTERNATIVE
10/14/2013
MONDAY
3
3
10/15/2013
TUESDAY
4
4
10/16/2013
WEDNESDAY
5
5
10/17/2013
THURSDAY
6
6
10/18/2013
FRIDAY
7
7
10/19/2013
SATURDAY
1
1
10/20/2013
SUNDAY
2
2
10/21/2013
MONDAY
3
3
10/22/2013
TUESDAY
4
4
10/23/2013
WEDNESDAY
5
5
10/24/2013
THURSDAY
6
6
10/25/2013
FRIDAY
7
7
10/26/2013
SATURDAY
1
1
10/27/2013
SUNDAY
2
2
10/28/2013
MONDAY
3
3
Regards
Etbin -
HT1918 How do I reset my account I have 0.91 $ I can not change the Store please help
How do I reset my account I have 0.91 $
I can not change the Store please help
plz helpChange your password
iTunes Store: Retrieving and changing passwords (Apple ID)
Alert itunes support
https://www.apple.com/support/contact/ -
you have rentals that have not expired. what does that meen?i just want to change the country please help
I have the same problem
-
Looking a Apple Script please Help !
I am looking for a Apple script which I start the Mac App Store and dirket jump to the updates. Is that possible? If so can i combine that with the Automator on Mac ?
Can you post more information?
What happens when you type "python script.py"? Do you get some sort of error message?
If you type only the name of the script then you will have to make sure you have changed directory to where the script is located first. For example if your script is saved to your desktop, when you start Terminal you will first need to do "cd ~/Desktop" to change directory.
Or alternatively you could type the path to the script: python ~/Desktop/script.py
Steve -
Im having problem setting up my Hotmail account, it used to work fine until few days ago. It says ive entered an incorrect username or password which i can sign in fine with them details if i use laptop or safari through the phone, Please help..
I Sugges you to log into your hotmail acc and go to security and password change bit, then you will see two-step verification.. turn that off and you will be able to set it up on your iPhone/iPad or even Mac.
Give your phone a restart before trying to set it up. Thanks -
I bought Macbook air at 1 moth ago.
But So unfair……New Macbook air…….
I want change new one or Refund me
Please help me..It is really not relevant what you buy; especially with electronics, your item is "outdated" as soon as you get it home because there will always be a newer, bigger, better things out there.
Does your machine no longer do what you need it to do? If so, sell it, and buy a new one. If it does what you need, then keep it and work with it.
Apple allows for returns within the first 14 days; you can try going to a store and seeing if they will make an exception, but I would not expect it. -
After installed mavericks i cannot sign in to my facetime and i messages. i tried it 100 times, but it is showing couldn't sign in check your network and try again. there is no problem with my network. if anyone knows the solution please help me .
Hi,
What version of the OS did you upgrade from ?
Anything before OS X 10.8.2 may have an issue if the Logic/Mother board has been replaced and the Serial Number not "flashed" back to it.
In the Apple Icon menu use the About this Mac item.
In the new panel click twice on the line that tells you the current OS level
It will change to the Build number (and alternative count to the OS versions) and then the Serial Number.
If it is missing you need to get it replaced.
(It is supposed to be done on Repair or Refurbishment).
An Apple Store or Apple Authorised Service Provider as the best choices.
There are apps you can download (They are Mac Model specific) but needs careful typing as it is a once only trip.
8:56 pm Sunday; November 24, 2013
iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad
Message was edited by: Ralph Johns (UK) -
HT204088 how can i spend my 47 cents to change my country in app store please help me
how can i spend my 47 cents to change my country in app store please help me
There's nothing available for 47₵ to purchase so use the email form to request that Apple zero out your account so you can change the country > Apple - Support - Mac App Store - Contact Support
Keep in mind, your credit or debit card credentials must be associated with the same country where you reside.
"Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
From here > The Complete Guide to Using the iTunes Store | iLounge Article -
this is,we've encountered the following issues.
installer failed to initialize.this could be due to a missing file.please download adobe support advisor to detected the problem.
please,help me!Hi there Mylenium, is there any way you can help me? My cs6 is doing all kinds weird things lately. The liquifying too stopped working completely, when I try to work with the actions, it starts flickering and changing opacity in color by itself. It starts flickering and is completely out of whack! I tried uninstalling and reinstalling and still no luck. I tried getting in touch with adobe and no luck with that neither! Is there anyway you might be able to help?
Maybe you are looking for
-
ITunes 10.6.3 memory leak
Anyone else having issues with iTunes 10.6.3 running on OSX 10.7.4 leaking memory dry and then filling up ALL your disk partition? I do - once a week now. I have a small boot SSD, but once iTunes fills up the memory it appears to be creating a 30+ G
-
Exit for changing Components in ME21N based on the production Order
Hi, I have a scenerio in which, while creating PO in ME21N for subcontracting(Item category 'L') against a PR, the components for the material should come with my own logic i.e. it will have its production order number, with this production num
-
Ipod screen on while connected to mac
Screen stays on when connected to my mac, seems to prevent it from getting a full charge. If I eject ipod and leave connected, the screen dims, then it will charge. Is this normal? I wish the screen would dim, I use it as a external disk too.
-
Any tips for creating a realistic midi cymbal swell?
surely there has be to a way to create a nice cymbal swell - I used to use cubase but it never sounded realistic just filling in a large number of cymbal crashes jammed together - too percussive. any assistance would be awesome! thanks, stefano targh
-
Main Stage & 3rd party plug ins
I'm a Main Stage newbie with 3rd party plugins (Ivory II; Kontakt 5) I would like to use via Main Stage. Having difficulty. After clicking and holding I/O, I do find "AU Instruments" in the dropdown menu with the plug-ins I've installed, but how do I