Forum Discussion
Dmitry_Nikolaev
12 years agoStaff
Hi Ofer,
You can use the Sys.Clipboard property to retrieve the text from the clipboard. Then, you can write your text to a file or create a file and write the text from the clipboard to it. To check whether a file exists, use the aqFile.Exists method. To create a file, use the aqFile.Create method. To write text to a file, use the aqFileInfo.WriteToTextFile method.
See the following sample script:
...
//Path to a file
var PathToFile = "C:\\TempFile.txt";
//Use this code line to call the PasteFromClipboardExample function
PasteFromClipboardExample(PathToFile);
...
//Pastes the text from the clipboard to the specified file
function PasteFromClipboardExample(PathToFile)
{
//Checks whether the file exists
if (!aqFile.Exists(PathToFile)) {
//Creates the file
if (aqFile.Create(PathToFile) == 0)
Log.Message("Target file " + PathToFile + " was created.");
else
Log.Error("The file was not created.");
}
//Writes the text from the clipboard to the file
if (aqFileSystem.GetFileInfo(PathToFile).WriteToTextFile(Sys.Clipboard, aqFile.ctUTF8) == true)
Log.Message("The text from the clipboard has been written to file '" + PathToFile + "' successfully.");
else
Log.Error("The text from clipboard has not been written to file '" + PathToFile + "'.");
}
Related Content
- 10 months agolodecesa
- 9 months agoMehwishDaud
- 2 years agorodm0001