Creating context help with macro scheduler?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
tomotello
Newbie
Posts: 2
Joined: Sun Mar 22, 2015 9:08 am

Creating context help with macro scheduler?

Post by tomotello » Tue Mar 24, 2015 1:24 pm

I'm planning to create a context help with Macro Scheduler for an statically linked Qt application where UI elements are only accessible through window x,y positions, image/text recognition. Fortunately the application has fixed window size.
The goal is to display help information by pressing F1 (or other) for the UI element where mouse pointer actually is.

As I'm new to Macro Scheduler I've just wanted to ask more experienced users, if this is possible and if someone has done already something similar.

Thanks for your hints, Thomas

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Creating context help with macro scheduler?

Post by Marcus Tettmar » Tue Mar 24, 2015 1:29 pm

Hi,

As much as I'd love to sell you Macro Scheduler, I think this is completely the wrong way to provide context sensitive help for your Qt application. I'm assuming this is YOUR Qt app and you have access to the source. Development environments such as Qt should give you a direct way to pass help context to the help system without using third party apps. Here's some Qt documentation on doing so:

http://doc.qt.digia.com/qq/qq08-helpclient.html
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tomotello
Newbie
Posts: 2
Joined: Sun Mar 22, 2015 9:08 am

Re: Creating context help with macro scheduler?

Post by tomotello » Wed Mar 25, 2015 5:49 am

Thanks Marcus!
I'm already happy owner of Macro Scheduler, there are many other things I can do, it's not a show stopper.
It's not my application, I don't have the source - I even only assume it's Qt, I just see that Macro Scheduler can't get in any way information about the UI elements. Being aware, that what I'm trying to do is not really state-of-the-art, but just a workaround to facilitate new users the initial learning curve to get familiar with the application. If it's not possible to get this on the running application I could just create images and create HTML5 webpages with displaying context help over the image.

... and for this exciting tool. It was my choice after a longer evaluation. There are features included in the pro version which are only available within other tools (ranorex, UIPath) at much higher prices and very restricted licensensing.

Kind regards, Thomas

hoangvo
Newbie
Posts: 1
Joined: Wed Mar 25, 2015 4:31 pm

Re: Creating context help with macro scheduler?

Post by hoangvo » Wed Mar 25, 2015 4:42 pm

I thought i try it out and this is what i have so far, the image is the 'M' in mjtnet.com
There's alot that can be added to fix this (including the calculation for x/y and searching for image in windows specific)

It pulls x/y mouse cursor, compare value to known image location (one time check currently)
and if its within the x/y cordinate of the image, then show teh custom dialog.

I m sure there's better solution but if this is what your thinking of i hope it help kickstarts your proj.

Code: Select all

//Set IGNORESPACES to 1 to force script interpreter to ignore spaces.
//If using IGNORESPACES quote strings in {" ... "}
//Let>IGNORESPACES=1
VBStart
  function Test (oVal,compVal1,compval2)
    if oVal>compVal1 and oVal<compVal2 then
        Test=true
    end if
  end function
VBEND

Dialog>Dialog1
object Dialog1: TForm
  Left = -1673
  Top = 97
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'CustomDialog'
  ClientHeight = 49
  ClientWidth = 147
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 8
    Top = 8
    Width = 109
    Height = 25
    Caption = 'This is a test'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -20
    Font.Name = 'MS Sans Serif'
    Font.Style = []
    ParentFont = False
  end
end
EndDialog>Dialog1

SRT>CheckFoundM
    if>StateMImage=InFirst
        let>DoIt=True
    endif
END>CheckFoundM

SRT>DisplayDialog
    setDialogproperty>Dialog1,,Top,%YTopLeft%
    setDialogProperty>Dialog1,,Left,%XTopLeft%
    show>Dialog1
    Let>DoIt=False
    OnEvent>CUSTOM,CheckFoundM,DoIt,
END>DisplayDialog


//I capture the "M" in macroscheduler website and use that to do a quick test, 

FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,0,XTopleft,YTopLeft,NumFound,CCOEFF
FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,2,XTopRight,YTopRight,NumFound,CCOEFF
FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,3,XBotLeft,YBotLeft,NumFound,CCOEFF
FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,4,XBotRight,YBotRight,NumFound,CCOEFF
let>StateMImage=Out
let>k=0
repeat>k
    wait>1
    GetCursorPos>CurX,CurY
    vbeval>Test(%CurX%,%xTopLeft_0%,%XTopRight_0%),rst
    if>rst=True
        writeln>f:\test trunk\junk data\testlog.txt,wrst,rst=%rst%
        vbeval>test(%cury%,%yTopleft_0%,%ybotleft_0%),rst2
        if>rst2=True
            writeln>f:\test trunk\junk data\testlog.txt,wrst,rst2=%rst2% and StateMImage=StateMImage
            if>StateMImage=Out
                OnEvent>CUSTOM,CheckFoundM,DoIt,DisplayDialog
                let>StateMImage=InFirst
            endif
        else
            let>StateMImage=Out
            
        endif
    else
        let>StateMImage=Out

    endif
    
    writeln>f:\test trunk\junk data\testlog.txt,wrst,%StateMImage%
   /* vbeval>isBetween(%curX%,%xTopLeft%,%xTopRight%),ValueBetween
    if>ValueBtween=true
        vbeval>isBetween(%curY%,%yTopleft%,%ybotleft%),valuebetween2
        if>valuebetween2=true
            mdl>yes it is
        endif
    endif
    */
Until>k

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts