Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Script to select a file from specified folder?

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #101895

      Has anyone come across a script that would allow me to select a file from a specified folder?

      I have found a (AppleScript) script that opens a file in a folder.
      https://www.yourscriptdoctor.com/automating-adobe-indesign-cc-2015/indesign-scripts-for-paragraph-styles

      And I have a (AppleScript) script that allows me to select a stylesheet from a document in specified folder, but as I’ve no experience in writing scripts I’ve no real clue how it works to customise it for my needs so it opens the .indt file and not just imports the styles.
      https://www.yourscriptdoctor.com/automating-adobe-indesign-cc-2015/indesign-scripts-for-paragraph-styles

      What would be great is a dialogue box that lets me select a file from that folder (elsewhere on my mac not just the a Templates folder in the InDesign app folder — I’m thinking a Dropbox folder so we can all access it).

      I work with a team of designers and have spent some time building template files, full of styles and grids to try and bring some constancy to our work. I was thinking that by having the ability to select a file from a pre-designated folder while still in InDesign might help! Otherwise I’ll just leave the templates folder in Dropbox and keep reminding them where it is.

      Thanks

    • #101897
      Loic Aigon
      Member

      I am probably missing something, how the script you seem to describe would differ from the regular open file command ?

    • #101910

      Fair question. I guess the difference is one willl not have to navigate to the folder manually. Being a multinational company with a ridiculously complicated Dropbox folder structure one can get lost. If I could simply document setup for newbies it would be a quick win.

    • #101920
      Loic Aigon
      Member

      I see.

      Try this :

      
      //MAIN ROUTINE
      /*
      	Change path in aFolder so it matches your own folder path
      	Change canSelectMultiple if needed to true to allow multiple file selection
      	Change exts to include more file types as ex: ["indt","indd",idml"]
      	
      	Then run…
      */
      
      var main = function() {
      	
      	//==============VARS==============//
      	var 
      	aFolder = Folder ( '/change/path/to/point/your/folder/path' ),
      	m = $.os[0]=="M",
      	exts = ["indt"],
      	mf = function(f){return (f instanceof Folder)||RegExp("\.("+exts.join("|")+")$" ).test(f.name);},
      	wf = "Indesign Templates:*.indt",
      	filter = m? mf : wf,
      	canSelectMultiple = false,
      	indtFile;
      
      	//requesting file selection
      	indtFile = aFolder.openDlg('Please pick a file', filter, canSelectMultiple);
      	
      	//Exit if no selection
      	if ( !indtFile ) return;
      	
      	//Opening selection
      	app.open ( indtFile );
      	
      }
      
      //Run script
      main();
      
    • #101967

      Thank you so much! That is exactly what I was looking for.
      Brilliant.

    • #101968
      Loic Aigon
      Member

      My pleasure,

      Feel free to get in touch at ozalto (dot) com. Maybe your “complex” folder organization has not to be and there are some further consulting I could offer ;)

    • #102322
      Anonymous
      Inactive

      I have downloaded a script (Story Script) from Indesignsecrets.com to my iMac desktop.
      How do I get the downloaded script from Finder into my InDesign software?
      Can anybody help? Please?

      Eric

Viewing 6 reply threads
  • You must be logged in to reply to this topic.
Forum Ads