Tuesday, September 2, 2014

Applescript to save InDesign pages as outlined EPS files

Today I wrote an Applescript that saves InDesign pages as EPS files, with text converted to outlines. It's kind of sad that I have to do this, but unfortunately that's where we are at this point. Anyway, I thought somebody might find this useful.

To use it, open up Applescript Editor and save as an application.

If you double-click on the application it will take the current InDesign document and:

  1. create a new subfolder inside the folder where the InDesign document is, called “PRINT”
  2. save the InDesign document as a “High Quality Print” PDF in that folder
  3. Open each page of the PDF in Illustrator, in turn, and then save it as an outlined EPS, in the same subfolder.

If you drag one or more closed InDesign files to the application icon, it will open each file in InDesign, do the above steps, and then close the document.

Here's the script...


on SaveAsEPS(indd)
    
    set thePrintDirName to "PRINT"
    
    tell application id "com.adobe.InDesign"
        set inddFolder to file path of indd
        set inddName to name of indd
    end tell
    
    -- the following sets basename to be the InDesign filename 
    -- without the .indd extension
    
    set AppleScript's text item delimiters to "."
    set TextItms to text items of inddName
    set LastItem to item -1 of TextItms
    if LastItem = "indd" then
        set TextItms to reverse of rest of reverse of TextItms
    end if
    set basename to (TextItms as string)
    set AppleScript's text item delimiters to ""
    
    -- make a PRINT folder underneath the InDesign file's folder
    tell application "Finder"
        if (exists folder thePrintDirName of folder inddFolder) is false then
            make folder at inddFolder with properties {name:thePrintDirName}
        end if
    end tell
    
    
    tell application id "com.adobe.InDesign"
        
        set theFileName to (inddFolder & thePrintDirName & ":" & basename) ¬
                    as string
        set thePDFName to (theFileName & ".pdf") as string
        
        tell PDF export preferences
            set page range to all pages
        end tell
        
        tell indd
            export format PDF type to thePDFName without showing options
        end tell
        
        set pageCount to count of pages of indd
        
        tell application "Adobe Illustrator"
            
            repeat with thePageNum from 1 to pageCount
                
                set user interaction level to never interact
                set page of PDF file options of settings to thePageNum
                open (thePDFName as alias) without dialogs
                
                set theEPSName to ¬
                     (theFileName & "_" & thePageNum & "_outl.eps") as string
                
                convert to paths text frames of current document
                save current document in (theEPSName) as eps ¬
                      with options {CMYK PostScript:true, ¬
                      embed all fonts:true, preview:color TIFF, ¬
                      compatibility:Illustrator 8}
                close current document saving no
                
            end repeat
            
        end tell
        
        beep
        display alert "Done exporting." giving up after 10
    end tell
    
end SaveAsEPS

on run {}
    
    tell application id "com.adobe.InDesign"
        
        set theInDD to active document
        tell me to SaveAsEPS(theInDD)
        
    end tell
    
end run

on open Lst
    
    tell application id "com.adobe.InDesign"
        repeat with zItm in Lst
            set Itm to zItm as alias
            set theInDD to open Itm
            
            tell me to SaveAsEPS(theInDD)
            
            close theInDD saving no
            
        end repeat
    end tell
    
end open




Good luck. Some of this was inspired by code on macgrunt.

Saturday, August 30, 2014

Six Californias: An Excuse for More US Highways

As many people know, Tim Draper’s Six Californias plan is now expected to be on the California ballot in 2016. This plan would split California into six separate states: “Jefferson,” “North California,” “Central California,” “Silicon Valley," “West California,” and “South California.”

I want to make it clear that I do not support this plan. It is true that many state government services and programs operate on a local level and could be provided by smaller state governments. But many do not. Water is the elephant in this room, since many areas get their water from other parts of the state, and of course this is especially important in drought years like this one. However, there are other subject matters, such as prisons, pensions, and universities, where splitting the state would cause real problems.

