Solved i need a batch file to open monarch tool ans open the .out

April 10, 2014 at 14:48:51
Specs: Windows XP
i need a batch file to open monarch tool ans open the .out file and apply the model and get the summary. this i ve done but i need to get the dirll down on the summary . can any one explain????

See More: i need a batch file to open monarch tool ans open the .out

Report •


✔ Best Answer
April 15, 2014 at 20:27:42
I p-mailed the material to naveen. Since the vbscript version had errors, I'm gonna post the (corrected) vbscript, and the "help" file:
'========== begin vbsdript SENDKEY.VBS
set fso=createobject("scripting.filesystemobject")
set w=createobject("wscript.shell")
on error resume next
fil=wscript.arguments(0)
if err.number>0 then
fil="?"
err.clear
end if
on error goto 0
'----- the help display
If Right(RTrim(fil), 1) = "?" Then
set c=fso.opentextfile("sendkey.hlp",1)
a=0
do while not c.atendofstream
wscript.stdout.writeline c.readline
a=a+1
if a mod 23 = 0 then aa=wscript.stdin.readline
loop
wscript.echo "(content found in: sendkey.hlp)"
end if

'-------- main-stream
set c=fso.opentextfile(fil,1)
'header data: first 3 lines
pgm=c.readline
mode=c.readline
if mode="" then mode=1
windo=c.readline

if pgm <> "" then z=w.run (pgm,mode) :wscript.sleep 2000
'------ attempt to delay while/until the requested window opens
on error resume next
k=1
do while k>0
w.appactivate windo
wscript.sleep 100
loop
err.clear
on error goto 0

do while not c.atendofstream
x=c.readline
send=x
if left(send,1)=chr(34) and right(send,1)=chr(34) then
'quoted item is always a string
send=mid(send,2,len(send)-2)
x=0
else
'attempt to determine if delay or send-string
call numtest(x)
end if
if x>0 then
'execute the requested delay
wscript.sleep x
else
'send the keystrokes into the window
'only ONE right-hand space is trimmed, to allow for sending of right-spaces
'to send right spaces, append one extra space to account for this.
'this is done to allow integers to be sent without quoting them (so they
'won't be interpreted as delays.)
w.sendkeys send,true
end if
loop
wscript.quit

