Skip to content

Commit

Permalink
Minor updates and bug fixes to user snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
davestewart committed Mar 25, 2012
1 parent 57fc272 commit 120b9ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 12 additions & 8 deletions user/jsfl/snippets/Library/Spreadsheet-edit properties.jsfl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Export the items to a spreadsheet for mass editing, then import again once saved
* @icon {iconsURI}UI/table/table_edit.png
*/
Expand Down Expand Up @@ -28,9 +28,9 @@
this.file = new File(uri, true);

// grab keys and filter
var ignore = 'constructor,timeline,sourceFilePath,scalingGridRect,sourceLibraryName,linkageImportForRS,linkageIdentifier,quality'.split(',');
var ignore = 'constructor,timeline,sourceFilePath,scalingGridRect,shortName,sourceLibraryName,linkageImportForRS,linkageIdentifier,quality'.split(',');
var keys = Utils.getKeys(this.items);
keys = keys.filter(function(key){return ignore.indexOf(key) == -1});
keys = keys.filter(function(key){return ignore.indexOf(key) === -1});

// reorder keys, with path, then name, so user can easily rename items
var index = keys.indexOf('name');
Expand Down Expand Up @@ -87,7 +87,7 @@
}

// update modified
this.modified = this.file.modified;
this.modified = this.file.modified;

// get file contents
var lines = this.file.contents.split(/[\r\n]+/g);
Expand Down Expand Up @@ -126,6 +126,9 @@
}
}
}

// update the item
document.library.updateItem(path);
}

// prompt
Expand All @@ -142,16 +145,17 @@
if(this.items)
{
// ui
var ui = <ui>
var ui =
<ui>
<label flex="1" width="370" value="This script exports the values of the selected objects to a CSV file, which is then opened in Excel for easy editing. Once edited, just click 'Import' to update the selected objects with the new values."/>
<spacer />
<label value="IMPORTANT: Ensure Excel is open before exporting values." flex="1" />
<spacer />
<separator />
<hbox>
<button id="export" label="Export" width="120" />
<button id="import" label="Import" width="120" />
<button id="cancel" label="Cancel" width="120" />
<button id="export" label="1: Export" width="120" />
<button id="import" label="2: Import" width="120" />
<button id="cancel" label="3: Close" width="120" />
</hbox>
</ui>

Expand Down
8 changes: 6 additions & 2 deletions user/jsfl/snippets/_libraries/uri.jsfl
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ xjsfl.init(this);
var folderURI = new URI(uri).getParent();
var moduleURI;

// walk up folder structure and test for manifest.xml
// walk up folder structure and test for manifest.xml + module
while( ! moduleURI && ! URI.isRoot(folderURI) )
{
var file = new File(folderURI + 'manifest.xml');
if(file.exists)
{
moduleURI = new URI(file.uri).folder;
var xml = load(file.uri);
if(xml.module.length())
{
moduleURI = new URI(file.uri).folder;
}
}
folderURI = folderURI.getParent();
}
Expand Down

0 comments on commit 120b9ee

Please sign in to comment.