Extension - loading options after some script processing

Advertisement

user564758
Joined:
Posts:
7

Extension - loading options after some script processing

I do not think there is a way to have options load a variable default from a text file (please let me know if i am wrong) so i was thinking the next best thing would be to do some script processing before the dialogue box opens. Is this possible?

Something like this.

# @name test
# @command cmd /c start example.exe www.WinSCPextension "%username%" "%variable%"
# @side Local
# @flag
# @description test
#
my script to get  variable from a text file.
#
# @option username -run textbox "&Username" "!U"
# @option variable -run textbox "&variable" "%variable%"
#
The rest of my script.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,624
Location:
Prague, Czechia

Re: Extension - loading options after some script processing

I'm considering something like that too.

Meanwhile, you can load the defaults after the dialog, if the user does not specify any custom value (or keeps a default magic value like "default")

Reply with quote

user564758
Joined:
Posts:
7

Thanks for the reply.

Using 5.15.1 Winscp portable with automatic ini.

Maybe you can help me understand something else that was an acceptable compromise.

I have an extension option using
-config -run
and was using an older
winscp.ini
. The extension had some defaults set and when i used the command with the defaults or by modifying the settings in the command it was saved to my config values automatically. When i used the command again the last used config values were remembered and used automatically overriding the command defaults.

After i generated a new ini file with winscp 5.15.1 this stopped working. The defaults from the extension always stay the same unless i save the config settings manually. then the config options override the defaults but never automatically update based on the last used setting.

Was this a setting i enabled or was it simply the history of the command being used? I would like this to be working as it was again but don't understand how it was working in like this in the first place.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
31,624
Location:
Prague, Czechia

Can you please give more details on how you were/are using the winscp.ini? I'm not sure I follow.

Reply with quote

user564758
Joined:
Posts:
7

I use WinSCP portable with automatic ini setting.

The ini template is basically a newly generated one.

I have an extension command with this as part of it.

# @option mpget -config -run textbox "Mirror Pget (parts to split each file into when downloading)" "5"

When i use the command in WinSCP, it loads the extension scripted defaults, it shows the defaults in the config, but the config options only take effect if manually save them. Until i save them the scripted defaults will load.

Once i have saved them they are static until i manually edit them again.

Before, WinSCP seems to be automatically saving the command config settings based on my last used entry into the text box.

I don't understand how or why it was doing this because i cannot seem to replicate it. (maybe it was accidentally using the registry?)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
31,624
Location:
Prague, Czechia

The both -run and -config are used, the values you specify "on run" are not persisted. If you want to persist them, remove the -config.

Reply with quote

Advertisement

You can post new topics in this forum