Forum Discussion

BenoitB's avatar
BenoitB
Community Hero
5 years ago

Size and Pos of Indicator

Hello,

 

I made a method for low-level click that works quite well unless under the Indicator.

I don't want to hide Indicator all time,  just hide it before clicking if click coordinates are under Indicator.

I didn't find the way to have size and pos of this Indicator so askting to Community.

 

My code:

 

/**
 * Click dans un objet via les méthodes Low Level
 * @author Biache Benoit
 * @memberof system
 * @function
 * @param {Object} Obj - Objet à cliquer, s'il n'est pas existant alors ignore le click
 * @param {number} [X=-1] - Position X du click depuis le bord gauche de l'objet, s'il est non défini ou défini à <b>-1</b> alors prend le milieu
 * @param {number} [Y=-1] - Position Y du click depuis le bord haut de l'objet, s'il est non défini ou défini à <b>-1</b> alors prend le milieu
 * @param {number} [Wait=200] - Durée en ms de l'appui sur le bouton gauche, la durée du relâchement est celle de l'appui / 2. Si elle n'est pas définie alors prend 200ms comme durée d'appui
 * @param {number} [Repeat=1] - Nombre de click à jouer. S'il n'est pas défini alors n'effectue qu'un clic
 */
function clickInObject(Obj, X = -1, Y = -1, Wait = 200, Repeat = 1) {
  if ((Obj == undefined) || (Obj == null) || ((Obj != null) && (!Obj.Exists)))
    return;
  X  = X == -1 ? Obj.Width >> 1 : X;
  Y  = Y == -1 ? Obj.Height >> 1 : Y;
  Xr = Obj.ScreenLeft + X;
  Yr = Obj.ScreenTop + Y;
  if (system.debug)
    Log.Message("clickInObject(Obj, " + X.toString() + ", " + Y.toString() + ", " + Wait.toString() + ", " + Repeat.toString() + ") - Click Low Level", "X reel = " + Xr.toString() + ", Y reel = " + Yr.toString() , pmLowest, system.logDebug);
  // Check if Indicator need to be hide 
  // if ...
  //   Indicator.Hide();
  for (let loop = 0; loop < Repeat; loop++) {
    LLPlayer.MouseDown(MK_LBUTTON, Xr, Yr, Wait);
    LLPlayer.MouseUp(MK_LBUTTON, Xr, Yr, Wait >> 1);
    aqUtils.Delay(100);
  }  
  // If Indicator was hidden, show it again
  Indicator.Show();
}

 

 

.

 

 

 

  • BenoitB's avatar
    BenoitB
    5 years ago

    Indicator is very useful.

    But as we cannot change it position it can be problematic (top right level is mainly the place for profile access in lot of webapps for example).

    Don't want to hide it everytime i call the click routine because it can make you blink a lot depending on your clicks.

    So i'll add it in the features wanted list and i keep simple coordinates test until it would be done

     

      if ((Yr < 350) && (Xr > (Sys.Desktop.Width - 400)))
        Indicator.Hide();

    Txs for confirming me there is no way to have object info on it.

     

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      No need to engage support in this case. ;-) 

      There's no way to adjust the size or position of the indicator.  What you are doing (calling the Hide() and Show() methods on the indicator object) is the best and only way currently to do what you want.  My suggestion would be to simply ALWAYS hide it when you're in that routine.  There's no real reason for it to be visible at that point and you're not hurting execution by doing so.


      • Marsha_R's avatar
        Marsha_R
        Moderator

        Support can still help if you do want to only hide it when you're dealing with that portion of the screen.  I understand that you may want it on in all other cases.