Say you take a lot of screenshots in Elite Dangerous during your journeys, you get back or look at them later, wondering where each of them were taken, since they are all "Screenshot_XXXXX.bmp". Maybe some of them have a picture of the dash with the system name, but others outside the ship, no clue.
Until FDev starts giving some ability to change the filenames or some type of timestamp in the pictures, the only way you're going to know is if you stop in each system after taking pictures and go name them something distinct, right?
Not if you can rename them on the fly.
Here's a simple command tied to the F10 key (default screenshot, you can change to whatever yours is) that calls an exe which looks up what system you're in and renames that screenshot to <System name> <Date> <Time>. In the command you can also alter the datetime parameters if you want something different than what it's set up.
To get it running as set up in the profile, do the following:
1) Download the attached profile .vap file and import it into your own.
2) Make a new directory under the VoiceAttack directory called "ScreenshotRename".
3) Download the exe attached, or compile it yourself from the source below, and put the exe into the new directory. Note, you can place it anywhere, just change the location in the command appropriately.
4) Change the text variable "bmppath" in the command to point to where your screenshots default to.
5) Change the text variable "logpath", if necessary, to point to where your game netlog directory is.
If all goes well, that's probably it to get started outside of customizing it to your preferences. When you take a screenshot now (F10 as default), VA will step in and rename the file right then to what the system name is and the time and date taken, so you can not only trace your flight, but if you see something and want to revisit it, you know what system to go back to.
Hopefully I haven't made any mistakes in the instructions. I've tested it a number of times, I think it's somewhat stable. As is, feel free to alter as needed, no guarantees, some restrictions apply, etc.
Pasted command profile:
Set Text [bmppath] to '"C:\\Users\\<USERNAME>\\Pictures\\Frontier Developments\\Elite Dangerous\\"'
Set Text [logpath] to '"D:\\Frontier\\EDLaunch\\Products\\elite-dangerous-64\\Logs\\"'
Set Text [datetime] to '"%m-%d-%y %H·%M·%S"'
Pause 0.5 seconds
Run application 'C:\Program Files (x86)\VoiceAttack\ScreenshotRename\renamebmp.exe' -with parameters '{TXT:bmppath} {TXT:logpath} {TXT:datetime}' (hidden) - wait until it completes
Begin Integer Compare : [renameerror] Equals 2
Write '[Red] Error: Rename has mismatch in parameters' to log
End Condition
Source code for executable:
#include "stdafx.h"
#include <cstring>
#include <stdio.h>
#include <iostream>
#include <io.h>
#include <vector>
#include <fstream>
#include <string>
#include <time.h>
using namespace std;
vector<string> lines(1);
string lastfile(string path, string ext) // Get the last file name, should be the most recent one
{
_finddata_t data;
path += ext;
int ff = _findfirst(path.c_str(), &data);
if (ff != -1)
{
int res = 0;
while (res != -1)
{
res = _findnext(ff, &data);
}
_findclose(ff);
}
return data.name;
}
string findsystemname(string file) // Read log file, get the last line that has a system
{
int i = 0;
string temp;
string system;
ifstream input;
input.open(file);
do
{
getline(input, temp); // put all the lines into an array
lines.push_back(temp);
i++;
} while (input.peek() != EOF);
while (i>5) { // now go through array backwards to find the first system
size_t start = lines[i].find("System:"); // they all have this string in them
if (start != string::npos) {
start += 8; // find unique strings
size_t end = lines[i].find("StarPos"); end = end - start - 2; // that the system is
system = lines[i].substr(start, end); // between, adjust the position and extract
return system;
}
i--;
}
return "Unknown"; // if we get this far, no system yet
}
int main(int argc, char *argv[])
{
if (argc > 4) exit(2);
string bmppath = argv[1];
string logpath = argv[2];
string datetime = argv[3];
string lookhere = logpath + lastfile(logpath, "*.log");
string newfilename = findsystemname(lookhere); // find last system name
newfilename = bmppath + newfilename; // build new filename starting with system name
string oldfilename = lastfile(bmppath, "*.bmp"); // find last bmp name
oldfilename = bmppath + oldfilename; // add path to old file
time_t t = time(NULL);
char mbstr[20];
strftime(mbstr, sizeof(mbstr), datetime.c_str(), localtime(&t));
newfilename = newfilename + " " + mbstr + ".bmp";
rename(oldfilename.c_str(), newfilename.c_str());
}