AnsweredAssumed Answered

Export Field Contents - To Current User's Trash/General Best Practices Mac

Question asked by john__j on Mar 7, 2014
Latest reply on Mar 7, 2014 by erolst

I have a situation that requires the ability to export a container field's contents. Ideally, I want to store this export in a somewhat hidden location on the user's system and delete it at some point (without them knowing). The user's Trash folder comes to mind, but I'm also thinking of a temp folder...


I've had luck exporting to the Trash folder in MountainLion, but have not had luck in exporting to the Trash folder in SnowLeopard. Since my user's are Tiger/Leopard/SnowLeopard/MountainLion/Mavericks I need this to by dynamic based on the operating system. It doesn't seem like there should be a difference between the two (ML/SL) Trash folders.


The goal of the behavior is to allow the user to view a container field's contents without having to store the file permanently on their system. From viewing, they can decide to either print the document or save/store it at a location of their choosing. When coupling the "open" feature on the "export field contents" script step this behavior is partially achieved.


For those of you who do this type of export manipulation, what are your best practices? I'm curious/open to creative approaches in how to handle this. I would not like to have to define several output file locations in the "export field contents" script step.





In my script I'm first setting a dynamic variable for the current user's Trash folder:


Replace ( Get ( DesktopPath ) ; Length ( Get ( DesktopPath ) ) - 7 ; 7 ; ".Trash" ) & "FileName"


Next, I set the output the output file location to the previously defined variable ($CurrentUser'sTrash):





I realize the format for the full mac path is "filemac:/VolumeName/DirectoryName/FileName." Even though it looks like my output file location is missing the leading "/", the Replace calculation accounts for this...