Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 12:34:05 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: REQUEST: Automated search and move tool  (Read 3593 times)

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
REQUEST: Automated search and move tool
« on: October 10, 2008, 03:26:27 AM »
Hello people!
I am a newbie on this forum 8)

Not new on the donationcoders.com website (love it)
For my work i have a job to do, witch is first of all very boring, second, it takes much time!

This is the problem:
I have folders witch contains 1000 folders, folders are named barcode style, ie: EBN0000012355 then EBN0000012356 etc.
Each folder contains a PDF file. These PDF files are created from tiff files. And these tiffs do have the same barcode folder name, but are standing in two different folders somewere on our SAN.

I need the Tiff's and the PDF files together. So now the steps I need to take:
1. Open the folder where i can see the folder listing of all the PDFS.
2. I copy a barcode name, the go to the 1st folder on the SAN to search, richt click, paste the barcode name, and perform a search.
3. Repeat the abobe step on the second folder on the SAN.

4. I move the folder witch comes out the search result to the dir. containing PDF's.
5. I do the same with the second search result.
6. I go back to step one.

This looks for me something that can be done asutomatically. (am i right?:-))
So, i am curious for some tips, maybe code, please help me! :tellme:

Kind regards,
Koen

ps.
I have allready tried some programs and stuff, did'nt work out..



skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #1 on: October 10, 2008, 12:13:34 PM »
 :) Here's an AutoHotkey script, almost untested.

If loops the local folder for dir names, searches the two san folders for a matching name, and moves it to the local folder.

Skrommel

localfolder=C:\PDFS                  ;local and target folder
sanfolder1=\\SAN\TIFS1            ;remote folder 1
sanfolder2=\\SAN\TIFS2            ;remote folder 2

Loop,%localfolder%\*,1            ;search through the local folder
{
  IfInString,A_LoopFileAttrib,D    ;look for folders
  {
    MOVE(A_LoopFileName,sanfolder1,A_LoopFileFullPath)  ;look for the folder in remote folder1
    MOVE(A_LoopFileName,sanfolder2,A_LoopFileFullPath)  ;look for the folder in remote folder2
  }
}
ExitAPP


MOVE(find,root,target)
{
  Loop,%root%\*,1            ;search through the remote folder
  {
    IfInString,A_LoopFileAttrib,D   ;look for folders
    If (A_LoopFileName=find)       ;if match
    {
      FileMoveDir,%A_LoopFileFullPath%,%target%\%find%   ;move the folder to the local folder
      Break
    }
  }
}
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
« Last Edit: October 14, 2008, 01:06:28 PM by skrommel »

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #2 on: October 13, 2008, 12:31:00 PM »
Hey!
Thx for the script!
Doesn;t work though...

I tried to debug, it seems to go wrong with the target and the MOVE command...

Can someone help me further with this?

Koen

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #3 on: October 13, 2008, 04:00:09 PM »
 :-[ Found two small errors and changed the script above...

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #4 on: October 14, 2008, 06:20:25 AM »
Thx!

The script now moves the TIFFS from san 1 folder to the root of PFD folder... but not the san 2 folder...

Can you post comment please with your code?
Then I can better understand what the program is doing..

How can i change the target where the tiffs are coming?

Thanks very much!
Koen


KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #5 on: October 15, 2008, 09:24:45 AM »
Hey Skrommel,

I am trying to make the posiblity to create an output folder, where all the Tiffs are coming after search.
I made a Fileselectfolder, with an output var. When you browse and click a folder, the variabele is set, but nothing happens with the tiff's.

This is my script:

MsgBox, EBN PDF-TIFF zoek tool v1.0 Zet de exe in de root van de te sorteren map met PDF's!



localfolder=C:\PDFS                              ;EBN Weebverzending PDF
sanfolder1=c:\san1                          ;SAN Folder1
sanfolder2=c:\san2                          ;SAN Folder2


FileSelectFolder, OutputVar, , 3            ;Set variable for output folder
if OutputVar =         
    MsgBox, Selecteer eerst een map van EBN weekzending.
else
    MsgBox, Je hebt "%OutputVar%\" geselecteerd.                        



Loop,%localfolder%\*,1                        ;Zoekt door de weekverzending
{
  IfInString,A_LoopFileAttrib,D                ;Kijkt of er mappen zijn
  {
    MOVE(A_LoopFileName,sanfolder1,A_LoopFileFullPath)      ;Kijkt of diezelfde map bestaat in de sanfolder1
    MOVE(A_LoopFileName,sanfolder2,A_LoopFileFullPath)     ;Kijkt of diezelfde map bestaat in de sanfolder2
  }
}
ExitAPP


MOVE(find,root,target)
{
  Loop,%root%\*,1                           ;Zoekt door de root van de sanfolders
{
    IfInString,A_LoopFileAttrib,D   
    If (A_LoopFileName=find)                  ;Als er een match is...
    {
      FileMoveDir,%A_LoopFileFullPath%,%outputvar%%find%      ;Verplaats de map naar de lokale folder
      Break
    }
  }
}


FileMoveDir,%A_LoopFileFullPath%,%outputvar%%find%      ;If I change the %outputvar% to c:\output\ it works fine....

What am I doing wrong?  :tellme:
Koen

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #6 on: October 18, 2008, 11:11:01 AM »
 :tellme: Maybe FileMoveDir,%A_LoopFileFullPath%,%outputvar%\%find%

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.

KoenFugro

  • Participant
  • Joined in 2008
  • *
  • Posts: 26
    • View Profile
    • Donate to Member
Re: REQUEST: Automated search and move tool
« Reply #7 on: October 23, 2008, 06:56:06 AM »
That is not working...The Tiff's are still coming in the PDF folder.
Is there a simple way search not inly in the root of the sanfolders but also in the subfolders of the san folder?  : :tellme:

If the two above problerms are fixed then I can finally use the tool... that would be great! :D

Kind regards,
koen