Global hot key for renaming folder in the background?

I´d like to have a code, that can rename a certain folder (actually two, since the second hotkey would rename it back to the standard name), but it should be a global hotkey, so it would work with Opus staying in the background, with no focus or rename dialog showing up (no task change needed).

The reason is following: when browsing, i use a special user hot script for a site, which can´t be toggled in the ususal way, because it´s a grease monkey script running on Opera. The available "toggle userscript" button for Opera can´t handle that type of user scripts & changing the sites preferences would be too much hassle, so this seems more elegant:

Renaming the folder would have the simple effect of toggling the script off, because the path in the sites preferences wouldn´t match any longer, resulting in a "toggled off" user script.

Sorry, i solved this in a different way: moving the user script file back & forth between two locations has the same practical effect, only no rename window is coming up. But it would be interesting anyway, how to perform such a task (the renaming) in the background.

The rename command can be given a filepath to rename to automate it.

What isn't straightforward is how the command should know which rename to do (old->new or new->old). There are probably a few ways you could do that, maybe using a complex regex or something, but personally I'd just use some VBScript that checked which name existed now and renamed it appropriately.

I just used rename path1 TO path2. But the complex regex thing isn´t necessary, because i use two hotkeys, one for the initial rename, another for renaming it back to the old name. This worked, but Opus had to have the focus (didn´t work with the browser being on top). Otherwise the rename dialog was popping up.

Doing that doesn't pop-up anything for me unless path1 can't be found, in which case an error message appears but still not the rename dialog.

Hmm, i´m not sure, why the dialog showed, but i tried lots of variants, maybe one had an error. I also tested a DOS command, but wasn´t sure, how to set the right initial path. Something like "cd R:\blah\path" to set the path to start from didn´t work. I tried this to avoid error messages in case the path wasn´t found (this happens, when using the wrong command, trying to rename the file when it´s actually already renamed).

Btw, my command was exactly like yours, so this actually works in the background, cool. & yeah, i also saw some "path not found" error messages, after obviously using the wrong command. That´s why i thought about making a single icon floating tool bar to show the toggle status, maybe i try that later. Thanks!