Moreover, it seems to me that any of the potential benefits of smaller, more responsive state governments would be outweighed by the problems entailed by the insane boundary divisions that Tim Draper chose for this particular split. Dividing metropolitan regions into multiple states causes serious problems for regions such as New York and Philadelphia (requiring the creation of unwieldy entities such as the Port Authority of New York and New Jersey to manage metropolitan affairs) and it is a terrible idea to intentionally reproduce those problems here by creating state lines dividing the Los Angeles and San Francisco urban areas.

Nonetheless, it will be on the ballot, and while it’s extremely unlikely to pass a vote of the people (much less be approved by Congress), it’s fun to think about what might happen if it did pass.


The Highway Network


Transportation probably wouldn’t suffer much from a state split: highway construction and maintenance is highly localized anyway, and federal entities already exist to handle interstate transportation. But it’s not clear that the new states would retain the California numbered highway system. Certainly some of them, at least, would adopt new highway shield signs, and the unity of the system would be lost.

What’s the solution? More U.S. highways! The American Association of State Highway and Transportation Officials (AASHTO) has tried to eliminate US highways that were within one state, but now – after the passage of the Six Californias plan – there are a number of state highways that will cross new state boundaries. Surely it would make sense to give these US highway numbers.

Of course, I don’t actually support the expansion of California’s already expansive automobile infrastructure, not with the terrible deficits in infrastructure for less environmentally harmful forms of transportation. But re-signing existing highways isn’t all that significant an expense.


U.S. highway numbers


Wikipedia articles on the US highway system and California highway system are helpful for the uninitiated.

The US highway numbering scheme is as follows: primary routes have one or two digits, and spurs of those have three digits (with the exception of the main route US 101, where 10 is the first “digit”). For primary routes, even numbers run east and west, starting with low numbers in the north, and odd numbers run north and south, starting with low numbers in the east. (The opposite of the later Interstate numbering system.) The most important primary routes usually end in 0, 1, and sometimes 5, but there are many exceptions. Spur routes have three digits, with their "parent" route being the last two digits of the number: so US 199 is a spur route of US 99. Originally the first digit was in order, east to west, but this has been lost over time. Increasingly in recent years, numbers have been given that break the original US highway scheme, such as US 400 (which would have been a spur of nonexistent highway 0) and other three-digit US highways that go nowhere near their "parents".

Where I've suggested a US highway number, it's generally the next available spur number from a nearby US primary route unless noted otherwise. In some cases, I've given spurs from primary routes that have since been converted to Interstates nearby (such as US 240, numbered as a spur of US 40, even though US 40 was entirely changed to I-80 in California). I've avoided using existing US highway numbers and tried to avoid using any existing California highway numbers, but I've felt free to suggest reusing numbers that once were in use but have since been retired.


State highways to be given U.S. highway numbers


CA 1 - The Pacific Coast Highway from Leggett to San Juan Capistrano is one of the most iconic highways not just in California, but in the world. The division of California into several states will divide this highway into five pieces, in the states of Jefferson, North California, Silicon Valley, West California, and South California. This highway should be upgraded to US status to preserve its iconic nature rather than being divided up among all those states. The one problem is, what number to give it? US 1 is already used, of course, on the East Coast. The first branch of US 101 would be the unwieldy "US 1101." I suggest US 999, the highest three-digit number; it does touch branches of US 99 and goes close to US 99's historic range. Another solution would be US 111 -- after all, if ten can be the first "digit" in 101, why can't this one go to eleven? This would require renumbering existing CA 111 in South California, however.

CA 12 - This is an imporant route connecting Sonoma, Napa, and Solano counties in North California with San Joaquin and Calaveras counties in Central California. It intersects what would be US 40 if it had not been replaced by I 80, so should be given a number such as US 740.

CA 14 - This was once part of US 6, when US 6 continued south all the way to Los Angeles. While just re-extending US 6 would entail an unacceptably long stretch where US 6 and US 395 would go together (these are "concurrences" in highway-speak), CA 14 plays an important role linking Central and West California. It could be given a US number such as US 295, as a split from US 395, or US 206, honoring its historical connection with US 6.

