• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

APMT test program grabs frame in KMP

Started by ddan, 2008.06.07, 00:21:51

Previous topic - Next topic

ddan

While looking into APMT (IBM EWS), found SAVE_IMAGE function. Occurred to me
that might be possible to grab frames from KMPFS, a feature it seems to lack.
Is. Here's a semi-working demo. I say "semi" because when run from an OS/2
prompt, grabs the frame, but then the calling VIO just disappears. Similar
behavior after making a program object, but since it has only one function,
that might be usable.

Anyone have a clue why it crashes the VIO window? I've had other REXX programs
do that, no error message at all, when trying various RexxUtil functions. No
useful info remains even when "Close window on exit" is checked off.

You need to have KMP running, probably paused. It makes KMP go full screen,
but can live with. Or can modify for other windows if you have the correct
name (see below). The "*" option for current focus also works.

(Yes, I know of screen capture programs. This tests APMT and is useful too.)

------------------------------- snip all after -----------------------------
/* TEST APMT  Most here is extracted from examples with APMTST.ZIP. */
/* found at http://www.quercus-sys.com/rexxfree.htm */

Trace off
call APMT_INIT

/* Following section may be necessary to find window name -- IF it has one. */
/* Does NOT necessarily return same names as either sysqueryswitchlist or */
/* in the window list as displayed! */
/* (When the loop hits Hanisch's ScreenSaver, it starts.) */
/* n = 1
do while SELECT_WINDOW("*",1,n)  = 0
    rc = QUERY_TITLE("title")
    say 'WINDOW NO. 'n ':|'title'|'
    n = n+1
    end
exit */

rc= SELECT_WINDOW("K Movie Player*","10")
rc= SET_FOCUS()
rc = QUERY_TITLE("title")
say "The selected window's title is " title
rc= SYSMENU_SELECT("Maximize")
rc= WAIT("5000") /* waits out resolution message because goes full screen */
call beep 1000, 100
rc= SAVE_IMAGE( "C:\TEMP.BMP" )
if rc \= 0 then signal apmt_close /* probably not necessary, yet */

APMT_CLOSE:
say 'Message=\'APMTMSG'\'
rc = END_SESSION();
exit

APMT_INIT:
signal on error name errorexit
call rxfuncadd  'APMTLoadFuncs',  'apmtext', 'APMTLoadFuncs'
call APMTLoadFuncs;
rc = INIT_SESSION();
if rc \= 0
   then do
     say apmtmsg
     signal errorexit
├────────────────────────────────────────────────────────────
     end
signal on halt name APMT_CLOSE
return

ddan

Here's more experimental code, to feed the wild enthusiasm. Initial goal was
to use 'mode 90, 30' in REXX program to set size of its own VIO window, and
then RESIZE it automatically to get rid of the scroll bars and see the whole
window. (The font size here is irrelevant, just for testing.) If anyone has a
better way -- using only basic REXX or at worst freely available DLLs -- I'd
be glad to hear it.

Fundamental problem is still that when running from command prompt, the VIO
disappears just as if the 'exit' were passed to the command processor. I could
live with calling indirectly from an icon, but don't see why should have to.
Believe it's due to some error that isn't handled. Besides REXX programs, OS/2
windows sometimes just disappear after >dir /a /s /w, which seems due to file
names having high-ASCII characters (in non-English names) crashing TTY driver,
because can redirect listing to a file without problem. What say, gurus?

/* this replaces all between APMT_INIT and APMT_CLOSE: */
wn= "OS/2 Window" /* or "DOS Window" - Won't match unless VIO is at prompt! */
rc= SELECT_WINDOW(wn,"10")
rc= SET_FOCUS()

rc= SYSMENU_SELECT("Font Size")
rc= WAIT("50")
rc= SELECT_DIALOGWINDOW("Set Font Size") /* this name found by looking... */
/* 17 font sizes (from WSEB, believe same from at least W4):
'0 8x8 1 10x6 2 10x8 3 12x5 4 12x8 5 14x6 6 14x8 7 15x7 8 16x5',
'9 16x8 10 16x12 11 18x8 12 18x10 13 20x12 14 22x12 15 25x7 16 30x12' */
rc= LISTBOX_SELECTITEM("1", "13")  /* ^ mine initially at 18x10 */
rc= KEYBOARD("ENTER")

