Jump to content

Windows copy text


djkevin33
 Share

Recommended Posts

I make a copy with a windows screen, is it possible to insert text on this windows

post-30951-1200044269_thumb.jpg

This is a part of the code:

#region consts
Global Const $FO_MOVE                  = 0x0001
Global Const $FO_COPY                  = 0x0002
Global Const $FO_DELETE              = 0x0003
Global Const $FO_RENAME              = 0x0004
Global Const $FOF_MULTIDESTFILES        = 0x0001
Global Const $FOF_CONFIRMMOUSE        = 0x0002
Global Const $FOF_SILENT                = 0x0004
Global Const $FOF_RENAMEONCOLLISION  = 0x0008
Global Const $FOF_NOCONFIRMATION        = 0x0010
Global Const $FOF_WANTMAPPINGHANDLE  = 0x0020
Global Const $FOF_ALLOWUNDO          = 0x0040
Global Const $FOF_FILESONLY          = 0x0080
Global Const $FOF_SIMPLEPROGRESS        = 0x0100
Global Const $FOF_NOCONFIRMMKDIR        = 0x0200
Global Const $FOF_NOERRORUI          = 0x0400
Global Const $FOF_NOCOPYSECURITYATTRIBS = 0x0800
Global Const $FOF_NORECURSION          = 0x1000
Global Const $FOF_NO_CONNECTED_ELEMENTS = 0x2000
Global Const $FOF_WANTNUKEWARNING      = 0x4000
Global Const $FOF_NORECURSEREPARSE    = 0x8000
#endregion consts


$result = _CopyWithProgress($CheminArchive,$Serveur)

Func _CopyWithProgress($sFrom, $sTo)
  ; version 1 by SumTingWong on 5/26/2006
  ; http://www.autoitscript.com/forum/index.php?showtopic=11888
  ; updated by lod3n on 6/5/2007
    
    Local $SHFILEOPSTRUCT
    Local $pFrom
    Local $pTo
    Local $aDllRet
    Local $nError = 0
    Local $i
    
    $SHFILEOPSTRUCT = DllStructCreate("int;uint;ptr;ptr;uint;int;ptr;ptr")
    If @error Then Return "nostruct"        
; hwnd
    DllStructSetData($SHFILEOPSTRUCT, 1, 0)
; wFunc
    DllStructSetData($SHFILEOPSTRUCT, 2, $FO_COPY)
; pFrom
    $pFrom = DllStructCreate("char[" & StringLen($sFrom)+2 & "]")
; pFrom will now be null-terminated at StringLen($sFrom)+1
    DllStructSetData($pFrom, 1, $sFrom)
    For $i = 1 To StringLen($sFrom)+2
        If DllStructGetData($pFrom, 1, $i) = 10 Then DllStructSetData($pFrom, 1, 0, $i)
    Next
; We need a second null at the end
    DllStructSetData($pFrom, 1, 0, StringLen($sFrom)+2)
    DllStructSetData($SHFILEOPSTRUCT, 3, DllStructGetPtr($pFrom))
; pTo
    $pTo = DllStructCreate("char[" & StringLen($sTo)+2 & "]")
; pTo will now be null-terminated at StringLen($sTo)+1
    DllStructSetData($pTo, 1, $sTo)
; We need a second null at the end
    DllStructSetData($pTo, 1, 0, StringLen($sTo)+2)
    DllStructSetData($SHFILEOPSTRUCT, 4, DllStructGetPtr($pTo))
; fFlags
    DllStructSetData($SHFILEOPSTRUCT, 5, BitOR($FOF_NOCONFIRMMKDIR, _
        $FOF_NOCONFIRMATION, _
        $FOF_NOERRORUI))
; fAnyOperationsAborted
    DllStructSetData($SHFILEOPSTRUCT, 6, 0)
; hNameMappings
    DllStructSetData($SHFILEOPSTRUCT, 7, 0)
; lpszProgressTitle
    DllStructSetData($SHFILEOPSTRUCT, 8, 0)
    $aDllRet = DllCall("shell32.dll", "int", "SHFileOperation", "ptr", DllStructGetPtr($SHFILEOPSTRUCT))
    $retcode = $aDllRet[0]
    $pFrom = 0
    $pTo = 0
    $SHFILEOPSTRUCT = 0
    If $retcode <> 0 Then
;Ajout log windows
    run ( 'eventcreate /T WARNING /ID 100 /L Application /SO "Backup Outlook Archive PST" /D "' & SHFileOperationErrDecode($retcode)& '"' )
        
    Else
;Ajout log windows
        run ( 'eventcreate /T WARNING /ID 100 /L Application /SO "Backup Outlook Archive PST" /D "Archive copier avec succes"' )
    EndIf
    Return True

EndFunc