CA 20 - This is an important east-west route connecting Fort Bragg, Clear Lake, and Colusa in Jefferson, and Yuba City, Grass Valley, and Nevada City in North California. This highway should be US 240; this would have been a branch from historic US 40 if US 40 still existed.

CA 29 - This is the main highway through the world-famous Napa Valley and is a connector between this area in Central California and Clear Lake, in Jefferson. This could perhaps be US 540, as a branch that runs from US 240 (CA 20), above, to historic US 40 in Vallejo. (Some part of CA 29 runs along what was once historic US 40.)

CA 33 - US 399 once covered what is now CA 33 between Ventura and Taft, and CA 119 between Taft and CA-99 near Bakersfield. (CA 33 began at Taft and continued northward.) The segment of CA 33 between Maricopa and Ventura is still very important in linking Ventura County in West California and Kern County in Central California. I suggest restoring US 399 as it was. The remainder of existing CA 33, although long, is entirely within Central California.

CA 41 - This is a main roadway between the coast near San Luis Obispo in West California, to Fresno and Yosemite in Central California. It is an important tourism link, and is important enough to be given a US number. The westernmost part between Morro Bay and CA-46 was formerly part of US 466. It is an important link to US 99 (CA 99), and so should be given a number such as US 599.

CA 46 - Between its intersections with CA 41 and CA 99, this was formerly part of US 466, which also included CA 41 between Morro Bay and CA 46 and CA 58 between Bakersfield and Barstow. I suggest establishing a restored US 466 with an only slightly different route: CA 46 between Cambria and CA 99 (US 99), then following US 99, then following CA 58 from Bakersfield to Barstow. The western segment of CA 58 would retain that number.

CA 49 - This is another highway of importance in California, connecting parts of the Gold Rush country, which spans Central California, North California, and Jefferson. Unfortunately there is already a US 49, and the number itself is important since it commemorates the Forty-Niners, the pioneer gold miners. US 499 is probably the best alternative available.

CA 57 - The Orange Freeway connects areas in West California and South California. It could be seen as a spur of former US 70, which once extended to Los Angeles, and so could be given the number US 570, close to its current number. Alternatively it could be given a branch number of US 60, such as 560.

CA 58 - See CA 46

CA 60 - Like Highway 14, CA 60 was a part of a US highway when that continued all the way to Los Angeles, in this case US 60. As with US 6, restoring US 60 for its original length would entail an unacceptably long concurrence between I-10 and US-60, which begins far to the east in Arizona. However, there is another alternative. The east end of CA 60 is reasonably close to the west end of CA 62, an important highway connecting I-10, Yucca Valley, Twentynine Palms, and the Arizona border. CA 60, CA 62, and AZ 95 from Parker to Quartzite could all be renumbered as US 60, re-extending US 60 into California and covering part of its former routing.

CA 70 - This road in North California and Jefferson paralleling the Feather River railroad route was formerly US 40 Alternate, and should be given a number such as US 440, commemorating its tie with US 40.

CA 88 - This highway acts as an alternate to US 50, connecting Stockton in Central California to Sutter Creek and Jackson in North California, then back through Alpine County in Central California through to Nevada, where it becomes NV 88 until it reaches US 395. This should be given a number as a branch of US 50, such as US 650. Alternatively, it could just be US 88, since 88 is one of the few two-digit numbers that are not used for US highways.

CA 89 - This road spans the Sierra from Topaz Lake on the Nevada/Central California border, serving as the main road in the Lake Tahoe and Truckee area in North California, continuing through to areas in central Jefferson. This should perhaps be given a number that marks it as a branch of US 50, such as US 750.

CA 91 - The Gardena Freeway is an important link between West California and South California. (It is not associated with historic US 91.) This should probably be given a number associated with US 60, such as US 660.

CA 99 - While much of the historical length of this highway is now I-5, a long stretch of CA-99 exists in the Central Valley which was once US 99. Now it will pass through three states — Jefferson, North California, and Central California. While there has been a movement to change this highway to an Interstate, that would entail significant expenses to bring the road up to Interstate standards. Until and unless that happens, now that it will run through three states, restoring its status to US 99 seems like an obvious move.

