|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 - 3 - 4 | Next > |
|
|
Main menu puzzleHi anyone
SHORT VERSION (immediate problem) Created my first menu, using menu builder and autoscript. Ungrouped to look at scripts. File menu has Exit, divider and Quit (for Mac shift). Script is: --The following menuPick handler was generated by the Menu Builder. on menuPick pWhich switch pWhich case "Exit" --Insert script for Exit menu item here break case "Quit" --Insert script for Quit menu item here break end switch end menuPick After exploration to discover an Exit/Quit script, my script is: on menuPick pWhich switch pWhich case "Exit" on "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK" if it is "OK" then quit end "Exit" break case "Quit" on "Quit" answer "Are you sure you want to quit?" with "Cancel Quit" or "OK" if it is "OK" then quit end "Quit" break end switch end menuPick Error window says error, hint "on". LONG VERSION (working example of newbie problem) First question is what does pWhich mean? Look in Rev Dictionary. Not listed. Look under commands, parameters etc. Look in Scripters Scrapbook. Look in tutorial stacks I've downloaded. Lots of pWhichs in scripts but no explanations. Try a Google search (desperate). Get a bunch of links to Perl programming. OK, forget pWhich for the present, I need an Exit script. Here's an example under quit in Dict: on getMeOuttaHere answer "Are you sure you want to quit?" with "No way" or "OK" if it is "OK" then quit end getMeOuttaHere So, my script should be: on menuPick pWhich switch pWhich case "Exit"--for Win on "Exit" answer "Do you really want to exit?" with "No" or "OK" if it is "OK" then quit end "Exit" break case "Quit" --for Mac on "Quit" answer "Do you really want to to quit?" with "No" or "OK" if it is "OK" then quit end "Quit" break end switch end menuPick But Errors says this script is wrong, and gives the Hint "on". How can it be wrong if it's a script from Docs? Look up case and switch but those are no help either. Look up "on". Don't understand any of the explanation. In any event, if it worked this script would seem to create a dialogue box with two buttons to choose from. OK is handled, but the No button doesn't seem to be. So, it's not actually going to work anyway. So it's not a very helpful example of a script IMHO. Try elsewhere. Look at FirstStack pdf.... ah.. page 15 has a mouseUp script, but maybe I can adapt bits of it. Here goes: on menuPick pWhich switch pWhich case Exit on "Exit" answer "Do you really want to Exit?" with "No" or "OK" if it is "OK" then quit else if it is "No" then pass menuPick --total guess here, could be pass pWhich or pass Exit or? end Exit break case Quit on "Quit" answer "Do you really want to Quit?" with "No" or "OK" if it is "OK" then quit else if it is "No" then pass menuPick end Quit break end switch end menuPick Error: Hint on Good try, but it doesn't pass go. Hmmm I've been at this for about an hour now. But, no pain no gain. Next try. Open the Revolution Scripting Conferences - Menus stack. Hmmm, it doesn't have a main menu. Funny. A tutorial on menus that doesn't have a main menu as an example. Click through. Lots of button menus that use mouseUp handlers, but no main menus that use menuPick. Wait, here is a card with a demo Menu bar stack for a Mac menu. Great, it will have menuPick scripts I can look at. Open this substack, switch to Edit tool, ungroup the menu, select File, open Script editor..... crikey..... this is an unscripted menu with no scripts at all. Last try. Open the Managing menus stack. Uh oh..... it's about building on-the-fly menus. I just want a plain vanilla static menu. Maybe I can understand this tutorial about a year from now. Private thoughts I'll make public. I've now spent two hours trying to do the right thing by giving Rev a go, experimenting, hunting thru the Docs, looking at other people's stacks to see how they do it, and supposing that somehow this would lead me to an understanding of Transcript. The only thing I've discovered is that the very popular "pWhich" seems to have failed to make it into the Dictionary. I wonder why it seems so impossible for Rev to produce a tiny template stack with a working main menu, and working scripts that are fully commented. By fully, I mean with plain english (not "english-like") definitions and explanations. This is the typical script example I see: case "Exit" --Insert script for Exit menu item here --or the variation, Do stuff here... break This is fine for the experienced, but not helpful comments for newbies who don't have a clue what to insert, or how to find the cause of an error. I'm sure someone can point me at a working example. Pity it's been so hard to find a Rev one. Ken |
|
|
Re: Main menu puzzleWell, as Charley Brown would say, Good grief. I had to laugh. I thought I'd spare you all this by setting up a child forum. If there had been some instructions about how a child forum works it might have worked. No instructions, so it didn't. Situation normal I guess.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Main menu puzzleThanks Alex
I'll copy and paste that into my Rev tips file, so I remember it's a parameter name. I still do not understand how pWhich can tell that I've picked a menu item like Quit (or Open, or anything else). So, how does a pWhich identify what's been picked? (you see the dimensions of my ignorance). Comment for Rev support: I have to wonder why I had to go to a user forum and rely on helpful others to provide this information. If it's a convention (ie something "everyone" knows, and follows) one can only wonder why it doesn't seem to appear in the Rev dictionary. I did a fairly thorough search, and I supposed it might be a parameter (among other things), so I put in parameter as a search term and scrolled thru the list of parameters, and failed to find it. If it is such a common convention, how come? Answer: Everybody knows this... Reply: No, they don't.... but if you want Rev to be scripting for the rest of us, you'll have to make it a bit easier to find it out. Thanks Alex. As you can see, I have another agenda going here but I appreciate all the help I can get. I need lots. regards Ken |
|
|
Re: Main menu puzzleKay
Thanks, but I don't get it: <it could easily be pTheMenuSelectionImade, in the documents I think they use theMenuItem (I typed 'on menuPick' into Preview's search field and found the info in half an eye blink> Preview's search field? I was in Rev, searching Rev docs and assorted third part stacks. You were in Preview? So you had a pdf file open? Which one? As for pTheMenuSelectionImade.....? I saw nothing remotely like this in any of the sample scripts I could find. I'm happy it worked for you. Where can I find this script? Regards Ken |
|
|
Re: Main menu puzzleAlex
You say: on menuPick pWhich switch pWhich case "Exit" answer "Are you sure you want to exit?" with "Yes" or "OK" if it is "OK" then quit break case "Quit" answer .... if it is "OK" then ... break end switch end menuPick I'm sure this would work. Problem is, I don't understand why. This isn't your problem, you've given me a solution which is more than I could expect, thank you. My problem with this script is: it produces two choices, Yes or No. Buttons I assume. OK is handled. Yes does not appear to be handled by anything. But, if it works it must be handled somehow. But there is nothing in this script (that I can see) to cater for a choice of Yes. It's a dilemma. You say this works. I believe you (on faith, not having tried it). But I can't see how it can possibly work, because there is nothing that appears to handle a choice of Yes. Isn't programming supposed to follow the script? Or... is there some mystical dimension to these scripts... some sort of default skypilot script or command that takes care of these messy details? If so, does one have to enter an order for the secret to be revealed? Regards ken |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Main menu puzzle, KlausHi Klaus, and all others
This is getting out of control., I'm overwhelmed by the replies and can't keep up, so some may be delayed. And in Australia and it's past midnight. Also the forum seems to be unable to update in real time, I'm getting a blizzard of emails saying my replies haven't been sent because the mailbox is full, so there's a delay. To answer Klaus. I know Rev is event driven. Problem is it seems no one can explain the driving. I get advice: do this (trust me, it will work). Do that: (trust me, this will work (better)). I do trust you, and that the suggested solutions will work. What I don't get is a clear explanation of how and why they will work (in plain english, that, sadly, is all I understand). If I am to use Rev, I need to know what I'm doing, and how/why it will work. Otherwise there is no point in even trying. To summarise, most suggestions about my menu problem tell me to change the script. As I based my various versions of the script on what Rev said (as best I could understand), but if you all tell me this was wrong, and I need to change it, it doesn't give me a lot of confidence in Rev or the Docs. It suggests to me that the instructions in the Rev Docs are not correct, or are so incomplete as to be misleading to new users. This is not a good look. It turns me off, and I'm persistent. Some will think to the point of stupidity. Fair call, you may be right. I could prove it by saying, well, hey, Donald Trump says never give up. I'm not that stupid. I've given up before, and I might again. The last time I gave up with software was with Rev, in 2003. For the much the same reasons. There are lots of Rev experts, but few good teachers. I'll answer other posts tomorrow. Night. Regards ken |
|
|
|