Macro to rename file attributes

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
mjbrookes
Member
Member
Posts: 68
Joined: 2007 Sep 19, 11:24

Macro to rename file attributes

Post by mjbrookes » 2019 Apr 13, 14:03

I have a folder with many mp3 files.

I want to edit the Comment and Title fields for each file.

my Manual method is to
press F2
press tab *3
overtype the comment field contents
press F2
press tab *5
overtype the Title field contents
save changes to current file
go down one item in active panel file list


I have tried to write a macro ... but it fails to accept the TAB operations

Code: Select all

COMMAND 32792	#F2 Rename
# SENDKEY TAB		# failed
SENDKEY 0x09		# failed
neither of my attempted sendkey commands worked

but I did get an error message:
---------------------------
xplorer²
---------------------------
Macro stopped execution with error 2 Line: 2 Last argument: 32792 #32792
Rename the selected item in place
Rename (F2)
Do you want to debug the macro?
---------------------------
Yes No
---------------------------

can anyone explain what I am doing wrong?

or, even better, provide the macro code to achieve my task ( :D )

Regards
Mark

User avatar
nikos
Site Admin
Site Admin
Posts: 14355
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Macro to rename file attributes

Post by nikos » 2019 Apr 14, 06:55

it would be very difficult to do this kind of attribute change using macros. There are so many windows involved. The little snippet below shows how to shift the focus to the 3rd editable column. You can try building upon that or you just wait for version 4.3 :)

Code: Select all

COMMAND 32792 #rename
getfocus # edit control
sendkey tab
getfocus 
sendkey tab

mjbrookes
Member
Member
Posts: 68
Joined: 2007 Sep 19, 11:24

Re: Macro to rename file attributes

Post by mjbrookes » 2019 Apr 15, 11:56

Thank you Nikos;

in the end I used:-

Code: Select all

# goto next file
# Rename file - comment
# Start - goto fileNameList in Active Panel - select file ABOVE target file

GETFOCUS
SENDKEY down 					# select next item
COMMAND 32792 					#F2-rename

getfocus							# edit control
sendkey tab
getfocus							# edit control
sendkey tab

and because I am lazy and wanted to do as few keypresses as possible;
I Customised the Keyboard (temporarily)
menu > Customide > Keyboard > Miscellaneous >
33516 == `

which assigned an extra key to run "Ctrl+F12 Repeat last macro command."

Thanks for your help; it turned a long boring task into a
manageable boring task :-)


for my info:-
I had to put the

Code: Select all

GETFOCUS
SENDKEY down 					# select next item
at the start of the code;
if these lines of code were at the bottom then my data entry prevented the execution of the lines of code.

is there a 'proper' way to do this so that I could have
* done the precesses
* then gone down to the next file?

User avatar
nikos
Site Admin
Site Admin
Posts: 14355
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Re: Macro to rename file attributes

Post by nikos » 2019 Apr 16, 05:45

don't worry about "proper" if it works, It works!

Post Reply