CEA - Drives

Features wanted...
sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

You're making the assumption here that I know why you've removed all the code surrounding it and/or what exactly scripting is.

This:

Code: Select all

<!DOCTYPE html>
<html>
    <head>
        <title>Example</title>
    </head>
    <body>

        <?php
            echo "Hi, I'm a PHP script!";
        ?>

    </body>
</html>
is nothing like this:

Code: Select all

#include <iostream>
using namespace std;

int main()
{
    int firstNumber, secondNumber, sumOfTwoNumbers;
    
    cout << "Enter two integers: ";
    cin >> firstNumber >> secondNumber;

    // sum of two numbers in stored in variable sumOfTwoNumbers
    sumOfTwoNumbers = firstNumber + secondNumber;

    // Prints sum 
    cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers;     

    return 0;
}
And I'm not talking about the two pieces of code having two completely different objectives, I'm talking about the syntax used being different. Obviously I'm missing what you're saying, which is why I stated that you are making assumptions I have a clue here! :biggrin:

So... why exactly did you remove all the code surrounding echo "Hi, I'm a PHP script!"; in the first code section? Is that what is meant by scripting? It's a way of reducing the code required to perform actions?

Ok, I found two examples for the same output to make things easier to understand.

This:

Code: Select all

<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'; ?> 
 </body>
</html>
Is completely different from this:

Code: Select all

// Your First C++ Program

#include <iostream>

int main() {
    std::cout << "Hello World!";
    return 0;
}
Same result, different code. My point was that XY scripts resemble C++ more than PHP. Not to mention there was statement made in a forum post about VisualBasic being the scripting code, but that too is different and resembles HTML if I remember correctly.
Last edited by sl23 on 30 Dec 2020 14:55, edited 1 time in total.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CEA - Drives

Post by highend »

Because its surroundings is html and not php itself?
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

So the program doesn't require those surroundings? Or automatically inserts those during use?
So the code I quoted was html using php script? Shit, that's even more confusing! :lol:

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CEA - Drives

Post by highend »

Same result, different code
That is nonsense and I've already said that.

That php displays a string in a web page, the c++ prints text to a command prompt. Two fundamentally different output targets!
So the program
Which program?

Would you please read the links you're posting (before you post them^^)?
https://www.php.net/manual/en/intro-whatis.php

The very first sentence:
and can be embedded into HTML
What do you think the example you posted from that link does?
It embeds php in html^^
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

My apologies for being so dumb!
I don't know the difference between code. I'm not a programmer, I don't know the first thing about it.

Other than Rainmeter and editing some epubs in Sigil, I know very little about coding and it's uses.

Ok, so the links referred to are for different "apps" meaning different situations. Therefore require different code to use the same script, is that correct?

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

Btw, sorry we got off on the wrong foot, probably my fault for misunderstanding your intent. You've been a great help, thank you for your time.

eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: CEA - Drives

Post by eil »