sub numtest(x)
'gotta be a better way, but this is it for now...
s=cstr(x)
if isnumeric(x) and left(s,1)<>"0" and instr(s,".")=0 then
x=cint(x)
if vartype(x)<2 or vartype(x)>3 then x=0
else
x=0
end if
if left(x,1)=" " then (
x=0
send=mid(send,2)
end if
end sub

'=========== end vbscript - begin 'help' file SENDKEY.HLP:
Usage: CSCRIPT SENDKEY.VBS [path\]textfile
The given textfile provides the script that drives the program.
The file's format consists of 3 leading or "header" elements, followed by
any number of data elements. Any element, whether header or data, is optional,
none are required, BUT you must reserve an empty spot for each header element.
Elements are separated by newline (each on its own line).
- CONTROL/SCRIPT FILE FORMAT -
HEADER:
line)
1) program to start/run, incl. any commandline data: f/e: NOTEPAD TEST.TXT
2) program window style: 0: hidden, 1: normal 2: icon 3: maximized
note: if window-style is zero, the window cannot be accessed for sendkey
3) title of window to which keys will be sent, matches any window up to
length of string given so be specific enough to get the right one.
f/e: test - Notepad
DATA (SCRIPT):
4...) DATA: keystrokes and delays, mixed/assorted as needed:
Any unquoted integer is interpreted as a DELAY element in milliseconds
Keystroke(s): Any quoted item or non-integer item (quoted or not) is interpreted
as a keystroke-string to send. For more detail, refer to "KEYS" below.
Any item that contains a comma, be sure to enclose it in dbl quotes, like: ","
To send a dbl quote, enclose it in braces, like: {"}
Note: Some combinations, such as and especially, shift+tab, or: +{tab} will
fail unless quoted. To send a shifttab: "+{tab}"

Example: say you want to send the word "testing", then ENTER (newline),
then "line, two", a quoted "goodbye", then a 1-sec. delay, then alt-e,a (Select
All) into Notepad, this would be the content of the send-script file:
notepad
1
Untitled - Note
testing
{enter}
"line, two"
{ENTER}
{"}
goodbye
{"}
400
%e
a

Your batch can build the script file, since it's text, and then it can execute the file (f/e: TEST): cscript sendkey.vbs test
NOTE: if you use batch to build the send-script, and you intend to send ALT keys, be sure to double up the percents: >>TEST echo %%f (ALT-F)

KEYS:
Nothing is sent into the window except exactly what you specify in the list. When the end of the list is reached, control reverts to manual (user interactive). "regular" keys are standard printable keys other than (){}[]^%+
Specify any regular keys like (examples): A, AB, AB76, A:B, A/?X&
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( )
have special meanings to SendKeys. To specify one of these characters,
enclose it within braces. For example, to specify the plus sign, use {+}.
To send brace characters, use {{} and {}}.
Brackets ([ ]) must also be enclosed in braces as well, because some other
applications use them.

To specify characters that aren't displayed when you press a key (such as
ENTER or TAB) and keys that represent actions rather than characters, use the
following table: (note, these are NOT case sensitive)

Key Code
--------------------------------
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS {INSERT}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1..F16 {F1}..{F16}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT, precede the regular key code with one or more of the following codes:
+ = SHIFT, ^ = CTRL, % = ALT. F/e: %{f4} for the end-pgm seq ALT-F4

To specify that any combination of SHIFT, CTRL, and ALT should be held down
while several other keys are pressed, enclose the code for those keys in
parentheses.
F/e, to send SHIFT-EC (SHIFT held down while E and C are pressed), use: +(EC)
To specify to hold down SHIFT while E is pressed, followed by C without SHIFT,
use: +EC
To specify repeating keys, use the form: {key number}. You must put a space
between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press h 10 times.

SendKeys can't send keystrokes to an application that's not designed to run in Windows. Sendkeys can't send the PRINT SCREEN (PRTSC) key to any application.

message edited by nbrane



#1
April 11, 2014 at 05:29:43

"can any one explain????"

Sorry, but YOU have to explain what you are trying to accomplish, since here there are very skilled guys/gals but without ESP powers (almost I suppose).

Report •

#2
April 11, 2014 at 08:21:37
It looks like they are no longer allowing automation that way, may be your issue

The End User Licence Agreement since Monarch 11.5 prohibits such automation.

::mike


Report •

#3
April 11, 2014 at 12:30:28
START C:\PROGRA~1\Monarch\Program\Monarch.exe N:\o21767240.out Z:\model\JM800DEMSUM.mod /s Drill Down = Yes c:\nave800DEMSUM123_041114.xls

after applying the model , it applies /s means it will gives the summary. when we click the drill down button on the command bar we will get the complete records . i am unable to click on the drill down option from bat file. dril down option is in Edit menu Drill Down as menu item

message edited by naveen.lazarus


Report •

Related Solutions

#4
April 12, 2014 at 21:03:10
With no scripted or automated interface to the GUI, the only thing I can suggest is to use sendkeys, which needs either vbscript or visual basic to implement. I made a front-end to sendkeys using both approaches (vbs and vis.basic). It will send the keystrokes into an open window. I'm not gonna post any of that unless you're interested. The vbasic is compiled into a .exe, but if you have access to a compiler, I can just post the source-code for your examination prior to compiling on your end. The vbscript does not need a compiler. Also, no promises for 64 bit implement.
If there is an intermediate text file that can be operated on, then that might be a way to "end run" around this whole issue.

message edited by nbrane


Report •

#5
April 14, 2014 at 10:29:06
Thanks nbrane!!!!!!

upto now from the bat file i am able to find the summary.now i want to go for the drill down option automatically.but i m unable to do that one through batch file programming.any how u r idea would be good to go ahead. thanks for u r idea. would u please send me the sendkey source code in C# if posible to complete my project


Report •

#6
April 14, 2014 at 14:02:07
PLEASE POST THE CODE I CAN CONVERT IT INTO C#

THNAKS IN ADVANCE


Report •

#7
April 15, 2014 at 20:27:42
✔ Best Answer
I p-mailed the material to naveen. Since the vbscript version had errors, I'm gonna post the (corrected) vbscript, and the "help" file:
'========== begin vbsdript SENDKEY.VBS
set fso=createobject("scripting.filesystemobject")
set w=createobject("wscript.shell")
on error resume next
fil=wscript.arguments(0)
if err.number>0 then
fil="?"
err.clear
end if
on error goto 0
'----- the help display
If Right(RTrim(fil), 1) = "?" Then
set c=fso.opentextfile("sendkey.hlp",1)
a=0
do while not c.atendofstream
wscript.stdout.writeline c.readline
a=a+1
if a mod 23 = 0 then aa=wscript.stdin.readline
loop
wscript.echo "(content found in: sendkey.hlp)"
end if

'-------- main-stream
set c=fso.opentextfile(fil,1)
'header data: first 3 lines
pgm=c.readline
mode=c.readline
if mode="" then mode=1
windo=c.readline

if pgm <> "" then z=w.run (pgm,mode) :wscript.sleep 2000
'------ attempt to delay while/until the requested window opens
on error resume next
k=1
do while k>0
w.appactivate windo
wscript.sleep 100
loop
err.clear
on error goto 0

do while not c.atendofstream
x=c.readline
send=x
if left(send,1)=chr(34) and right(send,1)=chr(34) then
'quoted item is always a string
send=mid(send,2,len(send)-2)
x=0
else
'attempt to determine if delay or send-string
call numtest(x)
end if
if x>0 then
'execute the requested delay
wscript.sleep x
else
'send the keystrokes into the window
'only ONE right-hand space is trimmed, to allow for sending of right-spaces
'to send right spaces, append one extra space to account for this.
'this is done to allow integers to be sent without quoting them (so they
'won't be interpreted as delays.)
w.sendkeys send,true
end if
loop
wscript.quit

sub numtest(x)
'gotta be a better way, but this is it for now...
s=cstr(x)
if isnumeric(x) and left(s,1)<>"0" and instr(s,".")=0 then
x=cint(x)
if vartype(x)<2 or vartype(x)>3 then x=0
else
x=0
end if
if left(x,1)=" " then (
x=0
send=mid(send,2)
end if
end sub

'=========== end vbscript - begin 'help' file SENDKEY.HLP:
Usage: CSCRIPT SENDKEY.VBS [path\]textfile
The given textfile provides the script that drives the program.
The file's format consists of 3 leading or "header" elements, followed by
any number of data elements. Any element, whether header or data, is optional,
none are required, BUT you must reserve an empty spot for each header element.
Elements are separated by newline (each on its own line).
- CONTROL/SCRIPT FILE FORMAT -
HEADER:
line)
1) program to start/run, incl. any commandline data: f/e: NOTEPAD TEST.TXT
2) program window style: 0: hidden, 1: normal 2: icon 3: maximized
note: if window-style is zero, the window cannot be accessed for sendkey
3) title of window to which keys will be sent, matches any window up to
length of string given so be specific enough to get the right one.
f/e: test - Notepad
DATA (SCRIPT):
4...) DATA: keystrokes and delays, mixed/assorted as needed:
Any unquoted integer is interpreted as a DELAY element in milliseconds
Keystroke(s): Any quoted item or non-integer item (quoted or not) is interpreted
as a keystroke-string to send. For more detail, refer to "KEYS" below.
Any item that contains a comma, be sure to enclose it in dbl quotes, like: ","
To send a dbl quote, enclose it in braces, like: {"}
Note: Some combinations, such as and especially, shift+tab, or: +{tab} will
fail unless quoted. To send a shifttab: "+{tab}"

Example: say you want to send the word "testing", then ENTER (newline),
then "line, two", a quoted "goodbye", then a 1-sec. delay, then alt-e,a (Select
All) into Notepad, this would be the content of the send-script file:
notepad
1
Untitled - Note
testing
{enter}
"line, two"
{ENTER}
{"}
goodbye
{"}
400
%e
a

Your batch can build the script file, since it's text, and then it can execute the file (f/e: TEST): cscript sendkey.vbs test
NOTE: if you use batch to build the send-script, and you intend to send ALT keys, be sure to double up the percents: >>TEST echo %%f (ALT-F)

KEYS:
Nothing is sent into the window except exactly what you specify in the list. When the end of the list is reached, control reverts to manual (user interactive). "regular" keys are standard printable keys other than (){}[]^%+
Specify any regular keys like (examples): A, AB, AB76, A:B, A/?X&
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( )
have special meanings to SendKeys. To specify one of these characters,
enclose it within braces. For example, to specify the plus sign, use {+}.
To send brace characters, use {{} and {}}.
Brackets ([ ]) must also be enclosed in braces as well, because some other
applications use them.

To specify characters that aren't displayed when you press a key (such as
ENTER or TAB) and keys that represent actions rather than characters, use the
following table: (note, these are NOT case sensitive)

Key Code
--------------------------------
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER} or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS {INSERT}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC}
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1..F16 {F1}..{F16}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT, precede the regular key code with one or more of the following codes:
+ = SHIFT, ^ = CTRL, % = ALT. F/e: %{f4} for the end-pgm seq ALT-F4

To specify that any combination of SHIFT, CTRL, and ALT should be held down
while several other keys are pressed, enclose the code for those keys in
parentheses.
F/e, to send SHIFT-EC (SHIFT held down while E and C are pressed), use: +(EC)
To specify to hold down SHIFT while E is pressed, followed by C without SHIFT,
use: +EC
To specify repeating keys, use the form: {key number}. You must put a space
between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press h 10 times.

SendKeys can't send keystrokes to an application that's not designed to run in Windows. Sendkeys can't send the PRINT SCREEN (PRTSC) key to any application.

message edited by nbrane


Report •

Ask Question