Scripts

From UA Libraries Digital Services Planning and Documentation
(Difference between revisions)
Jump to: navigation, search
(Programming Notes)
 
(10 intermediate revisions by 6 users not shown)
Line 2: Line 2:
  
 
==Software==
 
==Software==
[[For EADs]]
 
  
[[For ETDs]]
+
[[Capture Workflow Scripts | For Capture Workflow]]
  
[[For Quality Control]]
+
[[For Quality Control | For Quality Control on server and in archive]]
  
 
[[For Uploading Content]]
 
[[For Uploading Content]]
Line 13: Line 12:
  
 
[[For Archiving]]
 
[[For Archiving]]
 +
 +
[[For EADs]]
 +
 +
[[For ETDs]]
  
 
[[For Creating Derivatives]]
 
[[For Creating Derivatives]]
Line 25: Line 28:
  
 
[[Counting stuff]]
 
[[Counting stuff]]
 +
 +
[[For Audio]]
 +
 +
==On Making Scripts Work From the S Drive on Windows==
 +
 +
===Associating Ruby Scripts===
 +
*To associate a Ruby .rbw file with the run-time executable found on the Share Drive
 +
**Double click on the script file or a shortcut to the script file.
 +
**If you do not have Ruby installed on your local machine or proper file associations in place Windows will show you an error telling you it does not know what to do with that kind of file.
 +
**In the error window select the option to choose an application from a list, then click OK.
 +
**Click on Browse then navigate to "S:\Digital Projects\Administrative\scripts\Ruby193\bin" and select in this case "rubyw.exe"
 +
**Make sure the "Always use this application..." box is checked, and click "Ok".
 +
**Once the file association is made files with that extension will always default to opening with the selected application.
 +
**The file associations need to be set separately for each computer that needs to run scripts with an executable located on the S Drive.
  
 
==On Making Scripts Work on Mac OSX==
 
==On Making Scripts Work on Mac OSX==
Line 43: Line 60:
 
*In the second case the script AND in the case of double-clicking the filename, the script would have to include the appropriate shebang line, for example '''#!/usr/bin/python''' for Python scripts and '''#!/usr/bin/perl''' for Perl scripts.
 
*In the second case the script AND in the case of double-clicking the filename, the script would have to include the appropriate shebang line, for example '''#!/usr/bin/python''' for Python scripts and '''#!/usr/bin/perl''' for Perl scripts.
 
**This will allow the MACs to know where to locate Python and Perl, respectively.  
 