sl23 all these talks about comparison to other languages(which you don't know anyway) don't make you closer to creating feature you described in wish. simply read help file, everything needed to make own scripts is there.
Win 7 SP1 x64 100% 1366x768

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

I can understand why you would mistakenly think that, because you don't know my purpose.

My reason for asking what script language is being used is so I can look for other sources of help online. Knowing what language is used will allow me to search for further sources of help, instead of being limited to a single source. The help file is not a holy grail of scripting that everyone seems to think it is. It doesn't explain how to use the script. It doesn't explain in layman's terms why I can't get scripts to do what I want.

Ok fair enough, I haven't read the whole thing. But this is my point. It is a huge resource, with holes. But when you are new to it, you don't know where the holes are.

There isn't a way to find what you want. I've searched, used the index, and checked the contents, yet remain in the dark about how to use the scripts. I mean it doesn't explain point by point how to add an icon, where that icon script can and can't be used. How to name the menu item or toolbar button, how to do other things like name, place icon, use the main menu as submenu's in a pop-up menu.

Maybe, I'm wrong. Maybe it does everything I am looking for. But it's not clear how to find it, which is still a flaw. I mean, go to the help file and look at scripting. It just gives two lists of terms, the first is meaningless to me and looks like it's for more advanced users. The second is a role paragraph of terms, really hard to look through finding what you need and doesn't contains any reference to icon placement that I could find.

The help file is akin to a using a dictionary in order to learn to speak a language. It shows the words needed but it doesn't show how to form those words into sentences. Or at least, it gives certain sentences without explaining fully how to use words.

This isn't meant to slate the help file, just point to a flaw that it needs some refinement for total beginners. I'm sure others would benefit from that too.
Last edited by sl23 on 31 Dec 2020 16:58, edited 1 time in total.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CEA - Drives

Post by highend »

This forum is the second source if there are problems.
XYplorers scripting language is NOT php itself, otherwise it wouldn't have made sense to implement it at all.

What is the primary needed resource for someone who wants to learn scripting: Logic.

Without a brain that can think logically you won't learn any programming language at all.

90% of the time is thinking about a problem and 10% is implementing a solution.

If you have specific questions for a specific problem you can't solve yourself, ask them.
Show a real world example of what was the expected output and what you got instead.

No code, no help (at least not from me).
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

Ok I understand and appreciate your point of view.
I just prefer to learn myself. I wasn't trying to dig at the issues in the help file. It is an amazing resource, but does need much more input to make things clear for beginners. That from my point of view as a beginner.

How to give example of this?
I suppose the code for what I was trying to achieve for creating a menu button for the complete main menu. I found the popupmainmenu but I don't want the sub entries to be a separate pop-up. Why aren't they just nested like the rest of the menu. Is that possible? I tried using the pop-up menu option for "File" and "edit" etc but it just shows the code as the name and opens two separate pop-ups. No explanation of what each section of the code actually does.

What do I mean by this? I can't find anything in the help file about what each section is for. It is mentioned in the pop-up sections but doesn't give examples that are clear. It goes from example to code but the come doesn't match the example. It's not clear how to translate the example into code.

Each section in a line from pop-up menu has a comma after it to denote a new section for a new suppose. I'm on my phone at the moment so it's hard to give full examples of code.

But let's just say to me, this is an example of how it should look:
Name, icon, menu, position, etc.

But transposing this template into the examples given just isn't always possible to understand. I know to you it makes perfect sense, but it just doesn't to me! I read and reread those sections on pop-up menus but can't find anything to sort the issues out I'm having. I spent many hours yesterday trying to sort it with many variations and changes but nothing works.

Sorry I can't add any code yet. Soon as I'm able, I'll put it into terms you can see.

Thanks for your reply though.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CEA - Drives

Post by highend »

viewtopic.php?p=91198#p91198

You can't show the full menu without producing new menu popups after clicking on the first level items.
I tried using the pop-up menu option for "File" and "edit" etc but it just shows the code as the name and opens two separate pop-ups.
Are both these lines unindented?

If that's the case you didn't read the section about "Multi-line Scripts and Multi-Scripts"...

For the rest I'll wait for the code...
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

Ok, I can't remember what order I made all this, but I have two separate copies of XY to keep one working in case the other dies!
Each has certain buttons to test these functions for creating Menus.

First, this was copied from the Help file and changed to try to recreate the entire MainMenu structure:

Code: Select all

text popupnested("File| #100| Sub|  Sub2|  Sub2|Edit");
Obviously this didn't get far, and I realise it's not the best method for large menus, it was just a trial to get #100 shown as a sub menu rather than having to click it to open a new menu. Note the indent doesn't create this as a sub menu.

Another attempt ended up like this:

Code: Select all

popupmenu("#600|#604|-|#800|-|#640|#641|#642");
popupmainmenu "file";
popupmainmenu "edit";
popupmainmenu "view";
I tried indenting as you suggested, but it made each open one after the other when clicking the Toolbar Button it was used in.

An attempt to use a mult-line version of the first to recreate the MainMenu was also a failure:

Code: Select all

$menu = <<<MENU
               File;;:file;
                 Sub;;;4
                  #100
                   Sub2;;*.ini
                   Sub2
                   Sub2;;;2
                 popupmainmenu "file";
               Top;;<xy>
             MENU;
       text popupnested($menu);
But... that indent on the #100 line made it work as a sub menu, so thanks for that tip.

As for reading the Multi-line section of Help, no, I didn't even know it existed or think about that tbh! :oops:

I have tried many variations of each of these and many others that were deleted as these seem to work best.

Also, I would like to know if and where the Help file explains about the specific sections of a line and how to use it.
For example, as discussed, the semi-colon's used in this example: Sub2;;;2 are placeholders or empty sections, (sorry, I don't know the correct terminology.) So, to divide it up and number each would look like this: 1;2;3;4

What does each number represent? For example:
1 = Name or title of menu function to be used.
2 = Path or internal function of menu item, such as #100.
3 = Path to icon file.
4 = God only knows what else! :whistle:

Is this sort of structure common throughout, wherever it would be used within any script location?

In the example of: Sub2;;;2, what does the 2 represent?


Thanks for your help. :tup:

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CEA - Drives

Post by highend »

I'm not getting what you're asking with the examples in the first part of your post.

You want XYs full menu with all submenus but want to avoid the 2nd level popup (as a completely new menu)?
As I already said: That's not possible.

So what are you trying to achieve here?
Also, I would like to know if and where the Help file explains about the specific sections of a line and how to use it.
I'll gave you the answer to this already...
Last part of: viewtopic.php?p=183993#p183993
and repeated in: viewtopic.php?p=183995#p183995

You are using script commands without reading their belonging entry in the help file.