func SHFileOperationErrDecode($errNum)
    Switch $errNum
        case 1223
            return "L'operation a été intérompu par l'utilisateur."
        case 113    
            return "Les fichiers de destination et de source sont les mèmes"
        case 114    
            return "Multiple file paths were specified in the source buffer, but only one destination file path."
        case 115    
            return "Rename operation was specified but the destination path is a different directory. Use the move operation instead."
        case 116    
            return "The source is a root directory, which cannot be moved or renamed."
        case 117    
            return "The operation was cancelled by the user, or silently cancelled if the appropriate flags were supplied to SHFileOperation."
        case 118    
            return "The destination is a subtree of the source."
        case 120    
            return "Security settings denied access to the source."
        case 121    
            return "The source or destination path exceeded or would exceed MAX_PATH."
        case 122    
            return "The operation involved multiple destination paths, which can fail in the case of a move operation."
        case 124    
            return "The path in the source or destination or both was invalid."
        case 125    
            return "The source and destination have the same parent folder."
        case 126    
            return "The destination path is an existing file."
        case 128    
            return "The destination path is an existing folder."
        case 129    
            return "The name of the file exceeds MAX_PATH."
        case 130    
            return "The destination is a read-only CD-ROM, possibly unformatted."
        case 131    
            return "The destination is a read-only DVD, possibly unformatted."
        case 132    
            return "The destination is a writable CD-ROM, possibly unformatted."
        case 133    
            return "The file involved in the operation is too large for the destination media or file system."
        case 134    
            return "The source is a read-only CD-ROM, possibly unformatted."
        case 135    
            return "The source is a read-only DVD, possibly unformatted."
        case 136    
            return "The source is a writable CD-ROM, possibly unformatted."
        case 183    
            return "MAX_PATH was exceeded during the operation."
        case 1026   
            return "An unknown error occurred. This is typically due to an invalid path in the source or destination. This error does not occur on Microsoft Windows Vista and later."
        case 65536  
            return "An unspecified error occurred on the destination."
        case 65652  
            return "Destination is a root directory and cannot be renamed."   
    EndSwitch
    
    return "SHFileOperation returned errorcode " & hex($errNum) & ", which is not recognized"

EndFunc

Thank you!

Edited by djkevin33
Link to comment
Share on other sites

  • 4 weeks later...
  • 4 months later...

Try this:

#region consts
Global Const $FO_MOVE                   = 0x0001
Global Const $FO_COPY                   = 0x0002
Global Const $FO_DELETE                 = 0x0003
Global Const $FO_RENAME                 = 0x0004
Global Const $FOF_MULTIDESTFILES        = 0x0001
Global Const $FOF_CONFIRMMOUSE          = 0x0002
Global Const $FOF_SILENT                = 0x0004
Global Const $FOF_RENAMEONCOLLISION     = 0x0008
Global Const $FOF_NOCONFIRMATION        = 0x0010
Global Const $FOF_WANTMAPPINGHANDLE     = 0x0020
Global Const $FOF_ALLOWUNDO             = 0x0040
Global Const $FOF_FILESONLY             = 0x0080
Global Const $FOF_SIMPLEPROGRESS        = 0x0100
Global Const $FOF_NOCONFIRMMKDIR        = 0x0200
Global Const $FOF_NOERRORUI             = 0x0400
Global Const $FOF_NOCOPYSECURITYATTRIBS = 0x0800
Global Const $FOF_NORECURSION           = 0x1000
Global Const $FOF_NO_CONNECTED_ELEMENTS = 0x2000
Global Const $FOF_WANTNUKEWARNING       = 0x4000
Global Const $FOF_NORECURSEREPARSE      = 0x8000
#endregion consts

Global $CopyWindowTitle = "Копирование..." ;Change this value to your value, because my OS is russian :)

Global $TimerProcHandle = DllCallbackRegister("_TimerProc", "none", "hwnd;int;int;dword")
Global $TimerCall = DllCall("user32.dll", "int", "SetTimer", "hwnd", 0, "int", 0, "int", 100, _
                             "ptr", DllCallbackGetPtr($TimerProcHandle))
$TimerCall = $TimerCall[0]

$CheminArchive = "d:\Video\New\GLAZ.avi"
$Serveur = "c:\"

$result = _CopyWithProgress($CheminArchive, $Serveur)

Func _CopyWithProgress($sFrom, $sTo)
  ; version 1 by SumTingWong on 5/26/2006
  ; http://www.autoitscript.com/forum/index.php?showtopic=11888
  ; updated by lod3n on 6/5/2007
    
    Local $SHFILEOPSTRUCT
    Local $pFrom
    Local $pTo
    Local $aDllRet
    Local $nError = 0
    Local $i
    
    $SHFILEOPSTRUCT = DllStructCreate("int;uint;ptr;ptr;uint;int;ptr;ptr")
    If @error Then Return "nostruct"        
; hwnd
    DllStructSetData($SHFILEOPSTRUCT, 1, 0)
; wFunc
    DllStructSetData($SHFILEOPSTRUCT, 2, $FO_COPY)
; pFrom
    $pFrom = DllStructCreate("char[" & StringLen($sFrom)+2 & "]")
