Enhancement Request

mike

Member³
The status bar on the bottom says how long things take in seconds. It would be nice if it showed the time in days, hours, minutes, seconds, fractions of a second.

Maybe everyone else's stuff runs in seconds, but mine doesn't always and I find myself manually converting it, so I can avoid a conversation like this:

Boss: How long did it take Mike?
Me: 12,743.219 seconds.
Boss: Are you an idiot?

That didn't happen, but you get the idea, right? It's a minor thing, but it would be nice to have.

Thanks for considering,

Mike
 
A little Browser Extender extension :) .
Works in version 2.7.

3997.png


Cut and Paste then save to a file with .be extension and load in Browser Extender.


Code:
PL/SQL Developer Browser Extender Command

[MAIN]
NAME=Show elapsed time
CAPTION=Show elapsed time...
OTYPE=sqlwindow
OOWNER=%
ONAME=%
SEPARATOR_ABOVE=N
SEPARATOR_BELOW=N
LOAD_AND_EXECUTE=N
LOAD_COMMAND=N
LOAD_AFTER=REPLACE
LOAD_WIN_TYPE=1
EXECUTE_AND_CLOSE=Y
PRIVILEGE_REQ=N
PRIVILEGE=
ORACLE_VERSION_REQ=N
ORACLE_VERSION=7.0.0
ONCLICK_CONFIRM=N
ONCLICK_CONFIRM_MSG=
ONCLICK_SPLASH=N
ONCLICK_SPLASH_MSG=
ONCLICK_SPLASH_MSG_BL=N
ONCLICK_SPLASH_MSG_AFTER=
ONCLICK_SPLASH_DELAY=0
ONCLICK_IGNORE_EXCEPTIONS=Y
ONPOPUP_IGNORE_EXCEPTIONS=Y

ONCLICK_CODE_TYPE=4
ONCLICK_EXTERNAL_CODE_FILE=
[ONCLICK]
program ShowElapsedTime;
{.$DEFINE DEBUG}                         // enables debug mode and related debug sub-items
const
  { Messages constants }
  WM_USER = 00;
  SB_GETPARTS = WM_USER+6;
  SB_GETTEXTA = WM_USER+2;
  SB_GETTEXTW = WM_USER+13;
  SB_GETTEXT  = SB_GETTEXTA;

  SB_GETTEXTLENGTHA       = WM_USER+3;
  SB_GETTEXTLENGTHW       = WM_USER+12;
  SB_GETTEXTLENGTH        = SB_GETTEXTLENGTHA;

  { MessageBox() Flags }
  MB_OK = ___SNIPPET___000000;
  MB_ICONASTERISK = ___SNIPPET___000040;

var
  sb_CurWinHandle, sb_CurWinStatusBarHandle : HWND;
  sb_Part : Integer;
  //sb_Text : array\{0..255\} of Char;
  sb_Text : String;
  i: Integer;
  ElapsedTime: Extended;
  CurText: String;
  MessageText: String;
  ElapsedDays, ElapsedHours, ElapsedMinutes, ElapsedSeconds, ElapsedMiliseconds: Integer;

  function FindWindowEx(hwndParent: HWND; hwndChildAfter: HWND; lpszClass: PChar; lpszWindow: PChar): Longint; external 'FindWindowExA@user32.dll stdcall';
  function SendMessage(hWnd: HWND; Msg: Longint; wParam: Longint; lParam: PChar): Longint; external 'SendMessageA@user32.dll stdcall';
  function MessageBox(Wnd: HWND; Text: PChar; Caption: PChar; Typ: Longint): Longint; external 'MessageBoxA@user32.dll stdcall';

begin
  sb_CurWinHandle := IDE_GetChildHandle;

  { Starting version 710 the interface supports Unicode and Status bar Class name was changed }
  If  SYS_Version >= 710 then
    sb_CurWinStatusBarHandle := FindWindowEx(sb_CurWinHandle,0,'TControlStatusBar.UnicodeClass','')
  else
    sb_CurWinStatusBarHandle := FindWindowEx(sb_CurWinHandle,0,'TControlStatusBar','');

  { get the last panel index }
  sb_Part := SendMessage(sb_CurWinStatusBarHandle,SB_GETPARTS,0,'') - 1;

  for i:=0 to 255 do
    sb_Text := sb_Text + chr(0);

  SendMessage(sb_CurWinStatusBarHandle,SB_GETTEXT,sb_Part,sb_Text);
{$IFDEF DEBUG}
  DebugWriteln('sb_Text = ' + String(sb_Text));
{$ENDIF}

  CurText := String(sb_Text);

  If Pos('selected in',CurText) > 0 then
    begin
      CurText := copy(CurText,Pos('selected in',CurText) + length('selected in'),Length(CurText));
      CurText := copy(CurText,1,Pos('seconds',CurText)-1);
      CurText := Trim(CurText);

      {replace comma with dot}
      i:= Pos(',',CurText);
      If i > 0 then
         begin
           delete(CurText,i,1);
           insert('.',CurText,i);
         end;
      ElapsedTime := StrToFloat(CurText);

      ElapsedDays := Trunc(ElapsedTime/86400);
      ElapsedTime := ElapsedTime - ElapsedDays*86400;

      ElapsedHours := Trunc(ElapsedTime/3600);
      ElapsedTime := ElapsedTime - ElapsedHours*3600;

      ElapsedMinutes := Trunc(ElapsedTime/60);
      ElapsedTime := ElapsedTime - ElapsedMinutes*60;

      ElapsedSeconds := Trunc(ElapsedTime);
      ElapsedTime := ElapsedTime - ElapsedSeconds;

      ElapsedMiliseconds := Trunc(ElapsedTime * 1000);

      MessageText := IntToStr(ElapsedDays) + ' day(s), ' +
                     IntToStr(ElapsedHours) + ' hour(s), ' +
                     IntToStr(ElapsedMinutes) + ' minute(s), ' +
                     IntToStr(ElapsedSeconds) + ' second(s), ' +
                     IntToStr(ElapsedMiliseconds) + ' millisecond(s)';

      MessageBox(Application.Handle, MessageText, 'Elapsed time', MB_ICONASTERISK or MB_OK );
    end;
end.

[ONPOPUP]
 
care required when copying and pasting from the source code of the page, greater than signs are replaced with ">".

this is on lines : 39, 57 and 65.
 
Thanks. I guess if Browser Extender keeps being the answer to my complaints, I need to bug my manager to buy it!

Mike
 
Back
Top