CM (ehathgepiurhe) wrote:
>> When I clicked on the button, an error message appeared.
>> ... [snipped]
Bruce wrote:
> There are several syntax problems in above.
> Rather than attemption to explain, I would suggest you review the
> PowerPro sripting tutorial, which you can find on the Start Menu
> entry for PowerPro.
Reading PPSR.chm is a good recommendation
but I think his syntax errors are explained well in Help
Index: wait *command and Index: keys *command
Hi CM
First, about your If()
I guess from your message that you put the Exec Prompt command
as the main command and the rest of it in the More commands box.
If so, your If() syntax looks correct.
I mean, the If() condition will be applied to ALL following lines
which I presume is what you want.
IF this were a script file, you would have to change from
this (which is OK in a more commands box):
if(zYes == 1)
"C:\Run-Backup\H Backup Normal Log.bat"
*Wait for (300,activewindow("*cmd.exe*"))
*Keys (to *windows\system32*)a
*Wait for 300
*Keys (to *windows\system32*)a
to this for a script file:
if(zYes == 1)do
"C:\Run-Backup\H Backup Normal Log.bat"
*Wait for (300,activewindow("*cmd.exe*"))
*Keys (to *windows\system32*)a
*Wait for 300
*Keys (to *windows\system32*)a
endif
So your If() syntax is not a problem,
provided it is in the more commands box.
-------------------------------------------------
The error messages are caused by your first *Wait.
If there is a dot between "wait" and "for" then put
the arguments in parentheses:
Wait.for (300,activewindow("*cmd.exe*"))
If there is not a dot between them, use no parentheses:
Wait for 300,activewindow("*cmd.exe*")
That is explained in Help for Wait as:
"The older literal syntax form [snip] is also acceptable."
You wrote:
> I copied the "*Wait for (300,activewindow("*cmd.exe*"))"
> line from an example in the PowerPro help file.
It looks like you copied by typing, not by Copy & Paste
and you didn't include the "."
-------------------------------------------------
Another mistake I can see is using parentheses
instead of braces in the argument for *Keys.
Parentheses are curved: ( )
Brackets are square: [ ]
Braces are curly: { } made with Shift+[ and Shift+]
In some fonts, it's hard to see the difference.
PowerPro uses parentheses almost everywhere, except the
special codes for the keys comand should be in braces.
Actually, Keys doesn't usually need a {to something}
if you Wait for a window to become active.
------------------------------------------------
Wait.for(300,activewindow("*cmd.exe*"))
*Keys (to *windows\system32*)a
will only wait for the cmd window to become active.
That's not the same as waiting for the prompt which asks
for an "a", which will appear in the cmd window later.
So you may need to add another wait:
Wait.for(300,activewindow("=cmd"))
Wait.for(150)
Keys .....
Experiment to see how long my extra wait should be.
------------------------------------------------
I see you are running a .bat file which asks two prompts
which you answer with "a" by using *Keys.
I don't know whether the prompts are made by the .bat file
itself, or by a console program run by the .bat.
I suggest:
First try correcting the errors I described above.
At least that should prevent the error messages
which were caused by your first Wait command.
Then you might find new problems from your *keys not doing
what you want. If so, please paste "H Backup Normal Log.bat"
into your next message in this thread.
A PowerPro script can do anything which a .bat file can do,
using slightly different syntax of course.
It might be clearer to combine everything (your first Exec
prompt, plus your More Commands, plus what the .bat does)
into a single PP script file.
Then your button would have a single command: .scriptname
If you try that, remember to use If()do ... Endif
as shown above.
-----------------------------------------------
This last part is probably irrelevant but I'll mention it
just in case...
I guess your cmd window has title:
C:\Windows\System32\cmd.exe
and you are using the Part Title kind of caption list,
sometimes "*cmd.exe*" and sometimes "*windows\system32*"
That could be ambiguous. For example, maybe your file manager
is showing windows\system32 in its title.
Anyway, is it the correct title when the batch is running?
and when the console program run by the bat is running?
You could try =cmd everywhere, for example:
Wait.for(300,activewindow("=cmd"))
Or try the "c=class" type of caption list argument:
Wait.for(300,activewindow("c=ConsoleWindowClass"))
[provided you only have one cmd window open at the time]
Attention: PowerPro's Web site has moved: http://www.ppro.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/power-pro/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/power-pro/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/