Jump to content

how to detect user-initiated file copy?


orbs
 Share

Recommended Posts

i'm trying to detect if a user initiated a file copy operation, specifically a large size copy which may take several minutes. i find that the window properties of the "file transfer" dialog box varies over OS's, and over languages. for example:

Windows XP:

post-47848-0-73340000-1392018691_thumb.p

Windows 7:

post-47848-0-76412500-1392018761_thumb.p

and:

post-47848-0-18195600-1392018777_thumb.p

Windows 8 also makes it different, and different languages makes it impossible to detect by WinGetTitle().

then i thought it may be better to monitor the clipboard for changes. i can check for changes, but how would i know if a copy is in progress? would it be logical to assume that if there is a very large amount of data in the clipboard, then a large data transfer is in progress (or will begin shortly)? if so, how to i detect how much data is in the clipboard?

thanks for any suggestions.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I'm not 100% But I don't think it's the amount of data in clipboard with a file, rather the type of data. Wouldn't of thought it would copy a whole file to memory, rather the file info including source and destination.

If that is true then you're half way there, as for a copy in progress, I'm also not sure but there is possibly a window message broadcast.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

...the file info including source and destination.

 

so if i examine the clipboard content, and i see file(s) objects in there, i can assume a copy is in progress or about to begin?

makes sense. i'll go on to implement this. thanks!

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

You can be certain a copy has taken place, but only assume a paste is going to occur.

There was a recent thread about detecting clipboard content change.

EDIT:

'?do=embed' frameborder='0' data-embedContent>>

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

i followed the example in the help file for  _ClipBoard_EnumFormats(), and i found that indeed i can detect when a file is copied to clipboard. but if the copy operation is done by drag'n'drop, this is not done thru the clipboard at all. only copy'n'paste reflects in the clipboard.

back to square #1...  :(

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

You know, I do recall a program that shows all windows messages on the fly.

But cannot recall if it were here or external, but might be worth finding and checking for a particular message when you copy a file.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

i got Spy++ : doing drag'n'drop, it lists the mouse moves and clicks and the focus change and activation and stuff, but no messages specifically identify file transfer operation.

(i attach the log if anyone is interested, the copy ends after event #52. it begins almost immediately with the right-click i used to drag the file).

plus, the messages are specific for the Windows Explorer window i'm doing the operation with; if such a message exists and i want to detect it, i'd need to listen to every open window, right?

 

WM-log-File-Copy.txt

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

I'm out of ideas.

Sorry.

EDIT: perhaps there are other types of messages you could hook besides window messages.

Or monitor the window where the file is being copied to, to see if a unique message is received.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

i'm heading back to the window management approach. maybe a common feature (or set of features) can be found between various "copying..." dialogs. maybe a combination of the existence of a progress bar, a single "cancel" button, maximum size etc. can identify a copy dialog.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

You could make an array with predefined window names in it based on multiple languages, Then stick a WinExists($Array, "") inside a For/While loop. Also, A work around for the file size or, seconds remaining in the title would be to change the WinTitleMatchMode to make the windows easier to find.

Also, You could do a check on @OSVersion to call the appropriate function to check for the OS specific window titles along with checking @OSLang to call the appropriate function based on the users language.

Google Translate is your friend ;)

Edited by BlackDawn187
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...