eddyb2 Posted June 2, 2009 Posted June 2, 2009 Hi all, My first request for help would be to see if it was possible to script the opening of a file contained in a container without having to first save the file, but I am now starting to believe that this is impossible and the file must be saved locally first. So my next question. I can setup the script to export the field contents - I do not want the user to see the save as dialog box or even know they are saving the document, i want them to click a button and the file opens seamlessly. So, in the script I set the file path to c:/windows/temp/ (this solution will only ever be used on PCs) and I set to automatcially open the file after saving. But i will not know what the file type is so I cannot specify to save it as temp1.xls or temp1.pdf etc Is there anyway I can set the file path to C:/Windows:/temp/ ?? I could use getastext getfiled.... and so on but I do not see a way of using a calc to specify the save as filename? If someone could in fact tell me an easier way of setting a script to open the file from the container regardless of file type withou any user interactiona at all I would be extremely grateful. Many thanks Ed
comment Posted June 2, 2009 Posted June 2, 2009 You are correct - in order to open a file that is embedded in a container field, you must export it first. I do not see a way of using a calc to specify the save as filename? You do this by defining a script variable as the destination path, then using it in the export, for example: Set Variable [ $path ; Get (TemporaryPath) & GetAsText ( Table::ContainerField ) ] Export Field Contents [ Table::ContainerField ; $path ; Automatically open ]
eddyb2 Posted June 2, 2009 Author Posted June 2, 2009 Thanks Comment - looks like it should work perfectly, but am coming accross a small issue. The variable idea works great but the temp path is what I am having a problem with If I use Get(TemporaryPath)& GetAsText(Table::Field) I receive an error when trying to open the file... "Test.pdf" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk I created a temporary field and set this to Get(TemporaryPath) to see where it was going... /C:/Windows/Temp/S13/ Now I am not sure how Get(TemporaryPath) works but the folder S13 does not exist in the Temp directory on my PC. I even tried creating this folder and running it again but still the same error. I have full admin rights to the PC. On the upside, if I set the Path to export to filewin:/C:/Windows/Temp/$Path it works great so thanks for that but I would like to use your suggestion using the Get(TemporaryPath) - didn't know this existed - as this will work on any terminal regardless, but I am having the issue. Any ideas how to solve the error message please? Again, many thanks for your help, this is working great but if I could use the Get function it would be even better! Ed
eddyb2 Posted June 2, 2009 Author Posted June 2, 2009 Having read a few other posts on this eror message I have got it working by adding the filewin: to the path so... Set Variable [$path; Value:"filewin:" & Get (temporaryPath) & GetAsText (table::field)] Works great now, slight shame because now doesn't work on macs but it never will be used on macs so not an issue for now! Thanks again Ed
bcooney Posted June 2, 2009 Posted June 2, 2009 If you just use "file:" instead of "filewin:" I believe it'll work cross-platform. Or, you could use Get (SystemPlatform) to intelligently create the path.
Recommended Posts
This topic is 5712 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now