Sign in to follow this  
Followers 0
Tasmania

Copy a full document from the path to the clipboard

7 posts in this topic

Anyone know of a way to copy an entire document to the clipboard? Exactly as it is?

At my office, we are running AutoManager Meridian 2006, and the two or three ways to put a file is 1) Drag and drop, or 2) Copy and Paste. I can't find any other way to overwrite a file in AutoManager.

I looked through the help file, but all I found was a way to copy from a source dir to the target dir. That would be awesome and it'd be exactly what I was looking for... if I had access to the folders and such that AutoManager is managing. Of course, the whole purpose of a file management system is to prevent that kind of thing...

Share this post


Link to post
Share on other sites



You do know there's a clibboard limit right?

Put in Clip board = ClipPut()?

Read a file = FileRead()?

ie...

ClipPut(FileRead(..))?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Anyone know of a way to copy an entire document to the clipboard? Exactly as it is?

At my office, we are running AutoManager Meridian 2006, and the two or three ways to put a file is 1) Drag and drop, or 2) Copy and Paste. I can't find any other way to overwrite a file in AutoManager.

I looked through the help file, but all I found was a way to copy from a source dir to the target dir. That would be awesome and it'd be exactly what I was looking for... if I had access to the folders and such that AutoManager is managing. Of course, the whole purpose of a file management system is to prevent that kind of thing...

Here's an example with a .txt file. Before running this make sure you have C:\mytest.txt so the script can copy and paste it to C:\mytest2.txt. If you want to work with other types of files, you might want to look at FileOpen() and possibly the MSWord UDF.

#include<file.au3>

Local $aTemp, $file = "c:\mytest.txt"

_FileReadToArray($file,$aTemp)
_FileWriteFromArray("C:\mytest2.txt",$aTemp)

MsgBox(0,"","check")

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Well, after some experiementing I've failed miserably. I'm close, I feel, but I'm not sure it's possible. All of what has been stated here requires that I know the source destination directory, however I don't. I'm interfacing with an application that uses smoke and mirrors to handle all the document pathing.

What I have tried is FileCopy, but it's not working... this is my code:

AutoItSetOption("WinTitleMatchMode", 2)
        
        WinActivate("AutoManager Meridian")
        
        MsgBox(64, "Order Acknowledgement", "Please select the order acknowledgement document to enter into PDM.")
        
        WinWaitClose("Order Acknowledgement")
        
        $filedoc = FileOpenDialog("Order Acknowledgement", "C:\SYMWORK\", "Word Documents (*.doc)", 7)
        
        $route = FileCopy($filedoc, ClipPut())
        
        If Not $newitem Then
            $filename = StringSplit($filedoc, "\")
            $filename = $filename[3]
            
            WinWaitActive("AutoManager Meridian")
            
            Send("^f")
            
            WinWaitActive("Find documents")
            
            ControlSend("Find documents", "", "[ID:250]", "+{END}{DEL}" & $filename)
            
            ControlClick("Find documents", "", "[ID:241]")
            
            $status = StatusbarGetText("Find documents")
            
            If Not $status = "1 items found, 1 shown" Then
                MsgBox(16, "Error", "That item was not found. Exiting script.")
                Exit
            EndIf
            
            Sleep(1000)
            
            ControlClick("Find documents", "", "[ID:3]")
            
            WinWaitActive("AutoManager Meridian")
            
            Sleep(1500)
            
            Send("!dw{DOWN 3}{ENTER}")
            
            WinWaitActive("Document Workflow - 'Start Change'")
            
            ControlClick("Start Change", "", 1)
            
            WinWaitActive("AutoManager Meridian")
            
            Sleep(1000)
            
            Send("^v")
        EndIf

It doesn't work as it is, obviously, but that's the effect I'm looking for.

Edited by Tasmania

Share this post


Link to post
Share on other sites

Any idea's?

Share this post


Link to post
Share on other sites

.... All of what has been stated here requires that I know the source destination directory, however I don't. .... I have tried ... FileCopy, but it's not working... this is my code:

;
    $filedoc = FileOpenDialog("Order Acknowledgement", "C:\SYMWORK\", "Word Documents (*.doc)", 7)
    $route = FileCopy($filedoc, ClipPut())
    If Not $newitem Then
          $filename = StringSplit($filedoc, "\")
          $filename = $filename[3]
    ;oÝ÷ Ûú®¢×¢éبØZ¶Ø^¦º/ײè zËb¢{+z«¢­æ¤'²«qç^²Ø§jبثyËh¯!bਧ*Þªè«zËazƦzØbS[Z¶+4ß©ÞÂ+^Ë©¦¶Þ¦·¬z{HßÙ ¹ë,x2¢ê',Ûhrr¶¢{^Û(|Ä¢·]¡Ë¦z{l¶§¥«-zØ^ríz{l{hÊ«ëh1©ÚêÌz¸©é®+jjâN­ªÞÊ«y©e˧¶)à¶æ©+"q©¢¨~Ø^~)^°¸¤{¬{¥*.¢yrmì(®H§­Ú~)^±¦zfÞ¬v'lº²ßÛþèÊ°z· ¢)à¶ÞÂäx0ØV¢·]¡Ë¦z{l¶${h1%¨­Õöÿ¸l)j»h|­ ZØʬyªÜj+w*.ßÙe±ç°«ljö¢¦åxò¢æ«zåÊ)íz·¬µçbØ^ríz{l¡ûayj+uÚ²Ø^¯zØb±Êy«kÈfm[z«}ç-nëb·eÚ-ëkÉk&Þn(i×r«,¢g¬º²Ø¨Ë"Ç¡{l¶ºØh®í娭֮Ý@Åb·öYhnø¨ºÉrç¶ÞÞ¶§¢×©iÚÞ}êÞǬ"W¶Ø^)è­¢)eºËkj×­«b¶+)¢Ë"nW­¡Ê)ÊØ^ríz{l¡ö¡Çâ觶÷Þ­éíjeÆ­Ç¢­+!zZZØ(¡ÙnrM÷jëh×6#include <Word.au3>
MsgBox(64, "Order Acknowledgement", "Please select the order acknowledgement document to enter into PDM.")
WinWaitClose("Order Acknowledgement")
$filedoc = FileOpenDialog("Order Acknowledgement", "C:\SYMWORK\", "Word Documents (*.doc)", 7)

$filename = StringSplit($filedoc, "|")
Run("notepad.exe")

For $i = 2 To $filename[0]
    $sFilePath = $filename[1] & "\" & $filename[$i]

    _WordErrorHandlerRegister ()
    $oWordApp = _WordCreate ("", 0, 0)
    $oDoc = _WordDocOpen ($oWordApp, $sFilePath)
    $oRange = $oDoc.Content
    $oRange.WholeStory
    $oRange.Copy
    _WordQuit ($oWordApp, -1)
    
    WinActivate("[Class:Notepad]")
    $CopyDoc = ClipGet()
    Send("^v")
Next
MsgBox(0, "Yeah Baby!", "Did it work?")

Exit

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I really appreciate that you've spent some time on the code (most likely), but I have to copy the actual document. It isn't practice here to open the document up inside of Meridian and paste contents, rather we just select "Replace Document Contents" inside of the context menu that pops up. I'm thinking this isn't possible... yet...

Edit:

Questions unanswered! Sorry! Anyway, $newitem is set if, when running through the automation, it has to create the item in the database through our interface. The only reason you see it here is because if it is a new item, the folder doesn't exist yet, therefore you have to follow a different series of steps in order to accomplish adding a word document.

Yes, I will be working with only Word Documents, because in Win Zip there's an easy way to "Add" files... or at least, easy for those of us who don't want to drag and drop.

Edited by Tasmania

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0