Reputation: 81
There is a feature called ‘environment’ in G1ANT.Studio which allows me to save attachments to the C drive directory e.g.
♥environment⟦USERPROFILE⟧\Documents\Attachments\♥attachment⟦filename⟧
can you tell me how to save to a different drive, I tried the below but it doesn't work.
♥environment Q:\Attachments\♥attachment⟦filename⟧
Does anyone help?
Upvotes: 1
Views: 100
Reputation: 457
Concatenate the path and variable inside the G1ANT string:
♥path = ‴Q:\Attachments\♥attachment⟦filename⟧‴
Concatenation outside the string (or without "+") might lead to some unexpected results (at the moment).
Upvotes: 1
Reputation: 438
First things first, in G1ANT.Studio there are Variables and Special Variables. Special Variables are prepared variables by the G1ANT.Studio gathered from within the system to give easy access to some useful information. Variables, on the other hand, are defined by user. One of the Special Variables is ♥environment which you've used. As you can see there is a little magic there which allows you to get a path to your user's folder path.
An environment special variable is filled with other very useful information about common paths inside your computer. You can read more about it here
Getting this into account let's see what happens in this code snippet.
♥environment⟦USERPROFILE⟧\Documents\Attachments\♥attachment⟦filename⟧
Firstly, you are asking our lovely environment variable to see if there's USERPROFILE there and if so, return it.
♥environment⟦USERPROFILE⟧
Then you want to extend it with specified by you a path to a folder.
\Documents\Attachments\
In the end, you just want to name somehow the file you want to save. As you probably used some kind of an attachment variable that has its own index that returns the filename, you are just extending the final path by the filename from this variable.
♥attachment⟦filename⟧
If you want to see the resulting path, you should just try to show it on screen by using dialog command. For example:
dialog ♥environment⟦USERPROFILE⟧\Documents\Attachments\♥attachment⟦filename⟧
It should result in a simple popup with a location you want to save your file to.
So the answer to your question how to change the location of the saved file - just use a path instead of the environment variable.
Instead of
file.copy path ♥path destinationpath ♥environment⟦USERPROFILE⟧\Documents\Attachments\♥attachment⟦filename⟧
Use
file.copy path ♥path destinationpath Q:\Attachments\♥attachment⟦filename⟧
Upvotes: 3