rc= SELECT_WINDOW(wn,"10") /* seems necessary to repeat */
rc= SYSMENU_SELECT("Size") /* now resize by simulating keys */
do n= 1 to 16  /* numbers just enough for 18x10 to 22x12 -- it's SLOW */
  rc= KEYBOARD("RIGHT")
end
do n= 1 to 4
  rc= KEYBOARD("DOWN")
end
rc= KEYBOARD("ENTER") /* done */

call beep 1000, 100
exit

RobertM

ddan,

Are there any hints in the POPUPLOG indicating what is crashing and why?

Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|


ddan

Yes, there is a hint in POPUPLOG.OS2, in the fact that there isn't any.

The VIO windows just disappear, whether from the above REXX code or a perfectly ordinary dir listing. Doubt that they're related. I've been attributing the latter to some bug in the video driver (though I've seen it with various, and am using SNAP 3.18).

I've been expecting to run across some mention of this, which I first noticed with plain W4. Am I the only only who still uses the command line? -- Well, believe file names with foreign characters... er, non-English, high-ASCII characters is necessary, but never been able to trace it to one (have a bunch).

Here's a screen capture of an ordinary >dir listing that show, er, an anomaly, probably related:
Directory of C:\fav

[.]
  [..]
    03. Kelly Kelekidou - Gluka Gluka Glukia Mou.mp3
      03. Tamta - Ftais (Faraway).mp3
        05. Eirini Merkouri - Mazi De Kanoyme Kai Xwria De Mporoyme (Tzini Magik
o).mp3    08_hooverphonic-no_more_sweet_music.mp3
            09-player_and_remady_-_nord_electro_(original_mix).mp3
              110-wax_taylor_feat_charlotte_savary-our_dance.mp3
                Amy Diamond - Welcome To The City.mp3
                  Balkan Beat Box AdirAdirim.mp3
                    Diego Modena & JeanPhilippe Audin Song from Ocarina.mp3
                      Gala - Faraway (Radio Edit).mp3
                        Gypsy Reggae.mp3
                          Murray Head - One Night In Bangkok.MP3

You'll note the lines move over by a space. Hmm, huh? And part of a file name gets stuck in the window title and never goes away.

ddan

Oh, forgot, it's also possible, likely even, related to multiple dots in a file name. In my day, we didn't allow that. Nor spaces. I've written a rename in REXX to convert them pesky foreign characters to low ASCII, besides chop out annoying parts, but it needs more work for special cases. Found that FTPServer127 chokes on high ASCII.

RobertM

Havent had a problem with multiple dots or spaces (except with file associations sometimes)... so I would guess it's "high ascii"

Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|


jep

Hello,

When you write "KMPFS", do you then mean the media player?

If you try to capture data from windows that use some overlay technique, you may only see some black or bright green color as the image is written directly to the memory on graphics card on the position where the window appear. You can easily check that if you try to use VNC to the computer that play some movie, only the empty black/green window appear even if you've put it on hold (pause) and can see the image on the attached monitor.

I haven't go the knowledge what may cause it to close like that though.

Would be very nice to create some automated test tool out of the quercus files you show examples on how to use.

//Jan-Erik

ddan

Yes, KMPFS refers to KMP.EXE, "K Movie Player", as in the first code. That's
my file selector front-end. The frame grabbing works as is, though. It's other
problems that I'm wrestling with.

Here's the file name which produces the above listing shift (with > dir /w):
05 Eirini Merkouri - Mazi De Kanoyme Kai Xwria De Mporoyme (Tzini Magiko).mp3
Delete the spaces either side of the dash, and it lists normally. This is
reproducible on my system by pasting the above name to create a new file in a
new directory with "copy con" and a few garbage characters. It also garbaged
the VIO title with characters of "Welcome to the City" above, which was not
even in the new directory. SO I'm certain this somehow overflows a buffer. --
And if not clear, it only occurs with the "/w" switch.

BUT there's another file having space-dash-space, which doesn't cause the
problem, so I got rid of "05" and put back the spaces:
Eirini Merkouri - Mazi De Kanoyme Kai Xwria De Mporoyme (Tzini Magiko).mp3
and no problem. Conclusion, must have leading #s and " - ". Hmm. I'll rewrite
my renamer with this in mind, perhaps even to scan and fix the entire drive.
Interested whether anyone can -- well, I'm sure that you CAN reproduce the
effect, this has plagued me from W4 on -- so actually I'm curious whether
anyone WILL try it and go "Hmm..."

NOW BACK TO THE REXX PROGRAM EXITING. Put a delay right before "exit" and it
waits out, but then is exactly as if typed the "exit" on the command line. On
the other hand, running from an icon with "Close Window on exit" checked OFF
in Properties does show the "Completed" message and wait for click on close.
Hmmmmmmm...

RobertM

Quote from: ddan on 2008.06.09, 15:49:44
NOW BACK TO THE REXX PROGRAM EXITING. Put a delay right before "exit" and it
waits out, but then is exactly as if typed the "exit" on the command line. On
the other hand, running from an icon with "Close Window on exit" checked OFF
in Properties does show the "Completed" message and wait for click on close.
Hmmmmmmm...

This seems to be the "normal" behavior for both KMP and mPlayer when run in that fashion. Nothing I have tried will automatically close the window on completion... I was trying to think of a way around that, but since the process is completed, you cant even kill it by it's process ID. Other than hitting the "X" (close button) or selecting "Close" on the SysMenu, I've yet to discover a way to close the remaining "Completed" VIO window.

Good luck on that one...   ;D

As a side note, someone suggested it is an option used in the compilation of both which is causing that behavior (and ignoring the system's icon object settings). Perhaps an email to either porter might result in either a resolution to the issue or an indication as to why it is doing it.

Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|


RobertM

As a side note, mPlayer seems to support certain functions either to or from (or both) a pipe. I am wondering if it would be easier to control...

I will try to dig up more docs on both and see if there is anything useful that you may not yet have run into.

Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|


ddan

Hello RobertM. Afraid that you've too lightly skimmed my posts, which is understandable.

It's not KMP which is exiting without notice. It's the above REXX code, run from command line (or icon, to save trouble re-typing into a VIO that's just going to disappear).

Anyone can duplicate it (I don't ask that you do, but it's somewhat amazing to see...) after installing APMT and KMP, copy and paste the frame grabber code into a .cmd file, run  KMP, pause, it, then from command prompt run the .cmd. It'll grab the frame without any effect on KMP, but then poof! The VIO is gone.

The second code segment doesn't require KMP, and is more for the use I want: to programatically maximize a VIO after a "mode 90, 30" in the REXX code. Same vanishing.

After running these, some apparently harmless garbaging occurs around the mouse cursor, so APMT may not be entirely usable...

jep

Hello,

just out of curiosity...

can you spot the exact line of code that cause the problem ( call trace '?i' in the code ) or perhaps create some logging device after every line ( call lineout 'my_log_fil.txt', rc ) and to debug the situation?

But if it's a real problem then it may be worse than that, impossible of course to track down and then it may perhaps be related to the dll itself and its internals.

tried to search for it, do you use version 2.9 or 3.4? Would like to get my hands on the source code, then we'd have the perfect automated test device close at hand, at least partially. The only thing lacking would be the ability to address fields by internal names, but DragText have that, so a little help from there and it should be solved too.

//Jan-Erik
Responsible of automated software tests at a company that develop ERP software for the manufacturing industry

RobertM

#12
Quote from: ddan on 2008.06.11, 05:07:31
Hello RobertM. Afraid that you've too lightly skimmed my posts, which is understandable.

It's not KMP which is exiting without notice. It's the above REXX code, run from command line (or icon, to save trouble re-typing into a VIO that's just going to disappear). ..

Ah... well, that I have seen when there is a resource shortage or such. If you can manage to have a few of these going at a time and cause such a situation, then opening a CMD prompt window should not work (until the programs are shut down). I usually get the beginnings of the window being drawn (frame controls, frame) and then it vanishes with no trace or entry in the popuplog.

My situation was a bit different though... it had to do with resouce usage and ObjectREXX. Switching to CREXX resolved it. Are you running ObjectREXX? Maybe there is something else "leaky" in it that is tying up a specific resource? If so, that may be the cause of the problem.

As a side note, all my VIO windows run a REXX script briefly on open - so if the issue I was seeing is a REXX resource (and not a VIO one), then you may not see the same results in testing it this way. Though I have seen similar actions with regular VIO windows under similar circumstances of limited resources.

Robert


|
|
Kirk's 5 Year Mission Continues at:
Star Trek New Voyages
|
|