Minor scripting related wishes (a generic thread)

Features wanted...
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Post by TheQwerty »

admin wrote:
TheQwerty wrote:Any chance we could get a way to have global variables that can be used/set in Sub() and Load() commands?

I've got some scripts in mind but without such functionality they can't happen.
Somebody had to pop this question sooner or later, and the answer is: Yes! :D -- But not now. :twisted: (By coincidence this afternoon I thought about it and found a cool way to implement it, resp. saw how easy it is to implement.)
Oh sure, in one breath say "not now" and then in the next say that it's incredibly easy to do. :shock:

That's just going to make me have hope with each new beta post that today will be the day, only to have to go back to waiting patiently. :lol:

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

Post by admin »

TheQwerty wrote:
admin wrote:
TheQwerty wrote:Any chance we could get a way to have global variables that can be used/set in Sub() and Load() commands?

I've got some scripts in mind but without such functionality they can't happen.
Somebody had to pop this question sooner or later, and the answer is: Yes! :D -- But not now. :twisted: (By coincidence this afternoon I thought about it and found a cool way to implement it, resp. saw how easy it is to implement.)
Oh sure, in one breath say "not now" and then in the next say that it's incredibly easy to do. :shock:

That's just going to make me have hope with each new beta post that today will be the day, only to have to go back to waiting patiently. :lol:
Hehe. You know, even an easy-to-do thing can turn into a can of worms -- I don't need such a can right now, I'm happy without it. First v7.0 must come out!

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

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

It would be nice if inputFile were not so melodramatic when given a non-existent path.

Perhaps instead of throwing a hissy fit and exiting the script, plus lying ("Script terminated by user"), it could default to My Documents like inputFolder?


Or perhaps a new command:
checkPath(OutputVar, [Path])
Sets, outputvar to -1 if path is not found/valid.
...., 0 if path exists but identity cannot be determined.
...., 1 if path exists and is a directory.
...., 2 if path exists and is a file.

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

Re: Minor scripting related wishes (a generic thread)

Post by admin »

TheQwerty wrote:It would be nice if inputFile were not so melodramatic when given a non-existent path.

Perhaps instead of throwing a hissy fit and exiting the script, plus lying ("Script terminated by user"), it could default to My Documents like inputFolder?


Or perhaps a new command:
checkPath(OutputVar, [Path])
Sets, outputvar to -1 if path is not found/valid.
...., 0 if path exists but identity cannot be determined.
...., 1 if path exists and is a directory.
...., 2 if path exists and is a file.
checkPath... this kind of stuff will come when I add conditions.

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

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

admin wrote:checkPath... this kind of stuff will come when I add conditions.
I had thought as much. I'm glad you didn't make me wait till scripting 2.0 for that default action, but I'm also conflicted about that warning/error dialog.

On the one hand:
It's inconsistent with inputFolder which doesn't notify you that the supplied path cannot be found and just uses My Documents.
It's annoying to have another step/dialog there.

On the other hand:
It's not as disorienting to the user when they arrive at the unexpected folder.
It also may prevent confusion if the user intended to go to a folder which looks the same as their My Documents.

I'm just thinking in type with that. I guess it makes most sense to leave it as is and when we get conditionals we'll be able to program around that dialog anyhow.

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

Re: Minor scripting related wishes (a generic thread)

Post by admin »

TheQwerty wrote:
admin wrote:checkPath... this kind of stuff will come when I add conditions.
I had thought as much. I'm glad you didn't make me wait till scripting 2.0 for that default action, but I'm also conflicted about that warning/error dialog.

On the one hand:
It's inconsistent with inputFolder which doesn't notify you that the supplied path cannot be found and just uses My Documents.
It's annoying to have another step/dialog there.

On the other hand:
It's not as disorienting to the user when they arrive at the unexpected folder.
It also may prevent confusion if the user intended to go to a folder which looks the same as their My Documents.

I'm just thinking in type with that. I guess it makes most sense to leave it as is and when we get conditionals we'll be able to program around that dialog anyhow.
The best would be you pass a path that actually exists. :wink:

Oh, I just saw if you don't pass a path at all it defaults to app path! So maybe it should also take app path in case of non-existent path!?

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

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

admin wrote:The best would be you pass a path that actually exists. :wink:
I'd do that... if I only had a way of determining that the path actually exists before placing my call. Maybe some type of test that would allow me to do different things based on various logic and conditions. :wink:
admin wrote:Oh, I just saw if you don't pass a path at all it defaults to app path! So maybe it should also take app path in case of non-existent path!?
Hmmm.. I think both inputFile and inputFolder should have the same behavior if possible, and they should go to the same path whether the argument is not supplied or not found.

But I'm not sure where that place should be; <xypath> might make the most sense here.

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

Re: Minor scripting related wishes (a generic thread)

Post by admin »

