Temporarily changing configuration

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
pmoore
Posts: 28
Joined: 27 May 2008 13:50

Temporarily changing configuration

Post by pmoore »

I have 2 "standard" forms in which I need to save emails in my filesystem. Which one is to be used depends on the existing layout of the directory I'm dropping into.

At the moment, I manually go to Configuration/Templates/Dropped Messages and make the change, but it would be nice to be able to automate this (not least because it saves me having to remember the 2 format strings!) Ideally, I'd like to be able to create a toolbar button which would toggle the setting (and for bonus points, the icon would change to show the current setting) but I don't think that's possible - I certainly haven't seen anything in the toolbar customisation dialogs for this. But even just being able to set up a script/user command would be good (I could assign a hot key to toggle the settings).

The setting and settingp commands don't let me set the specific command I want. I suppose I could write something to edit xyplorer.ini manually, but that seems ugly and error-prone, so I'd rather not do that if there's a better way.

Has anyone got any suggestions of how I might do this?

Thanks,
Paul

admin
Site Admin
Posts: 64883
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Temporarily changing configuration

Post by admin »

Currently not possible indeed.

But once more, a user is asking to change a certain setting onthefly/programmatically. For some settings this is easy to do, for others not. This one (dropped messages format) is an easy one.

Let's collect some more demands for such settings (typically buried somewhere in the Configuration dialog) for which it would be useful to have a quick/scriptable way to change them. Then I'll see if/how I can implement that.

pmoore
Posts: 28
Joined: 27 May 2008 13:50

Re: Temporarily changing configuration

Post by pmoore »

Thanks. In the meantime, given that I can write an external program to toggle the setting fairly robustly, am I OK to change xyplorer.ini from an external program? In other words, will XYplorer pick up any changes that I make, or do I need to "notify" the program somehow that the ini file has changed?

If not, I'll stick with the manual approach for now.
Paul

RalphM
Posts: 2042
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: Temporarily changing configuration

Post by RalphM »

The ini is read at startup only, therefore in order to make your "toggle" stick, you have to exit XY, without saving your settings - otherwise this would overwrite the changes you made by an external process again, and then restart XY with the changed ini.

I'm pretty sure this could easier be done with a script, but I'm definitely not one of the cracks re scripting, let's see, if one of the XYSC's (XY Scripting Cracks) comes up with an easy solution for this...

Something along the line of:
1. Save current settings to ini (so you don't loose your other changes)
2. Toggle the needed settings in the ini between the two different states
3. Restart XY without saving

Et voilà
Ralph :)
(OS: W11 24H2 Home x64 - XY: Current x32 beta - Office 2024 32-bit - Display: 1920x1080 @ 125%)

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Temporarily changing configuration

Post by TheQwerty »

Have you considered using the template to give the file as much data as possible and then using separate move or rename commands (as UDC or scripts) to format it as you desire?

pmoore
Posts: 28
Joined: 27 May 2008 13:50

Re: Temporarily changing configuration

Post by pmoore »

TheQwerty wrote:Have you considered using the template to give the file as much data as possible and then using separate move or rename commands (as UDC or scripts) to format it as you desire?
No, I hadn't thought of that. Thanks, it's not a bad option.

Specifically, if I define a UDC to run the script

Code: Select all

rename b,"<datem yyyy-mm-dd hh-nn-ss> *"
and assign it to a key, I can just hit that key after the drop - the dropped files are still selected and the job's done. Ideally, I'd add a step to strip off any -01 -02 etc suffixes which may have been added because the message subject isn't unique, but that's details...

Yes, that looks like a perfectly reasonable approach. Thanks.
Paul.

pmoore
Posts: 28
Joined: 27 May 2008 13:50

Re: Temporarily changing configuration

Post by pmoore »

pmoore wrote:Specifically, if I define a UDC to run the script

Code: Select all

rename b,"<datem yyyy-mm-dd hh-nn-ss> *"
and assign it to a key, I can just hit that key after the drop - the dropped files are still selected and the job's done. Ideally, I'd add a step to strip off any -01 -02 etc suffixes which may have been added because the message subject isn't unique, but that's details...

Yes, that looks like a perfectly reasonable approach. Thanks.
Grrr. It looks like this doesn't work as I want. A batch rename UDC (category Rename) renames each file based on its own modification date, but a script seems to pick the date from the first selected file, rather than on a file-by-file basis. This seems like a bug - or do I need to somehow escape the <datem...> construct so it isn't expanded too early?

As an example to try - select 2 files with different modification dates. Then type the following in the address bar:

Code: Select all

::rename b,"<datem yyyy-mm-dd hh-nn-ss> *"
Both files get renamed with the same modification date...

Paul.

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: Temporarily changing configuration

Post by jacky »

pmoore wrote:Grrr. It looks like this doesn't work as I want. A batch rename UDC (category Rename) renames each file based on its own modification date, but a script seems to pick the date from the first selected file, rather than on a file-by-file basis. This seems like a bug - or do I need to somehow escape the <datem...> construct so it isn't expanded too early?
I would say it's intended, as those variables are supposed to be parsed by the batch rename process and not the script itself to work as you expect, but the use of double quotes makes the string be processed before hand. Of course, there's an easy way around it : use single-quotes!

Code: Select all

::rename b,'<datem yyyy-mm-dd hh-nn-ss> *'
Then the <date...> isn't parsed in the script, and dealt with only by the rename job, as you are trying to do.
Proud XYplorer Fanatic

pmoore
Posts: 28
Joined: 27 May 2008 13:50

Re: Temporarily changing configuration

Post by pmoore »

jacky wrote:Of course, there's an easy way around it : use single-quotes!
Ah, thanks! That's what I was getting at when I said "escaping" - I'm new to XYplorer scripting, so I didn't know the syntax and terminology. (It's a pity everything implements its own scripting language - far too much for my ageing brain to remember :) If everything used a general lightweight scriptling language like Lua - http://www.lua.org - that would help me enormously!)

Paul.

Post Reply