Hi,
Similarly to "Paste special > Paste text into new file", which creates a .txt file with clipboard content, is it possible to create a .doc file with text from clipboard by using XYplorer?
Maybe it can be achieved by using a script or any other workaround...
Thanks for info,
Carlos_Cadu
"Paste text into new file", but .doc instead of txt. Possible?
Re: "Paste text into new file", but .doc instead of txt. Possible?
Code: Select all
$documentName = "New Word document.doc";
$fullPath = "<curpath>\$documentName";
$cp = regexreplace(<clipboard>, "[""]", '""');
$content = "";
foreach($line, $cp, <crlf>) {
$content = $content . "objSelection.TypeText " . quote($line) . " &vbNewLine" . <crlf>;
}
$vbs = <<<>>>
' Create a word Document
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
Set objDoc = objWord.Documents.Add()
' Add content
Set objSelection = objWord.Selection
$content
' Save it
objDoc.SaveAs("$fullPath")
objWord.Quit
>>>;
$vbsFile = "%TEMP%\~CreateWordDocument.vbs";
writefile($vbsFile, $vbs);
runret("""cscript"" ""$vbsFile"" //nologo");
delete 0, 0, $vbsFile;
Last edited by bdeshi on 10 Apr 2017 09:59, edited 1 time in total.
Reason: delete 0, 0, delete 0, 0, $vbsFile;; ==> delete 0, 0, $vbsFile;
Reason: delete 0, 0, delete 0, 0, $vbsFile;; ==> delete 0, 0, $vbsFile;
One of my scripts helped you out? Please donate via Paypal
Re: "Paste text into new file", but .doc instead of txt. Possible?
Many thanks for the script Highend!
It worked, and the only issue is that text formatting is being removed, as showed here: https://goo.gl/HZshA0
My main reason to create a .doc file (instead of .txt) is to keep text formatting.
Is possible to adjust the script to create .doc keeping text content formatted?
It worked, and the only issue is that text formatting is being removed, as showed here: https://goo.gl/HZshA0
My main reason to create a .doc file (instead of .txt) is to keep text formatting.
Is possible to adjust the script to create .doc keeping text content formatted?
Re: "Paste text into new file", but .doc instead of txt. Possible?
Afaik not without using an external tool / some ugly hacks in XY / without actually displaying the word document
One of my scripts helped you out? Please donate via Paypal
Re: "Paste text into new file", but .doc instead of txt. Possible?
Many thanks for all feedback highend!
Re: "Paste text into new file", but .doc instead of txt. Possible?
Could be done rather easily e.g. with AHK / AutoIt.
AHK can access COM, so it's easy to create the document and it shouldn't have any problems
to paste the clipboard into the word window...
AHK can access COM, so it's easy to create the document and it shouldn't have any problems
to paste the clipboard into the word window...
One of my scripts helped you out? Please donate via Paypal