Page 1 of 2
Validating scripting command
Posted: 16 Jan 2008 12:15
by ugus
Could you add a special kind of <#Command> used only for scripting
that easily eliminates this kind of disaster...
by validating a folder.
- Go to the Temporary Internet Files folder
- Select All
- Delete (Skip Locked)
!!! However, here comes a serious WARNING!!! Scripting is an
advanced hardcore feature, and the above example is a good one to
show you why. If the Temp folder cannot be shown (e.g., because
you opted to not show hidden items), then the script will happily
go on with the next commands (select all and delete) IN THE FOLDER
YOU END UP IN *instead* of the Temp folder!
Example
::#559::<#CommandValidateFolderCommand>#250::#171
Description:
Execute the next parts of the command (#250::#171)only
if the ::#559 [Go to the Temporary Internet Files folder] was successful
(eg the Temporary Internet Files folder was displayed/validated)
The command should look for the previous command and only allow execution of the next
scripting command if the previous command was a "folder command" or a "Go to UDC" command.
There are maybe need for more types of "validate" commands but this could be a start?
I realize that this maybe is complicated...
Posted: 16 Jan 2008 17:39
by j_c_hallgren
Maybe this could be handled by a plain true/false or good/bad result code from each command that could be tested, if desired, by a new command which would, if prior result was false, stop the script execution at that point with a pop-up (as one gets with script errors on HTML pages in IE) and ask user go/quit? Something like #TEST or similar...
If one wanted to ignore any/all errors, you'd just not have any #TEST...however, if you wanted to test each/every one, maybe if that was the very first command, then it'd be a shortcut to that functionality.
Re: Validating scripting command
Posted: 16 Jan 2008 19:17
by jacky
ugus wrote:::#559::<#CommandValidateFolderCommand>#250::#171
Sounds a bit complicated/too much to me; but I think there should be some kind of, even minimal, error support. As in, if a command failed (eg. path/file not found, etc), then the user should probably be informed & asked whether or not to continue.
And for hardcore, fearless users, much like there's a "step" there could be a "nowarning" or something like that, to have the script go all the way regardless of any errors that may occur...
Posted: 16 Jan 2008 19:22
by ugus
j_c_hallgren wrote:Maybe this could be handled by a plain true/false or good/bad result code from each command that could be tested, if desired, by a new command which would, if prior result was false, stop the script execution at that point with a pop-up (as one gets with script errors on HTML pages in IE) and ask user go/quit? Something like #TEST or similar...
Yes, this sounds like a reasonable idea. It should be easy to use but still powerful. Let see what Don has for ideas for this

Posted: 16 Jan 2008 20:04
by admin
ugus wrote:j_c_hallgren wrote:Maybe this could be handled by a plain true/false or good/bad result code from each command that could be tested, if desired, by a new command which would, if prior result was false, stop the script execution at that point with a pop-up (as one gets with script errors on HTML pages in IE) and ask user go/quit? Something like #TEST or similar...
Yes, this sounds like a reasonable idea. It should be easy to use but still powerful. Let see what Don has for ideas for this

Scripting is not for cowards!
While your (meaning all folks in this thread) ideas seem logic, they are not suitable in the real world of programming. While some functions have a clear good/bad result, most others have not (countless error codes exist, errors are raised and handled, many are meaningless/irrelevant for the user, other have more meaning up to a LOT of meaning...

). If a function failed or not is dependent on what the user
intended to do, and that's a
pragmatic notion far beyond the realm of thinking machines...
IOW: maybe you better do your radical deletion jobs manually, or at least
stepwise...

(note that I provided a way to turn stepping off and on very quickly! So you can step only in the dangerous parts of a script.
Other idea: I could add a "stop" (or "step") flag right into the script commands, like:
::#1234::#2345 stop::#3456
This would stop
before function #2345 is executed, and prompt the user whether to go on or abort.
Posted: 16 Jan 2008 20:13
by j_c_hallgren
Ok...

I kinda figured we were making it too simple...hey, it was worth a shot! So...instead of STOP, I'd suggest PAUSE or DELAY instead, as stop to me implies more of an ending where pause is just that...and maybe the Pause could have an optional parm with nbr of seconds max to wait before it goes ahead by itself? My CoreFTP does this, so I have chance to change/cancel each file transfer or let it go on without keyboard/mouse interaction.
Posted: 16 Jan 2008 20:23
by ugus
admin wrote:
Other idea: I could add a "stop" (or "step") flag right into the script commands, like:
::#1234::#2345 stop::#3456
This would stop before function #2345 is executed, and prompt the user whether to go on or abort.
That would be a nice idea. Then you have a possibility to add some "safety" checks if your feel unsafe
Some more "system functions" could be added as well like the Sleep function The Qwerty mentioned in another thread, in order to make the script more responsive.
Posted: 16 Jan 2008 20:47
by admin
ugus wrote:admin wrote:
Other idea: I could add a "stop" (or "step") flag right into the script commands, like:
::#1234::#2345 stop::#3456
This would stop before function #2345 is executed, and prompt the user whether to go on or abort.
That would be a nice idea. Then you have a possibility to add some "safety" checks if your feel unsafe
Some more "system functions" could be added as well like the Sleep function The Qwerty mentioned in another thread, in order to make the script more responsive.
But I will only add this when I'm 100% sure about the general scripting syntax. I mean
real scripting, not calling by numbers... currently I'm about 90% sure...
Posted: 16 Jan 2008 20:48
by jacky
admin wrote:While your (meaning all folks in this thread) ideas seem logic, they are not suitable in the real world of programming. While some functions have a clear good/bad result, most others have not (countless error codes exist, errors are raised and handled, many are meaningless/irrelevant for the user, other have more meaning up to a LOT of meaning...

). If a function failed or not is dependent on what the user
intended to do, and that's a
pragmatic notion far beyond the realm of thinking machines...
I'm not sure that's entirely true. I mean, for a Go To command, if the path doesn't exists, that's a failure to me, it couldn't be any other way.
If the application to use for an Open (With) isn't found, it's pretty much the same.
Which is probably why, by the way, those do already have XY to show an error message. So, while in scripting, turning the "Ok" button to a "Ok/Cancel" combo might not sound like such a "bad idea" I would say.
Now talking about a Rename command that didn't actually rename any items, that maybe normal yes. But not renaming a file cause the actual system call to rename the file failed, that's an error. Always. (I would think.)
admin wrote:Other idea: I could add a "stop" (or "step") flag right into the script commands, like:
::#1234::#2345 stop::#3456
This would stop before function #2345 is executed, and prompt the user whether to go on or abort.
Sounds quite weird to me. I would have assume it would stopped
after the command #2345, given how we read first #2345, and then "stop"...

Posted: 16 Jan 2008 20:54
by admin
jacky wrote:admin wrote:Other idea: I could add a "stop" (or "step") flag right into the script commands, like:
::#1234::#2345 stop::#3456
This would stop before function #2345 is executed, and prompt the user whether to go on or abort.
Sounds quite weird to me. I would have assume it would stopped
after the command #2345, given how we read first #2345, and then "stop"...

It's only weird for those who don't know the rules of XY scripting syntax. Which are all but me!
Patience...
I'm currently experiencing a kind of overflow situation here... plus I caught a cold and am coughing all the time into my keyboard... so my magical powers are slightly dimished... patience...
Posted: 16 Jan 2008 21:03
by serendipity
admin wrote:... plus I caught a cold and am coughing all the time into my keyboard... so my magical powers are slightly dimished... patience...
Gesundheit!
Posted: 16 Jan 2008 21:05
by admin
serendipity wrote:admin wrote:... plus I caught a cold and am coughing all the time into my keyboard... so my magical powers are slightly dimished... patience...
Gesundheit!
Danke!
Posted: 16 Jan 2008 21:20
by ugus
admin wrote:But I will only add this when I'm 100% sure about the general scripting syntax. I mean real scripting, not calling by numbers... currently I'm about 90% sure...
I realize that implementing full-fledged scripting is a really complex task and it will take some time to complete.
It is however already now as in it's current state, a real
brilliant start! - so take some rest and recover your batteries...

Posted: 16 Jan 2008 21:33
by j_c_hallgren
ugus wrote:I realize that implementing full-fledged scripting is a really complex task and it will take some time to complete.
It is however already now as in it's current state, a real
brilliant start! - so take some rest and recover your batteries...

I fully agree with these sentiments! And I think that by our interaction here, as we've done today, helps make the result even that much better, if I do say so myself...Don is brilliant, but sometimes even geniuses need a push in another direction that they had'nt considered.
Posted: 27 Jan 2008 09:49
by admin
jacky wrote:admin wrote:Other idea: I could add a "stop" (or "step") flag right into the script commands, like:
::#1234::#2345 stop::#3456
This would stop before function #2345 is executed, and prompt the user whether to go on or abort.
Sounds quite weird to me. I would have assume it would stopped
after the command #2345, given how we read first #2345, and then "stop"...

Found a better way:
Code: Select all
+ Scripting: Now you can force stepping (prompting) per command.
Simply prefix a ? to the command. For example, the following
script will goto Desktop (and remove any Visual Filters), and then
prompt you before executing the sortby command:
::goto Desktop|::?sortby m, d
Works as well with ID-based scripts:
::?#1016::?#101
Upload soon...