Discussion:
[power-pro] Script Question for CL: If statement, where to put EndIf?
ppromax@yahoo.com [power-pro]
2018-06-02 07:30:54 UTC
Permalink
Greetings Gurus, I'm using the *script function in a CL to execute the line below. This is an IF statement
(win.visible("c=TFullScreenWindow")) do win.show("c=TFullScreenWindow") endif






If I exclude the endif powerpro crashes my computer.
If I include the endif the script works but i get the error below.
brucexs@yahoo.com [power-pro]
2018-06-02 09:38:53 UTC
Permalink
As background to answer: PPro developed over a long period. As new (better?) features were added, older ones were kept for compatibility. But you should ignore those older approaches.

In this case, that means you should keep scripts in files. For very short scripts of less than 500 characters, you can use exec morecommandsasscript and put the script in the more commands section of the command entry controls instead of a file..


So for your case, I recommend
Exec
Morecommandsasscript
if (...) do
win.show...
endif


Also notice that the keyword *script is not used; it is one of those older approaches.


If this is a longer script, you should store in file. If you do not know how, read ppst.chm in ppro exe, ignoring any parts about older syntax, and then post questions.




OLDER SYNTAX ()NOT RECOMMENDED)
1. You can store long scripts as a command list, where each line in the script is a separate command in the clist. Not recommended except for very special cases.


You can also store single if commands in the command entry controls as follows
Command: If
Command Parameters: (expression)
More commands: One or more statements to be controlled by the if.


For this old syntax, you do not use Do. This can be confusing so it is simpler to always use morecommandsasscript.
ppromax@yahoo.com [power-pro]
2018-06-02 11:50:17 UTC
Permalink
Thanks Bruce, it's a short script so I'll try that Exec option.
Exec
Morecommandsasscript

Loading...