Title: How to save to different drive using feature called 'environment' in G1ANT?
Tags: automation;robotics;rpa;g1ant
Question: 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?


Here is another answer: 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⟧
file.copy path ♥path destinationpath  Q:\Attachments\♥attachment⟦filename⟧

Here is another answer: 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).

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:11/06/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<automation><robotics><rpa><g1ant>', 'Title': "How to save to different drive using feature called 'environment' in G1ANT?", 'ViewCount': 94, 'id': 58728935, 'user_AboutMe': '', 'user_AccountId': 15610078.0, 'user_DisplayName': 'Thomas', 'user_Reputation': 81.0, 'user_Views': 33.0, 'user_id': 11261776.0}}