CA 119 - See CA 33.

CA 128 - This is an important route between Mendocino in Jefferson, US 101 near Healdsburg, and Winters in the the Sacramento area. This would primarily be a branch of US 101; however, since 101 doesn't have good branch numbers, perhaps this should be US 640, given that it is concurrent for a time with CA 29 (proposed US 540).

CA 152 - The Pacheco Pass highway is an important highway, on the main route between San Jose and Los Angeles. It will be divided between Silicon Valley and Central California. It should be given a number such as US 699 signifying that it is a spur of US 99.

CA 160 - There are only five direct connections between North California and Silicon Valley; all are toll bridges and all are on US or Interstate highways -- except this one. It should be given a number showing that is a branch of US 50, such as US 850.

CA 166 - This was never a US highway, although with a number ending in 66 it looks like it might have been a branch of US 66. (US 166 is in Kansas and Missouri.) This is an important link between Santa Barbara and San Luis Obispo counties in West California and Kern County in Central California. Although perhaps not as important as some other roads, this still could be given a US number. As a branch of US 99, it could be given the number 799.

CA 210 - This is a freeway crossing from West California to South California, is an extension of Interstate 210 and would most logically be considered part of that Interstate. It is certainly important enough to be given a US number. Although it technically violates the US numbering scheme, because it is not near US 10, I suggest using US 210 for the segment that is not an Interstate.


Summary: Proposed new or extended US highways


Proposed US highwayExisting CA highwayFromTo
US 60CA 60, CA 62, AZ 95Los AngelesQuartzite, AZ (continuing to Virginia Beach, VA)
US 99CA 99Wheeler RidgeRed Bluff
US 210CA 210San DimasRedlands
US 240CA 20Fort BraggEmigrant Gap
US 295 (or US 206)CA 14Santa ClaritaInyokern
US 399CA 119 and part of CA 33VenturaBakersfield
US 440CA 70SacramentoBeckwourth Pass
US 466CA 46CambriaFamoso
US 540CA 29VallejoUpper Lake
US 570 (or US 560)CA 57Santa AnaGlendora
US 599CA 41Morro BayYosemite National Park
US 640CA 128AlbionWinters
US 650 (or US 88)CA 88, NV 88StocktonMinden, NV
US 660CA 91Redondo BeachRiverside
US 699CA 152WatsonvilleChowchilla
US 740CA 12SepastopolSan Andreas
US 750CA 89ColevilleMount Shasta
US 799CA 166GuadalupeMettier
US 850CA 160AntiochSacramento
US 999 (or US 111)CA 1San Juan Capistrano Leggett


Other state highways, considered but rejected


CA 4 - Highway 4 exists in both Silicon Valley and Central California, and parts of it are important, but as a link between the two states it is relatively minor.

CA 66 - This is a small remainder of what once was US 66. It does cross the border between West California and South California, but is not really an important route at this point, given that it is a surface street where parallel freeways exist. Still, the romance around US 66 might be sufficient to bring US 66 back in this area, which now will span two states. I can't actually recommend this, though.

CA 120 - This road is an extremely important tourism route from the outskirts of the Bay Area to and through Yosemite. However, its length is entirely in one state, Central California, and this makes it inappropriate as a U.S. highway. It could, perhaps, be designated as a western extension of US 6, and the the current US 6 between Bishop and CA 120 could be redesignated as a state highway (106 is available, or it could be called "US 6 Alternate"). This is true whether or not California is divided, however.

CA 198 - The portion of this in Silicon Valley and connecting that state is relatively unimportant compared to other east-west highways.

A number of other significant highways exist in only one of the proposed states: 36, 96, 139, and 299 only in Jefferson; 78 and 111 only in South California; 168 and 190 entirely in Central California. I can see only one solution for this: more states! I see that someone has already started the @58Californias Twitter account.

Friday, August 1, 2014

Xcode kept asking for license agreement

