Script to export all layers as shapefiles

JamesRutterJamesRutter Global Mapper UserPosts: 98Trusted User
edited March 2014 in Technical Support
Scratching my head with this one. I'm trying to use the following script to export all 30 layers in my workspace to individual shapefiles. I've adapted the script from an example in the scripting guide. If I start the script with all layers switched off I get "warning: no matching layers found to loop over" , which I don't understand seeing as I'm using a wildcard for the 'filename'.

If I switch one layer on it will export that layer fine but then stop. Essentially I can't seem to get the script to switch on a layer, export it, switch it off again and then move on and do the same with the next layer.

Here's the script:...
GLOBAL_MAPPER_SCRIPT VERSION=1.00

// Loop over the loaded layers, doing a separate export for each
LAYER_LOOP_START FILENAME="*"

// Enable the current layer since we hid it above
SET_LAYER_OPTIONS FILENAME="%LAYER_DESC%" HIDDEN=NO

// Export
EXPORT_VECTOR FILENAME="C:\Users\jamesru\Desktop\inspire_data\%LAYER_DESC%.shp" TYPE=SHAPEFILE

// Disable the current layer so it won't be involved in other operations
SET_LAYER_OPTIONS FILENAME="%LAYER_DESC%" HIDDEN=YES
LAYER_LOOP_END

Comments

Sign In or Register to comment.