Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detecting new screen

Status
Not open for further replies.

zip11zip

MIS
Apr 15, 2003
11
US
I currently have a macro I created which will do a screen capture/scrape whenever invoked. However, I would like to implement something to automate the capture each time a new screen appears. To do this it seems I need to either:

1. Cause the macro to be invoked when a new page appears. I thought I may be able to do this via "hotspots", but I would need to trigger off of the "X" symbol which appears on the bottom host status bar whenever waiting for a host response and new screen. That bar is outside the "hotspots" trigger window from what I can see however.

2. Modify the macro to run continuously, and pass the user's keystrokes on to the session, while monitoring somehow for a new page. I need the screen capture just before the new page is displayed however, so I'm not sure about how to go about monitoring, or if this is feasible.

Ideas? Thanks!
 
Are you trying to capture the users input or the response?

How about the keyboard map?

do you use a specific key to transmit your information to the host? If so you could modify the transmit key to scrape first then transmit???

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
>Are you trying to capture the users input or the response?

I want to scrape the screen as it exists with their input displayed.

>How about the keyboard map?

I see how I can use the keyboard map to make a key run a macro, or to execute a series of keystrokes, but can't determine how to make it run a macro and then a keystroke.

>do you use a specific key to transmit your information to >the host? If so you could modify the transmit key to >scrape first then transmit???

There is no specific key - basically it would be all function keys and <Enter>.

I suppose if I could use keyboard mapping to make the keys run a macro and then their native keystroke, I could then create another macro to make that keyboard map I've modified the active keyboard map on demand, so that capture could be turned on and off when desired - and also so that the user wouldn't have to manually choose and "unchoose" the "logging" keyboard map?

Thanks for the response!

 
>I see how I can use the keyboard map to make a key run a macro, or to execute a series of keystrokes, but can't determine how to make it run a macro and then a keystroke.

Have the keyborad map call your scrape macro passing the native keyboard action as a argument to your scrape macro, case your arg at the end of your macro and have it perform the intended keystroke last.

[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Hmmm, ok - how do I pass that argument to my macro from the keyboard map? Sorry, I'm new at this.

Also, on a related subject (but in a different direction), if I'm doing a WaitForKeys, how do I test for <Enter> and <PF1>, <PF2>, etc? For instance, as a test, I have:

KeyStroke = Session.Screen.WaitForKeys
If (KeyStroke = "r") Then...

which then executes my macro ok if the keystroke is the letter 'r'. However I'm not sure how to specify a test for <Enter> in the If clause, since KeyStroke is a string. Thank you.

 
Code:
strArg = Command$
'Do your screen printing stuff
objSess0.SendKeys strArg

In Extra there should be a section where you can tell the macro to have an argument. You can always call it in the command line C:\Temp\Macro.ebm strArg.
 
I would really like to do this without keymapping, and after experimenting, I see that I can, if I could just figure out how to test for the pressing of the <Enter> or <PF1>, <PF2>...<PF12> keys, using WaitForKeys.

What would be the syntax of my If clause to test for the <PF1> key for example?

KeyStroke = Session.Screen.WaitForKeys
If (KeyStroke = ????????

I tried converting KeyStroke to ASCII so I could test, but that didn't work either - for any function keys anyway. Any ideas?
 
If you look at your keyboard map the sendkeys are right there. <Enter>, <PF1>, etc. are the sendkeys.

If the enter key is bound to <Enter> then objSess0.SendKeys "<Enter>" should perform the same action.
 
Thanks Skie, but I'm not having problems with SendKeys - I've sent keys as you show above.

What I need is a way to determine which key was pressed - preferably in my macro which constantly runs after being started - instead of via the keyboard map.

If the key pressed was <Enter> or one of the <PF_> keys, the logic in my macro needs to append the screen scraping to a file.

But what is the syntax to test for <PF1> for example?

For example, I can do the following to test to see if the letter "a" was pressed:

KeyStroke = Session.Screen.WaitForKeys
If (KeyStroke = "a")....then go do my screen scraping stuff

But, I can't do the following because it's a syntax error in the If clause:

KeyStroke = Session.Screen.WaitForKeys
If (KeyStroke = <PF1>)....then go do my screen scraping stuff


 
Why don't you do a

KeyStroke = Session.Screen.WaitForKeys
MsgBox KeyStroke

to determine what your If statements need to be?
 
I already did the equivalent of that, using Variable Watch in the Macro Editor. The values displayed are <Enter>, <Pf1>, <Pf2>, etc.

My problem is that I can't figure out a syntax that the If statement will accept as valid, to test for these.
 
Code:
If (KeyStroke = "<PF1>") then
You would still need to use quotes. If you're already including these, then your only option might be having to make a keyboard map with argurments.
 
Thanks, that was the answer I needed(thought I tried that, but obviously not). Unfortunately, the constantly running macro I am using it in cannot keep up with fast typing (and wasn't very well-behaved), so I'm back to the keyboard map idea.

Regarding your suggestion:
>In Extra there should be a section where you can tell the macro to have an argument. You can always call it in the command line C:\Temp\Macro.ebm strArg.

...are you saying that you can tell the macro to have an argument in the "Key Properties" of the keyboard map editor? I tried to assign the "Run a Macro" to a key, and tried adding an argument to the macro listed in the "Macro" field e.g. - "C:\Program Files\Attachmate\E!E2K\Macros\ENU\ChamCap.ebm test" .... but it complains that "this command requires a parameter to be selected".

I hard-coded the sendkey value in the macro as a test, and it works great! But I need to figure out how to pass the key value so I can have multiple keys use the same macro. Thanks for your patience.
 
Another quirk with EB is that in order to use arguments you have to call it like from a command line. So set your keyboard button up like this.

Category = Application
Commands = Run Application
Application = C:\Program Files\Attachmate\E!E2K\ebrun.exe C:\YourPath\Macro.ebm <Enter>
 
Hmm, I had looked in that category thinking that I could do this very thing, but the only commands I have for "Application" are:

Run Keyboard Map Editor
Run Quickpad Editor
Run Toolbar Editor

....no "Run Application".

I'm running
EXTRA! Enterprise - Display
myEXTRA! Enterprise 7.1a
 
Your security file is preventing you from running an application. If you have the ability to modify it, you could change that. If you don't, you'd need an admin to modify it.

If you can't get a security file that allows you to run applications, then you might have to make a macro for every key.
 
Thank you - I didn't know about the security file. Of course that couldn't be the end of the story....

I do have have the ability to modify the security file. However, even before I started experimenting with it, the "Run Application" option was already selected in the security file. I tried unselecting it, restarting EXTRA, selecting it, restarting EXTRA...and still no dice.

I can make the 3 commands I listed in my previous post for "Application" disappear and re-appear, but toggling the "Run Application" and for that matter the "Run Menu Editor" too, doesn't do a thing.

Is there security at another level, or could these "features" have been disabled in this copy of the software? I miss Netmanage!
 
I honestly don't know what would cause it to still not display the option even with it being checked. You could try contacting Attachmate. They might have an idea.

As far as the keystrokes, is there any reason you need to collect them all? Can your keyboard map not be modified so that the keys that perform a special function are the only ones assigned to a macro?

<PF1> Runs PF1.EBM
<PF2> Runs PF2.EBM
"A" doesn't run a macro

The code you're using to capture data could be a header file.
 
Thanks guys, there was something wrong with our current level of Extra, so we upgraded and all is ok now. Thanks for all your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top