some macro questions

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

some macro questions

Post by FrizzleFry » 2020 May 03, 23:18

I have not messed with macros in a while but I'm trying something and I have some questions:

Is there a way to prevent the edit macro dialog closing when you run the macro?
I assigned a keystroke to edit macro so that is not so bad now.

Why do you have to retype the entire macro name every time you want to save it?
This has always annoyed me with most of the custom items.
Also, why does it not save if you do not run after saving?

What I want is to create a folder in the opposite pane using the parent and current folder names in the active pane.

For example, if the current pane is in 'C:\something\parent\current' ,I want the macro to create a folder named 'parent-current' in the opposite pane.

I've got something that works but it seems very slow. Right now it only works with the left pane being active but I think I know how to deal with that.

Code: Select all

# get full name of active folder from address bar
findwnd address
findclass combobox
gettext $2

# get name of parent folder and add it to $3
pop $2
chopstr \-2
store $4
pop $3
addstr $4
store $3

# add "-' to $3
pop "-"
store $4
pop $3
addstr $4
store $3

# get name of current folder and add it to $3
pop $2
chopstr \-1
store $4
pop $3
addstr $4
store $3
#message $3

findwnd "right pane"
setfocus

COMMAND 32796 # create new folder
POP 0
FINDCLASS Edit
FINDCLASS Edit
SETTEXT $3
SENDKEY RETURN
SENDKEY RETURN

findwnd "left pane"
setfocus

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

Re: some macro questions

Post by nikos » 2020 May 04, 07:54

these macro quirks are known, but the idea is that first you edit and troubleshoot the macro, then you save it, so you don't need to enter the name again and again. The last macro edited is always remembered even without a name

as for your macro, if it works, well done :)
to work with either pane, use GETFOCUS to start from the current pane, then use

Code: Select all

command 32857 # tab to next pane

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

Re: some macro questions

Post by FrizzleFry » 2020 May 04, 21:15

I tried using

command 32857 # tab to next pane

but it did not seem to work consistently... I'll try it again now that I got the basic task working.

Edit: tab to the next pane is working in my macro now. So now the macro works no matter which pane is active.

I have never liked the workflow of editing user commands and other custom items but you really outdid yourself with the macros. That you have to run the macro after you save it to actually save is just not logical at all. I hope someday you feel inspired to revamp the handling of custom items. Ideally I would like to right click on a toolbar button or menu item and find an edit or properties command rather than the current process of opening the organize menu, finding the item to edit, opening the edit dialog, making the adjustment, closing the edit dialog, closing the organize dialog (which you have to do save the edits).

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

Re: some macro questions

Post by nikos » 2020 May 05, 08:40

FrizzleFry wrote:
2020 May 04, 21:15
Ideally I would like to right click on a toolbar button or menu item and find an edit or properties command
i'll see if I can manage this for the next version
in the meantime you can think outside the box, e.g. use your own editor to edit the macro then copy/paste it in xplorer2 :idea:

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

Re: some macro questions

Post by FrizzleFry » 2020 May 05, 17:21

I did that. It seems I came that that conclusion the last time I was messing with macros. Doing all the edits in my editor then copy+paste to macro windows gets a little tedious after a while.

I also started using a short temp name for the macro while I was working on it and then renamed it when I was happy with it. As I mentioned above, I assigned a keystoke command to edit macro. Still, I have lost several minor edits by executing a macro from the menu rather than from edit macro before I saved it properly.

Post Reply