Inserting the computer name into the output file?
Regarding the: "Output to CSV" tutorial here: http://community.screen-scraper.com/script_repository/Write_to_CSV
How do I add the "Computer Name" that the session was run on to the output filename?
I know i would need to add it to this line: outputFile = "output/" + session.getName() + ".csv";
I just don't know what the code would be. Anyone?
I'm told that you can
I'm told that you can try:
But I haven't tried it myself. Let me know if it works!
Pardon my ignorance, but how
Pardon my ignorance, but how would I modify my script to test this? What I have now is this:
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
String getDateTime()
{
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-d");
Date date = new Date();
return dateFormat.format(date);
}
String prepareStringForOutput( String value )
{
if (value != null)
{
value = value.replaceAll("\"", "\'");
value = value.replaceAll("&", "&");
value = value.replaceAll(" ", " ");
value = value.trim();
}
return ( (value==null || value.equals( " " ))? "" : value );
}
// Set name of file to write to. the session variable "CSV_NAME" should be declared in another script such as an init script.
outputFile = "output/" + "Session1_" + getDateTime() + ".csv";
It would be something
It would be something like
I don't have a method in
I don't have a method in screen-scraper to do that. Computer names can be a little funky, and I don't really know a good way to do it.
What about some sort of
What about some sort of unique identifier, specific to each PC? We would be sharing the screen scraper data files on the network and we just need to output the filename as something specific to the computer running the session. Any ideas?