I have about 1200 Word documents that I have downloaded from Lexis (cases, law review articles). The problem is that the documents have more than 1" margins on all four corners, so I have to change the fomatting to each document when I open it. Is there any way to change the top, bottom, left, right margins to .5" to multiple documents at the same time?
AppleInsider › Forums › General › Genius Bar › Simultaneously Changing the Format of 1200+ Word Documents
Recent Reviews
-
I was given the Ipod nano 6th generation for Christmas 2011. I was starting to take up running and needed something to track my run. since I just started I was only using my Ipod roughly 3 times...
-
I have had the iPad Verizon 4G LTE for a month now, and over all I couldn't be happier with the machine. The only issue I have found so far is when on wifi it has a slower speed in processing...
-
I have owned at least a dozen different Mac laptops over the years, starting with a Powerbook 1400 back in the day. The 13-inch Air is my absolute favorite of the bunch. It's the first laptop...
-
I spent quite a bit of time reading the setup manuals and various Apple articles about manually setting up this device since I have an unusual setup, and the setup manuals indicated I would have...
-
all i have to say is i love it its so much faster and i could just slip it into my purse p.s it has a ton of space for the 64gb
Simultaneously Changing the Format of 1200+ Word Documents
post #2 of 16
8/4/06 at 10:29pm
- Kickaha
- Really Fast Typing Member
- Joined: Nov 2001
- Location: Ossining, NY
- Posts: 8,571
- offline
- Select All Posts By This User
post #3 of 16
8/4/06 at 10:55pm
post #4 of 16
8/5/06 at 5:21am
I can't get Word X to script at all.
I think MS wants you to use VBA for that generation of product.
I don't have Word 2004 to test.
Somebody drop Word 2004's icon on the Script Editor's icon and let's see what it says.
I think MS wants you to use VBA for that generation of product.
I don't have Word 2004 to test.
Somebody drop Word 2004's icon on the Script Editor's icon and let's see what it says.
Quote:
Originally Posted by Kickaha
What's the status of AppleScripting in Word?
What's the status of AppleScripting in Word?
--Johnny
--Johnny
post #5 of 16
8/5/06 at 6:20am
- Joined: Sep 2004
- Location: Bognor Regis, UK
- Posts: 553
- offline
- Select All Posts By This User
Quote:
Originally Posted by lundy
Somebody drop Word 2004's icon on the Script Editor's icon and let's see what it says.
Somebody drop Word 2004's icon on the Script Editor's icon and let's see what it says.
Looking through it there is a lot of scripting promise, including the ability to change the margins. I'm pretty new to Applescript, but the following code will change the margin of the active (front) document.
Code:
tell application "Microsoft Word"
set left margin of page setup of active document to (inches to points inches 0.5)
end tell
Sounds like lundy and kickaha know what they're talking about and can turn this into an automative script?
Daniel Tull
Daniel Tull
post #6 of 16
8/5/06 at 7:33am
This script should get you started.
You should specify the margins in the "myMargin" line.
You should put the 1200 documents in a folder and put the path of it in the third line.
I can't test it, but it should save each file in the location specified by the path in the "Close Window" line.
Test it with 2 or so files in the source folder. There will probably be errors - post back and we will debug it.
You should specify the margins in the "myMargin" line.
You should put the 1200 documents in a folder and put the path of it in the third line.
I can't test it, but it should save each file in the location specified by the path in the "Close Window" line.
Test it with 2 or so files in the source folder. There will probably be errors - post back and we will debug it.
Code:
set myMargin to {myTop:0.1, myBottom:0.2, myLeft:0.3, myRight:0.4}
tell application "Finder"
set theFiles to files of folder "myTestFolder" of desktop
set theOutputPath to folder "OutputFolder" of desktop
repeat with theFile in theFiles
open theFile
set theFileName to displayed name of theFile
tell application "Microsoft Word"
tell front document
tell section 1
set top margin to myMargin's myTop
set bottom margin to myMargin's myBottom
set left margin to myMargin's myLeft
set right margin to myMargin's myRight
set theDestination to (theOutputPath as string) & theFileName
close document 1 saving yes saving in file theDestination
end tell
end tell
end tell
end repeat
end tell
Quote:
Originally Posted by danielctull
Looking through it there is a lot of scripting promise, including the ability to change the margins. I'm pretty new to Applescript, but the following code will change the margin of the active (front) document.
Sounds like lundy and kickaha know what they're talking about and can turn this into an automative script?
Looking through it there is a lot of scripting promise, including the ability to change the margins. I'm pretty new to Applescript, but the following code will change the margin of the active (front) document.
Code:
tell application "Microsoft Word"
set left margin of page setup of active document to (inches to points inches 0.5)
end tell
Sounds like lundy and kickaha know what they're talking about and can turn this into an automative script?
--Johnny
--Johnny
post #7 of 16
8/5/06 at 9:08am
post #8 of 16
8/5/06 at 10:28am
- Joined: Sep 2004
- Location: Bognor Regis, UK
- Posts: 553
- offline
- Select All Posts By This User
post #9 of 16
8/5/06 at 12:09pm
Script Debugger 4.0.
I'd be lost without it. It shows you EVERYTHING about everything, trace, breakpoints, you name it.
http://www.latenightsw.com
I'd be lost without it. It shows you EVERYTHING about everything, trace, breakpoints, you name it.
http://www.latenightsw.com
--Johnny
--Johnny
Quote:
Originally Posted by lundy
This script should get you started.
Test it with 2 or so files in the source folder. There will probably be errors - post back and we will debug it.
[/code]
This script should get you started.
Test it with 2 or so files in the source folder. There will probably be errors - post back and we will debug it.
[/code]
Hey Lundy: Thank you for helping me with this and for taking your time to write this Applescript.
1. I ran the script with a test folder with two files and received the following error:
Microsoft Word got an error: Can't set top margin of section 1 of document 1 to 0.5.
2. I tried running the scipt on the folder with all of the documents and received this error. Does it matter that the files are in subfolders? Should I specify the subfolders that the files are in?
Finder got an error: Can't get every file of folder "A.Law" of desktop.
Once again. Thanks.
post #11 of 16
8/5/06 at 5:21pm
Quote:
Originally Posted by Neruda
Hey Lundy: Thank you for helping me with this and for taking your time to write this Applescript.
1. I ran the script with a test folder with two files and received the following error:
Microsoft Word got an error: Can't set top margin of section 1 of document 1 to 0.5.
Hey Lundy: Thank you for helping me with this and for taking your time to write this Applescript.
1. I ran the script with a test folder with two files and received the following error:
Microsoft Word got an error: Can't set top margin of section 1 of document 1 to 0.5.
Bummer. It works PERFECTLY on my machine, with Word X. I gave it a folder of about 20 files and it changed all the margins and put them in the output folder.
I forgot to mention that you have to make sure that Word is open but with no documents open before running the script. I do not have Word 2004, so there may be changes in the AppleScript syntax (I know there is between Excel X and Excel 2004).
Post your script and let me make sure it looks OK.
Quote:
2. I tried running the scipt on the folder with all of the documents and received this error. Does it matter that the files are in subfolders? Should I specify the subfolders that the files are in?
Finder got an error: Can't get every file of folder "A.Law" of desktop.
Once again. Thanks.
Finder got an error: Can't get every file of folder "A.Law" of desktop.
Once again. Thanks.
Yeah - I did not write it to recurse on subfolders, since it is a one-shot deal. Just pile all the documents into one folder. The reason it is choking is that "every file" is choking when it sees a folder.
Again post your code so I can take a look. ALSO - if you have Word X for Mac, try that to see if there is some syntactical change.
--Johnny
--Johnny
post #12 of 16
8/5/06 at 5:37pm
The only reason I can think of for the Word error is if there is no document 1 open. I just tested that single line on a manually-opened document and it worked, no problem.
It could be that the Finder barfed on the "every file" phrase, since there were folders in there, and then Word barfed because the Finder didn't open the file.
Would it be easier for you if I re-wrote it to allow you to choose the input (and possibly output) folders, and you could do it one folder at a time, or is it OK for you to lump all the input files together in one folder without running into duplicate file names?
It could be that the Finder barfed on the "every file" phrase, since there were folders in there, and then Word barfed because the Finder didn't open the file.
Would it be easier for you if I re-wrote it to allow you to choose the input (and possibly output) folders, and you could do it one folder at a time, or is it OK for you to lump all the input files together in one folder without running into duplicate file names?
--Johnny
--Johnny
post #13 of 16
8/5/06 at 5:52pm
OK - I got the Word 2004 AppleScript Reference and the syntax I was using for margins was deleted and replaced by the "Page Setup" syntax mentioned above.
So with the lines of code to set the margins changed, the script is
But I cannot test it as I do not have Word 2004.
We are almost there - we'll get it. There may be syntax changes in opening and saving the file, too - I am looking into that.
So with the lines of code to set the margins changed, the script is
Code:
set myMargin to {myTop:0.1, myBottom:0.2, myLeft:0.3, myRight:0.4}
tell application "Finder"
set theFiles to files of folder "myTestFolder" of desktop
set theOutputPath to folder "OutputFolder" of desktop
repeat with theFile in theFiles
open theFile
set theFileName to displayed name of theFile
tell application "Microsoft Word"
tell front document
set right margin of page setup to inches to points inches (myMargin's myRight)
set left margin of page setup to inches to points inches (myMargin's myLeft)
set top margin of page setup to inches to points inches (myMargin's myTop)
set bottom margin of page setup to inches to points inches (myMargin's myBottom)
set theDestination to (theOutputPath as string) & theFileName
close document 1 saving yes saving in file theDestination
end tell
end tell
end repeat
end tell
But I cannot test it as I do not have Word 2004.
We are almost there - we'll get it. There may be syntax changes in opening and saving the file, too - I am looking into that.
--Johnny
--Johnny
post #15 of 16
8/5/06 at 8:40pm
- Kickaha
- Really Fast Typing Member
- Joined: Nov 2001
- Location: Ossining, NY
- Posts: 8,571
- offline
- Select All Posts By This User
post #16 of 16
8/5/06 at 8:46pm
Return Home
Back to Forum: Genius Bar
- Simultaneously Changing the Format of 1200+ Word Documents
AppleInsider › Forums › General › Genius Bar › Simultaneously Changing the Format of 1200+ Word Documents
Currently, there are 148 Active Users
(8 Members and 140 Guests)
Recent Discussions
- › Google engineers talk fragmentation, how to make Android work for... 1 minute ago
- › 10M Samsung flagship phones in 28 days a 'record,' 5M iPhone 5 in 3... 9 minutes ago
- › Review: AL13 raises the bar for iPhone bumper design 11 minutes ago
- › Editorial: Apple's billions are building an empire for the future 15 minutes ago
- › 34 hours with no sleep...interrsting things start to happenn 45 minutes ago
- › Apple CEO talks taxes ahead of hearing: 'We pay every dollar that... 48 minutes ago
- › Cook: US-built Mac will be refreshed version of existing product 50 minutes ago
- › Apple yanks 'Bang with Friends' app from iOS App Store 1 hour, 26 minutes ago
- › Auction winner pays $610K for cuppa with Apple CEO Tim Cook 2 hours, 50 minutes ago
- › Science is Real. 2 hours, 54 minutes ago
View: New Posts | All Discussions
Recent Reviews
- › Apple iPod nano - 16GB, Silver MC526LL/A (6th Generation) by cc420
- › Apple iPad with Retina Display Wi-Fi + Verizon/Sprint 4G - 64GB,... by Aaron Krahn
- › 13.3-inch Apple MacBook Air MD231LL/A (Mid-2012) by ahilal
- › Apple Time Capsule - 2TB (MD032LL/A) by biyahero
- › Apple iPad Wi-Fi - 64GB, White (MD330LL/A) by raeganapril
- › Apple Magic Trackpad (MC380LL/A) by WisdomSeed
- › Aperture 3 by bcbcbroderick
- › 17-inch Apple MacBook Pro MD311LL/A (Late 2011) by bcbcbroderick
- › Apple iPod touch - 32GB, Black MC544LL/A (4th Generation) by bcbcbroderick
- › Apple iPod touch - 8 GB, White MD057LL/A (4th Generation) by bcbcbroderick
View: More Reviews
New Apple Wikis
- › 2013 'Modified' iPod touch by Mikeycampbell81
- › 2013 MacBook Pros by Mikeycampbell81
- › iPad mini 2 with Retina display by Mikeycampbell81
- › 2013 iPhone 5S by Mikeycampbell81
- › Trade in your old devices for holiday cash by Mikeycampbell81
- › How to sell your old iPad for cash by Mikeycampbell81
- › How to offset the cost of a new iPhone by... by Mikeycampbell81
- › How to save money on AppleCare extended... by Kasper
- › How to offset the cost of a new iPad mini by... by Mikeycampbell81
- › Apple Prototypes by Mikeycampbell81
View: New Apple Wikis | All Apple Wikis
Home | Apple Product Guide | Forums | Apple Wikis | My Profile
About AppleInsider | Join the Community | Advertise
© 2013 AppleInsider is powered by Huddler Tech | FAQ | Support | Privacy/TOS | Site Map
About AppleInsider | Join the Community | Advertise
© 2013 AppleInsider is powered by Huddler Tech | FAQ | Support | Privacy/TOS | Site Map









