AutoHotkey Community

It is currently May 27th, 2012, 2:29 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: February 10th, 2010, 2:50 pm 
Offline

Joined: June 11th, 2005, 9:34 am
Posts: 264
Location: England ish
Hello,

I'm a support enigneer, I connect to a lot of remote sytems and document the things I do. I create around 50-100 Screen shots daily.

Does anyone have a ready script which does

folder a < all screen shots are created in here
folder b < screen shots moved here to various folders.


syntax would be
ask name of new folder > %new folder%

moves all files from folder "a" to "folder b\%new folder%
While doing so, if the file name already exists, then paste with a new name, and it would include sub folders as well..?

Anyone got something like this?

Leo.

[Moved from Scripts & Functions forum. ~jaco0646]

_________________
::
I Have Spoken
::


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2010, 6:34 pm 
Offline

Joined: October 15th, 2007, 3:10 pm
Posts: 790
Location: England
This is an adaptation of a script I posted earlier this morning - should hopefully do what you need?

Code:
SetFormat, Integer, hex ; so that the return value of the function is a hex value to match MSDN

   SourceFolder := "C:\source" ; change this to your default source folder

   while (!DestFolder)
      FileSelectFolder, DestFolder, *C:\destination,,Please select distination folder ; change this to be a sensible place
                                                                                     ;   for default top-level destination.

   SourceFolder := RegExReplace(SourceFolder, "\\$") . "\*" ; Removes the trailing backslashes, if present.  The * means
   DestFolder := RegExReplace(DestFolder, "\\$")           ;   copy everything in the source folder

   VarSetCapacity(SHFILEOP, 30, 0)    ; set up SHFILEOPSTRUCT
   NumPut(1, SHFILEOP, 4)             ; wFunc = FO_MOVE
   NumPut(&SourceFolder, SHFILEOP, 8) ; pFrom
   NumPut(&DestFolder, SHFILEOP, 12)  ; pTo
   NumPut(3612, SHFILEOP, 16)         ; fFlags (FOF_SILENT + FOF_NOCONFIRMATION + FOF_NOCONFIRMMKDIR
                                      ;   + FOF_NOCOPYSECURITYATTRIBS + FOF_NOERRORUI + FOF_RENAMEONCOLLISION = 3612)

   ; This will not show any progress or any errors while moving the files, but will automatically rename files on
   ;   collision (i.e. if file already exists) to "Copy of <filename>"

   If ( Result := DllCall("shell32.dll\SHFileOperation", "Int", &SHFILEOP) )
   {
      MsgBox, % "An error occurred moving the files.  Return Value was """ . Result
      . """.`n`nPlease see the error codes at the following link for the meaning of this:"
      . "`nhttp://msdn.microsoft.com/en-us/library/bb762164%28VS.85%29.aspx"
   }
   Else
      MsgBox, % "Files should have been moved successfully and inherited the destination folder's permissions."
Return



[Edit: This thread should probably be in the Help forum, not here]
[Edit: thanks jaco]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2010, 3:51 pm 
Offline

Joined: October 11th, 2010, 12:30 pm
Posts: 406
OceanMachine, I was looking for such a script, amazing stuff with AHK, thanks!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Alpha Bravo, LazyMan, rbrtryn and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group