TheQwerty wrote:
admin wrote:The best would be you pass a path that actually exists. :wink:
I'd do that... if I only had a way of determining that the path actually exists before placing my call. Maybe some type of test that would allow me to do different things based on various logic and conditions. :wink:
admin wrote:Oh, I just saw if you don't pass a path at all it defaults to app path! So maybe it should also take app path in case of non-existent path!?
Hmmm.. I think both inputFile and inputFolder should have the same behavior if possible, and they should go to the same path whether the argument is not supplied or not found.

But I'm not sure where that place should be; <xypath> might make the most sense here.
FYI, the behavior of inputFolder (default to MyDocs on non-exist and on empty) is built into the Shell Browse For Folder dialog (which I just call from XY).

I think for a portable app <xypath> is the better default choice.

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

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

admin wrote:FYI, the behavior of inputFolder (default to MyDocs on non-exist and on empty) is built into the Shell Browse For Folder dialog (which I just call from XY).
Right, but can't you give it a starting path? Or does the Win32API only allow you to define the root? (Quite frankly I hate that dialog just because you can't type a path in it.)
admin wrote:I think for a portable app <xypath> is the better default choice.
I agree.

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

Re: Minor scripting related wishes (a generic thread)

Post by admin »

TheQwerty wrote:
admin wrote:FYI, the behavior of inputFolder (default to MyDocs on non-exist and on empty) is built into the Shell Browse For Folder dialog (which I just call from XY).
Right, but can't you give it a starting path? Or does the Win32API only allow you to define the root? (Quite frankly I hate that dialog just because you can't type a path in it.)
admin wrote:I think for a portable app <xypath> is the better default choice.
I agree.
Sure I can give it an initial path. Only if that path does not exist it defaults to MyDocs.

Anyway, I just changed both commands:

Code: Select all

    * Scripting commands inputfile and inputfolder modified:
      - Now, when the path argument is left empty the initial path in 
        the select file/folder dialog defaults to <xypath>.
      - Now, when the path argument contains a non-existent path, the 
        initial path in the select file/folder dialog defaults to 
        <xypath>. You are prompted whether to continue the script.

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

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

admin wrote:Anyway, I just changed both commands:

Code: Select all

    * Scripting commands inputfile and inputfolder modified:
      - Now, when the path argument is left empty the initial path in 
        the select file/folder dialog defaults to <xypath>.
      - Now, when the path argument contains a non-existent path, the 
        initial path in the select file/folder dialog defaults to 
        <xypath>. You are prompted whether to continue the script.
Sounds good to me.

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

Re: Minor scripting related wishes (a generic thread)

Post by jacky »

hmm.. I don't know, I'm not sure about this one : "You passed a non-existent path to scripting command inputfile"
Because this message kinda implies the user did something, liked passed a "wrong" thing to a scripting command, and that's not really the usual way to phrase this, is it? I would think something more like "A non-existent path was used by scripting command inputfile as default location" would fit better, because the user might not have done anything, in fact possibly not even written the script...

Plus, seems more consistent with other messages such as "Script terminated by user" or "The current script appears to be recursive" I feel.
</pita>
Proud XYplorer Fanatic

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

Re: Minor scripting related wishes (a generic thread)

Post by admin »

jacky wrote:hmm.. I don't know, I'm not sure about this one : "You passed a non-existent path to scripting command inputfile"
Because this message kinda implies the user did something, liked passed a "wrong" thing to a scripting command, and that's not really the usual way to phrase this, is it? I would think something more like "A non-existent path was used by scripting command inputfile as default location" would fit better, because the user might not have done anything, in fact possibly not even written the script...

Plus, seems more consistent with other messages such as "Script terminated by user" or "The current script appears to be recursive" I feel.
</pita>
There are a numner of "You..." messages in scripting:
"You must define a variable name for the scripting command...
"You passed a non-existent path to the scripting command...
"You must define a location for the scripting command...
"You must define a script file."

But okay, the others are real syntax errors... I see your point.

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

Re: Minor scripting related wishes (a generic thread)

Post by TheQwerty »

TheQwerty wrote:Quite frankly I hate that dialog just because you can't type a path in it.
Can you please do something about this already?

Please give us an argument to add the BIF_EDIT flag to your BROWSEINFO value, or just start using BIF_USENEWUI instead of BIF_NEWDIALOGSTYLE!! I can't take this painful folder selection for keyboard users anymore! :cry:

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

Re: Minor scripting related wishes (a generic thread)

Post by admin »

TheQwerty wrote:
TheQwerty wrote:Quite frankly I hate that dialog just because you can't type a path in it.
Can you please do something about this already?

Please give us an argument to add the BIF_EDIT flag to your BROWSEINFO value, or just start using BIF_USENEWUI instead of BIF_NEWDIALOGSTYLE!! I can't take this painful folder selection for keyboard users anymore! :cry:
:? Take input() if you want to type...

Post Reply