C-Command Software Forum

Stationery script: pass file to 'do shell'-command?

Hello,

I would like to pass the created file based on Stationery to a script via ‘do shell’. Is this possible? In the present case it is more of a convenience thing, but other times it could be very useful. Two problems: ‘context’ seems to not contain the basename entered via the dialog, and where if possible do I execute the script?

Also, I would like to be able to run scripts over the files created via Shift-F1, but could not find way to intercept those via AppleScript. Is there a way?

on metadata(_context)
    global _recordPath

    set _libraryPath to libraryPath of _context
    set _recordBaseName to "theFile" -- get basename entered in dialog.
    set _libraryPath to replaceString(_libraryPath, "EagleFilerLibrary.eflibrary", "")
    set _recordPath to _libraryPath & folderName of _context & "/" & _recordBaseName & ".rtf"

    -- pass the created file to a script somehow and somewhere.
    -- do shell script "/usr/bin/perl /opt/local/bin/eaglefiler_set_swedish.pl " & _recordPath  
end metadata

Regards,
Martin

You are right that the context parameter does not contain the basename entered in the sheet. I will add this as a feature request.

Currently, it doesn’t make sense to access the file from the script because the file isn’t created until after the script has run.

There’s currently no way to do this, but I agree that some sort of “import hook script” functionality would be nice. Right now, the closest feature is that you can process Web pages through a server tool such as Instapaper Mobilizer.

Thanks!

Yes. I am sure you have a good feeling for where, if at all, such a feature fits in the scheme of things.

Thanks for mentioning it! That could be useful.

Regards,
Martin