Otherwise, if you would have read the entry for popupmenu() you would know that ";" is the separator between
caption, data, icon and state
and that a state of 2 shows a checkmark for such an entry...
One of my scripts helped you out? Please donate via Paypal

sl23
Posts: 223
Joined: 03 Feb 2015 23:34

Re: CEA - Drives

Post by sl23 »

I did read it but it makes no sense given the examples in use. That was my point. I can't make out what the caption is!
Example, from Help:
Caption: Menu caption. Use "-" (no quotes) to specify a menu separator.
code example:
popupmenu(itemlist, [x=-1], [y=-1], [start=1], [count=-1], [flags=0], [sep_itemlist="|"], [sep_item=";"], [on_cancel=""])
Ok, so according to your comment and the Help file, anything before the first comma is Caption, yes?

Yet when I rename this to MyName I get an error: Dubious syntax: MyName
So according to your explanations and the Help file I am doing nothing wrong??? Yet this simply does not match up!

You also state: "uses a caption|data|icon|state syntax." That's 4 terms, yet there are 9 in the above example!!! Which ones are the 4 terms you mentioned relating to in the example?

This is exactly what I am saying, Help files are not good ways to learn coding.
I appreciate Developers aren't there to teach us, but this was my reason for asking what language this scripting is. So, I can find more help around the internet.

I don't wish to be spoon fed and don't wish to keep bothering people, specifically you it seems, here. Yet I do wish to learn how to use Script, even if just the basics. Which, I imagine, once understood, remove many of the problems I am having.

Sooo... back on track. What did I want to achieve? I have explained this, maybe not too well...?

Basically I want to remove the MainMenu bar and have a single Toolbar button that replaces it. The only problem with the current popupmainmenu; is that it shows a popup without sub-menus. Clicking on one of these opens a second popup with the content of the selection you made. ie, click "Edit" and a second popup appears in place of the first with all the "Edit" menu options.

I want to have the MainMenu with Sub-Menu's. Why? Because there are so many menu options that it is difficult to find what you want. If you don't know where to look for, let's say "Tools/Customise List/Full Row Select" then currently you have to click whhere you think it might be, for example, "View" menu, and when you can't see it there, you have to reclick to open the MainMenu Button, rather than simply hover the mouse between menu's as you would if you used the MainMenuBar. I just don't get why it has been done this way, it makes no sense!

In order to get around this, I am going to manually recreate all the functions into a button as a sub menu system. I have found the "QuickCustomMenuBuilder" script, but I'm unsure how this works and how you undo it if you changed your mind about something. Hence why I asked before, elsewhere, about where scripts are stored and how to remove them. How do scripts become a part of XY? It seems they are generally only executed on demand as Buttons, Menus, etc. But with the "QuickCustomMenuBuilder" script this becomes an integral part of the settings to permanently change how the program works. How is it undone?

I attempted to use it, then couldn't understand why in one instance Catalogues appeared in the Menu but the other it had gone! Maybe I don't want all these features like Paper folders, catalogues etc in the menus now, but later I may rethink this and want them back.

Sorry for the long posts and changes of topic, it's sort of interrelated so hopefully you wouldn't mind shedding some light on these issues please...

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: CEA - Drives

Post by highend »

No, the thing before the first comma is the argument itemlist
and that is (or better can be) divided into caption, data, icon and state, while being separated by the argument sep_item

The fourth example given for that command shows that.
text popupmenu("Megan;Hello Megan!;*.png;1|Betty;Hello Betty!;*.jpg|Checked;;;2");
; divides them and the default sep_itemlist | separates menu entries from another.

These are functionally identical, but only with different separators. The second entry is with positional arguments instead.

Code: Select all

    $menu = <<<MENU
Megan|Hello Megan!|*.png|1
Betty|Hello Betty!|*.jpg
Checked|||2
    MENU;
    $sel = popupmenu($menu, , , , , , <crlf>, "|");
    $sel = popupmenu($menu, 6:=<crlf>, 7:="|");
What I would do to get access to the main menu when hidden...
Send a shortcut to toggle it.
A button with a script command: sendkeys "^+%{F12}";
but I'm unsure how this works and how you undo it if you changed your mind about something
That depends on the script. Look at the end of it.

Code: Select all

   writefile("<xyscripts>\z_SF_QuickCustomMenuBuilder.txt", "$re2", "a");
   writefile("<xyscripts>\z_SF_QuickCustomMenuBuilder_LATEST.xys", "$re2");
It's storing two files in your XYplorers (data) script folder and you put e.g. this
load "<xyscripts>\z_SF_QuickCustomMenuBuilder_LATEST.xys";
on a button, catalog entry, ... to load the script that was created by QuickCustomMenuBuilder

And to remove everything again, remove the files that were created...

It was updated 5 years ago so I wouldn't wonder if it doesn't work as expected (or: at all) anymore.
One of my scripts helped you out? Please donate via Paypal

Post Reply