This may be incredibly specific and boring for most people, but: It turns out that if somehow your /Library/Preferences folder isn't world-readable, Xcode will ask you for license approval every single time you start it (or you run any of the command-line development utilities).

I thought somebody out there besides me, searching the web, might want to know that. I don't know how the permissions of my /Library/Preferences folder changed, but it did somehow.

Thursday, January 2, 2014

Tweets from the past year (or so)

I've been using Twitter this year a lot, and I thought the hypothetical readers of this blog might want to see the Best Tweets By Me of 2013. Or at least the ones I liked, anyway.

Since I've never done this before I'm actually going further back than 2013, but I'm thinking maybe I'll make this an annual tradition.

Driving by outlet mall, I think I want to start a store for middle-aged men called “Forever 42”.

➡️ Tea partiers decry "fiat money" backed by noting but government while bitcoiners want money backed by nothing at all

I feel bad sometimes going to the megachain for iced tea, but didn't expect the chain itself to agree

Embedded image permalink

Brings the boys to the corporation yard MT The Communications Milkshake

Having a Jean Valjean moment


Embedded image permalink

Gettysburg Address not what most people think.
I want to see "Captain Phillips." I hear it's not as square as "Captain Robertson."

Pet peeve: people who include a little logo or vcf file with every email, making it hard to look for real attachments

Finally cracked the all-important 50 followers! I'm sure my "verified user" check will be required any day now.

Misanthropic camp song: Lose old friends, don't new ones win / One is leaden and the other, tin

Do cats use the hashtag ?

Still waiting for the sequel to "March of the Penguins" (to be called "April of the Penguins")

After rewatching 1st epsiode, now I think I should watch rest of DS9 out of order, so will be "not linear."

I was looking for an emoji character that was appropriate for Star Trek, but couldn't find one. The character called "space" is misleading

What would happen if you took old Bob Dylan recordings and used Auto-Tune on his voice?

I am no longer -- I am now . I'm sure this is a huge deal for everyone.

If there were a comic book series called "Anger," I would go to the used comics store and unload my anger issues

Peeve: saying "make a URL" when they mean "make a web page." Might as well say "make an address" when they mean "build a house."

Golden age of area codes: If we must have overlays, I think it should be everything in those borders

In an independent bookstore, waiting for a lecture to start, ashamed to do what I'd really like and pull out my Kindle.

Watching my nephews play "Polar Express". More sophisticated than "Cartesian Express. "

They say if it feels like an elephant is sitting in your chest, call 911. But how do I know how that feels without an elephant trying it?

Someone said I have "solid character", but maybe it would be better liquid: not fixed to a shape but incompressible under pressure

To appreciate "Pitch Perfect," disbelief cannot simply be suspended; it must be expelled.

Personality Quiz: I know why the caged bird (a) sings (b) bangs its head against the bars over and over until it cracks its skull.

"Thank you, but in our home we don't celebrate Garbage Day."

Takes a worried man to tweet a worried tweet. I'm worried now, but won't be worried longer than 140 characters.

I've been playing Tom Paxton's "Can't Help But Wonder Where I'm Bound" lately. Probably not ideal for someone in the transit info business

Msg from year 2022: Remember before fold-out screens, when half an inch made a big difference in our smartphone screens? Boy was that lame.

Looking at my wife's Frommer's France 2005. Wonder if the Tardis has a whole library: France 1992, France 1993, France 1994, France 1995…

Still trying to figure out how Panorama can take really wide pictures of my cat.

Alameda/Albany/Clayton/Danville/Emeryvl/Hercules/Martinez/Moraga/Newark/Piedmont/Pinole/San Pablo/Sn Ramon all paid for BART. Why Livermore?

So just remember whenever you exchange data via NFC with someone you're exchanging data with everyone they've ever exchanged data with.

Curiosity has landed... those Martian cats are gonna be *taken down*.

New catchphrase "Yours to Discover" is at least better than Friendster's "Je me souviens"

I hadn't a new freezer bag, so put the Berkeley Bagel Co bagels in with the Noah's in their freezer bags. Relations between them are frosty