[updated] Preserving view when switching between doc windows
Posted: 2011-06-09 10:07:20
[Edit: I had copied the wrong macro code into the post initially, it now has the correct code]
Hello all,
I have a macro that I use to automatically cut and paste material from the document I'm currently editing to a scrap document. The macro then switches back to the original document so I can continue my editing. The macro uses the command "Document.setActive $doc" to switch back to the original file.
All works perfectly if the document I'm currently editing is in Page or Draft view. However, if the original document is in Full Screen mode, when the macro switches back to it, the document reverts to Page or Draft depending on what it last was in.
So, finally, here is the question: how can I have the macro switch back to the document I'm currently editing and return it to Full Screen mode?
Thanks in advance,
Josh
For what it is worth, here is the current macro:
Hello all,
I have a macro that I use to automatically cut and paste material from the document I'm currently editing to a scrap document. The macro then switches back to the original document so I can continue my editing. The macro uses the command "Document.setActive $doc" to switch back to the original file.
All works perfectly if the document I'm currently editing is in Page or Draft view. However, if the original document is in Full Screen mode, when the macro switches back to it, the document reverts to Page or Draft depending on what it last was in.
So, finally, here is the question: how can I have the macro switch back to the document I'm currently editing and return it to Full Screen mode?
Thanks in advance,
Josh
For what it is worth, here is the current macro:
Code: Select all
#Get name and path or document being edited.
$doc = Document.active
$path = $doc.filePath
$name = $doc.displayName
#Assemble path and name of Scrap file (always “X -- ” + edited document); always in same folder
$xpath = $path.filePathByRemovingLastComponent
$xname = ‘X -- ’
$xname &= $name
$xpath = $xpath.filePathByAppendingComponent ($xname)
$text = Read Selection # copy current document's selected text
Menu ':Edit:Delete'
# See if X-file Exists: Open it or create it.
If File.existsAtPath($xpath)
Open $xpath
Else
New
Save As $xpath
End
$xdoc = Document.active
Select Document End # move to end of x-document
Type Text "******\n"
$xdoc.insertText( $text, 'm' ) # insert text
Type Text "\n\n"
Save
Document.setActive $doc