DO12 - Switching from Standard function to Script function

When there is standard button code and the button is also of type "Standard Function", switching the button to be of type "Script Function" will keep and execute the top of the "Standard Function" content, even though it is not visible any more. This is at least for Rename-Hack button scripts. Not a major issue, but could be something you like to know about.

Use this code to test. Set it to "Standard Function" first (then paste code), then switch to "Script Function".
First "Rename.." line will not be visible, but will throw exception when running the button.

[code]Rename FROM="." PATTERN="{sourcepath$}" TO="cycle_root|C:|D:|D:\tmp"
@script VBScript
Option Explicit

Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName)
strNewName = ""
End Function
[/code]

Have a look in the Modifiers tab for where the stuff before @script has ended up.

Aha, I see, it moved over there. From your words I read that you think it's ok like it is. Ok, I can handle this. o)

I'm not sure if it's on purpose (it's meant for moving the @modifiers over to that tab) but there isn't really a way it could be "right" since the command wouldn't work wherever it was moved to (and you don't want to lose it entirely as you might change type without knowing what will happen, and want to change back without losing anything). So what happens seems as good as anything else.

The main thing is changing to Script Function and then back should net you the same as what you started with.

Yeah, as mentioned, I think this is something that can be dealt with in case it happens.
I don't know how many rename scripts on buttons are out there, I never did one at least. o)
I initially thought, whatever get's moved over to the modifiers section and does not start with "@" could be commented out with "//" or "'" automatically to not get in the way, but not sure if this is worth it, since toggling things back would yield a modified button code, which also can be confusing, especially in case somebody flips through the button types per accident. You could of course try to remove prefixed lines again, but then.. probably already too much hassle with questionable benefit. o)