Sign in to follow this  
Followers 0
VictorMax

select one file and rename a set of files

6 posts in this topic

Hello everyone,

I'm a very new newbie in the 'scripting world' but due to AutoIt i'm beginning to enjoy scripting..

I've made some install scripts and it works fine but now I have a very difficult issue to complete.

The case is that I have a folder with 30 fotographs in it from my digital camera, the files are named DSC_00001.jpg to DSC_00030.jpg.

I need a routine that opens a new Windows Explorer window with all 30 photographs from which I can choose a random photo, after I select it with a mouse-click (or finger on a touchscreen) this chosen photo has to be renamed in test.jpg and all other 29 photographs too in test1.jpg, test2.jpg and so on. The tricky part is that all photographs has to be renamed in a circle (loop) after the random selected photograph..

for example: say I have chosen DSC_00028.jpg, this is the 28th fotograph in the sequence, this file must be renamed in test.jpg then DSC00029.jpg has to be test1.jpg and DSC00030.jpg hast to be test2.jpg but then we are at the end of the filelist, the routine has to continue and pick up the first photograph in the filelist DSC_00001.jpg in the sequence and rename it to test3.jpg and so on until DSC_00027.jpg which is the last photo and has to be renamed in test30.jpg..

And because the digital camera contineous to number new taken photographs the filenames are never the same, only the same amount of photographs. The above routine always are 30 photographs of a 360 degree rotating object where the starting point is never the same, therefore we want to choose the 'starting' picture...

Can anyone help me on the way with this script? thanks in advance.

Best regards,

Victor

Share this post


Link to post
Share on other sites



Hi.

There is a perfect tool to do so: one for a rename (14aren.exe)

regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Hello Rudi,

Thanks for the suggestion, i've just tried aren14 but it isn't what I'm looking for, because the difficulty is in the file which I select to be the first to rename and then all the rest from that file to the end of the list en then from beginning of list unto the selected file..

Maybe it can be simpler but then I need to know the AutoIT command for selecting all files in a selected folder and the command for the right-click mouse stroke...

Hope someone can help me on the right track..

Best regards,

Victor

Share this post


Link to post
Share on other sites

Hello everyone,

I'm a very new newbie in the 'scripting world' but due to AutoIt i'm beginning to enjoy scripting..

I've made some install scripts and it works fine but now I have a very difficult issue to complete.

The case is that I have a folder with 30 fotographs in it from my digital camera, the files are named DSC_00001.jpg to DSC_00030.jpg.

I need a routine that opens a new Windows Explorer window with all 30 photographs from which I can choose a random photo, after I select it with a mouse-click (or finger on a touchscreen) this chosen photo has to be renamed in test.jpg and all other 29 photographs too in test1.jpg, test2.jpg and so on. The tricky part is that all photographs has to be renamed in a circle (loop) after the random selected photograph..

for example: say I have chosen DSC_00028.jpg, this is the 28th fotograph in the sequence, this file must be renamed in test.jpg then DSC00029.jpg has to be test1.jpg and DSC00030.jpg hast to be test2.jpg but then we are at the end of the filelist, the routine has to continue and pick up the first photograph in the filelist DSC_00001.jpg in the sequence and rename it to test3.jpg and so on until DSC_00027.jpg which is the last photo and has to be renamed in test30.jpg..

And because the digital camera contineous to number new taken photographs the filenames are never the same, only the same amount of photographs. The above routine always are 30 photographs of a 360 degree rotating object where the starting point is never the same, therefore we want to choose the 'starting' picture...

Can anyone help me on the way with this script? thanks in advance.

Best regards,

Victor

I think it would be fairly simple for AUtoIt. I would do it like this

First have a FileSelectFolder to let the user select the folder where the photos are. Find the names of the files in the folder with FileFindFirst($SourceFolder & "\DSC_*.jpg") and FileFindNext. Check to see which number is the lowest, lets say its $StartPicNumber

Then create a gui with 30 pics using GuiCTrlCreatePic showing each of the photos in order. I would use an array for the $pic IDs so you have $Pic[0] to $Pic[29]

The user clicks the phot he wants, you confirm that it is really the one to start with, then you have a little loop to decide the pic number which was clicked. Lets say the number was $sel. Then you copy them to another folder like this

$kk = $Sel

for $n = 1 to 30
    FileCopy(StringFormat("%s\DSC_%05d.jpg",$SourceFolder,$kk + $StartPicNumber),StringFormat("%s\test%2d.jpg",$testfoldr,$n))
    $kk =+ 1
    if $kk > 29 then $kk = 0
Next

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Hello Martin,

Thanks for the reply, I will try it and come back to share the results..

Best regards,

Victor

Share this post


Link to post
Share on other sites

Hello Martin,

I have tried to get your suggestion to work but I didn't get further then 'FileSelectFolder', my knowledge about AutoIT is too insufficient.

The 'FileFindFirst ($SourceFolder & "\DSC_*.jpg")' isn't recognized in AutoIT..

Is it possible to clarify your code to me?

Best regards,

Victor

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