; pFrom will now be null-terminated at StringLen($sFrom)+1
    DllStructSetData($pFrom, 1, $sFrom)
    For $i = 1 To StringLen($sFrom)+2
        If DllStructGetData($pFrom, 1, $i) = 10 Then DllStructSetData($pFrom, 1, 0, $i)
    Next
; We need a second null at the end
    DllStructSetData($pFrom, 1, 0, StringLen($sFrom)+2)
    DllStructSetData($SHFILEOPSTRUCT, 3, DllStructGetPtr($pFrom))
; pTo
    $pTo = DllStructCreate("char[" & StringLen($sTo)+2 & "]")
; pTo will now be null-terminated at StringLen($sTo)+1
    DllStructSetData($pTo, 1, $sTo)
; We need a second null at the end
    DllStructSetData($pTo, 1, 0, StringLen($sTo)+2)
    DllStructSetData($SHFILEOPSTRUCT, 4, DllStructGetPtr($pTo))
; fFlags
    DllStructSetData($SHFILEOPSTRUCT, 5, BitOR($FOF_NOCONFIRMMKDIR, _
        $FOF_NOCONFIRMATION, _
        $FOF_NOERRORUI))
; fAnyOperationsAborted
    DllStructSetData($SHFILEOPSTRUCT, 6, 0)
; hNameMappings
    DllStructSetData($SHFILEOPSTRUCT, 7, 0)
; lpszProgressTitle
    DllStructSetData($SHFILEOPSTRUCT, 8, 0)
    $aDllRet = DllCall("shell32.dll", "int", "SHFileOperation", "ptr", DllStructGetPtr($SHFILEOPSTRUCT))
    $retcode = $aDllRet[0]
    $pFrom = 0
    $pTo = 0
    $SHFILEOPSTRUCT = 0
    If $retcode <> 0 Then
;Ajout log windows
    run ( 'eventcreate /T WARNING /ID 100 /L Application /SO "Backup Outlook Archive PST" /D "' & SHFileOperationErrDecode($retcode)& '"' )
        
    Else
;Ajout log windows
        run ( 'eventcreate /T WARNING /ID 100 /L Application /SO "Backup Outlook Archive PST" /D "Archive copier avec succes"' )
    EndIf
    Return True

EndFunc

func SHFileOperationErrDecode($errNum)
    Switch $errNum
        case 1223
            return "L'operation a ete interompu par l'utilisateur."
        case 113    
            return "Les fichiers de destination et de source sont les memes"
        case 114    
            return "Multiple file paths were specified in the source buffer, but only one destination file path."
        case 115    
            return "Rename operation was specified but the destination path is a different directory. Use the move operation instead."
        case 116    
            return "The source is a root directory, which cannot be moved or renamed."
        case 117    
            return "The operation was cancelled by the user, or silently cancelled if the appropriate flags were supplied to SHFileOperation."
        case 118    
            return "The destination is a subtree of the source."
        case 120    
            return "Security settings denied access to the source."
        case 121    
            return "The source or destination path exceeded or would exceed MAX_PATH."
        case 122    
            return "The operation involved multiple destination paths, which can fail in the case of a move operation."
        case 124    
            return "The path in the source or destination or both was invalid."
        case 125    
            return "The source and destination have the same parent folder."
        case 126    
            return "The destination path is an existing file."
        case 128    
            return "The destination path is an existing folder."
        case 129    
            return "The name of the file exceeds MAX_PATH."
        case 130    
            return "The destination is a read-only CD-ROM, possibly unformatted."
        case 131    
            return "The destination is a read-only DVD, possibly unformatted."
        case 132    
            return "The destination is a writable CD-ROM, possibly unformatted."
        case 133    
            return "The file involved in the operation is too large for the destination media or file system."
        case 134    
            return "The source is a read-only CD-ROM, possibly unformatted."
        case 135    
            return "The source is a read-only DVD, possibly unformatted."
        case 136    
            return "The source is a writable CD-ROM, possibly unformatted."
        case 183    
            return "MAX_PATH was exceeded during the operation."
        case 1026   
            return "An unknown error occurred. This is typically due to an invalid path in the source or destination. This error does not occur on Microsoft Windows Vista and later."
        case 65536  
            return "An unspecified error occurred on the destination."
        case 65652  
            return "Destination is a root directory and cannot be renamed."   
    EndSwitch
    
    return "SHFileOperation returned errorcode " & hex($errNum) & ", which is not recognized"

EndFunc

Func _TimerProc($hWnd, $Msg, $IDTimer, $dwTime)
    If WinExists($CopyWindowTitle) Then
        DllCallbackFree($TimerProcHandle)
        DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $TimerCall)
        
        ControlSetText($CopyWindowTitle, "", "Static2", "What you copying?")
        ControlSetText($CopyWindowTitle, "", "Static1", "I don`t know!")
        ControlSetText($CopyWindowTitle, "", "Static3", "How many time remain?")
        ControlSetText($CopyWindowTitle, "", "Button1", "Button")
        WinSetTitle($CopyWindowTitle, "", "My new title")
    EndIf
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...