**This will allow the MACs to know where to locate Python and Perl, respectively.  
**If for some reason this doesn't work, make sure the script is saved with a UNIX style byte order so that the shebang will be read properly by the MAC.
+
**If for some reason this doesn't work, make sure the script is saved with a UNIX style EOL (end of line) so that the shebang will be read properly by the MAC.
**A good text editor like Notepad ++ (Windows) easily allows one to make these changes to text files.
+
**A good text editor like [http://notepad-plus-plus.org/ Notepad ++] (Windows) easily allows one to make these changes to text files.
  
 
===Programming Notes===
 
===Programming Notes===
 
*Save scripts with a UNIX style byte order. Not doing so appears to prevent the OS from being able to read the shebang line.
 
*Save scripts with a UNIX style byte order. Not doing so appears to prevent the OS from being able to read the shebang line.
*If you are adding timestamps to log files in strip all whitespaces and colons from your timestamp variable for any timestamps . Not doing so can prevent the file from getting written.
+
*If you are adding timestamps to log files you may need to strip all whitespaces and colons from your timestamp variable. Not doing so can prevent the file from getting written.
**For example if your timestamp variable is '''$timestamp''' in a PERL script try this:
+
**For example if your timestamp variable is '''$timestamp''' in a PERL script try this after you've already established your timestamp value:
 
   #start MAC block
 
   #start MAC block
 
   #trimming whitespace and colons because the MAC won't write the output file if they are present
 
   #trimming whitespace and colons because the MAC won't write the output file if they are present
Line 57: Line 74:
 
*Make sure you use only forward slashes for path slashes. e.x. "foo/bar" is good, but "foo\bar" is bad.
 
*Make sure you use only forward slashes for path slashes. e.x. "foo/bar" is good, but "foo\bar" is bad.
 
**There should be no need to ever use backslashes in scripts, however, as Windows OS is equally tolerant of forward and back slashes.
 
**There should be no need to ever use backslashes in scripts, however, as Windows OS is equally tolerant of forward and back slashes.
 +
 +
 +
 +
===Additions===
 +
* [[Shift Reporter]]
 +
* [[image:filenamesAndDupes.txt]]
 +
* [[image:makeJpegs.txt]]
 +
* [[image:relocate_all.txt]]
 +
* [[image:findMissing.txt]]
 +
* [[image:moveContent.txt]]

Latest revision as of 15:15, 12 February 2014

All software available from this site uses the Creative Commons BSD License; the license template is available here.

Contents

[edit] Software

For Capture Workflow

For Quality Control on server and in archive

For Uploading Content

For Getting PURLS

For Archiving

For EADs

For ETDs

For Creating Derivatives

Items in books

Cabaniss_Software (For the Cabaniss NHPRC project)

Mass_Content_Software (for mass digitization of collection materials to be linked to from finding aid, without manually-created item level metadata)

For Getting batch information about your files

Counting stuff

For Audio

[edit] On Making Scripts Work From the S Drive on Windows

[edit] Associating Ruby Scripts

  • To associate a Ruby .rbw file with the run-time executable found on the Share Drive
    • Double click on the script file or a shortcut to the script file.
    • If you do not have Ruby installed on your local machine or proper file associations in place Windows will show you an error telling you it does not know what to do with that kind of file.
    • In the error window select the option to choose an application from a list, then click OK.
    • Click on Browse then navigate to "S:\Digital Projects\Administrative\scripts\Ruby193\bin" and select in this case "rubyw.exe"
    • Make sure the "Always use this application..." box is checked, and click "Ok".
    • Once the file association is made files with that extension will always default to opening with the selected application.
    • The file associations need to be set separately for each computer that needs to run scripts with an executable located on the S Drive.

[edit] On Making Scripts Work on Mac OSX

[edit] Associating Scripts

  • To associate files with particular software , CTRL-click on the file.
    • Choose "open with". If that isn’t available, choose "open".
    • In the Enable box, set the value to "All Applications".
    • Check the "Always Open With" box.
    • Select Utilities>Terminal
    • Then click "Open" and you should be good to go.

[edit] Running Scripts

  • Since the MACs come with many scripting languages pre-installed the scripts are essentially run by double clicking on the file name, although manually launching them from the terminal should work as well.
    • For example:
  $ python foo.py
  $ ./foo.py
  • In the second case the script AND in the case of double-clicking the filename, the script would have to include the appropriate shebang line, for example #!/usr/bin/python for Python scripts and #!/usr/bin/perl for Perl scripts.
    • This will allow the MACs to know where to locate Python and Perl, respectively.
    • If for some reason this doesn't work, make sure the script is saved with a UNIX style EOL (end of line) so that the shebang will be read properly by the MAC.
    • A good text editor like Notepad ++ (Windows) easily allows one to make these changes to text files.

[edit] Programming Notes

  • Save scripts with a UNIX style byte order. Not doing so appears to prevent the OS from being able to read the shebang line.
  • If you are adding timestamps to log files you may need to strip all whitespaces and colons from your timestamp variable. Not doing so can prevent the file from getting written.
    • For example if your timestamp variable is $timestamp in a PERL script try this after you've already established your timestamp value:
 #start MAC block
 #trimming whitespace and colons because the MAC won't write the output file if they are present
 $timestamp=~ s/\s//g;
 $timestamp=~ s/://g;
 #end MAC block
  • Make sure you use only forward slashes for path slashes. e.x. "foo/bar" is good, but "foo\bar" is bad.
    • There should be no need to ever use backslashes in scripts, however, as Windows OS is equally tolerant of forward and back slashes.


[edit] Additions

Personal tools