mIRC Home    About    Download    Register    News    Help

Topic Options
#263973 - 16/10/18 06:10 PM /findtext v Ctrl-F pop-up
Erasimus Offline
Ameglian cow

Registered: 26/04/18
Posts: 34
Sorry about this but I took something literally; then it made me think ..

from the mIRC.chm file
/findtext -n <text>
This searches active window for the specified text (same as Control+F).

In fact it isn't the same. Ctrl-F pops up a dialog box that you can fill in, while /findtext has to be programmed.

My question is why bother ?
Why cant we just call the pre-existing pop-up ?

Is there any way to do this ?

Top
#263974 - 16/10/18 06:23 PM Re: /findtext v Ctrl-F pop-up [Re: Erasimus]
westor Offline
Hoopy frood

Registered: 27/12/08
Posts: 1510
Loc: Greece
/findtext is for scripting puproses however you can use CTRL+F to open the search box directly, the only way to open the search box with command is with "sendkeys" (mirc addon)

Addon link: here

Example: /sendkeys ^f

- Thanks!
_________________________
Need Online mIRC help or an mIRC Scripting Freelancer? -> http://westor.ucoz.com/contact <-

Top
#263976 - 16/10/18 07:18 PM Re: /findtext v Ctrl-F pop-up [Re: westor]
Erasimus Offline
Ameglian cow

Registered: 26/04/18
Posts: 34
Thanks I downloaded it and will have a look at it.

I still think that it should be accessible from a script since it is already there as part of mIRC.

Just for reference I tried a simple alias -
Alias SearchText {
/findtext $input(Text to search for :, e)
}

This works ok, but if you click on the cancel button you get an error -
* /findtext: insufficient parameters (line nn, script name)

Tried it with CTRL-F - no error when you hit cancel.


I'll try out the script you pointed out though.


Edited by Erasimus (16/10/18 07:39 PM)

Top
#263982 - 17/10/18 09:47 PM Re: /findtext v Ctrl-F pop-up [Re: Erasimus]
hixxy Offline
Hoopy frood

Registered: 06/09/05
Posts: 2876
Change $input to $$input and you won’t get an error when you hit cancel.

Top
#263983 - 18/10/18 04:55 AM Re: /findtext v Ctrl-F pop-up [Re: hixxy]
Erasimus Offline
Ameglian cow

Registered: 26/04/18
Posts: 34
Thanks for that - good to know.

That was a quick thought off the top of my head, and I wasn't really serious about it. I looked at the script I was 'pointed to' but it was a bit of a cludge.

Instead I decided to re-invent the wheel .. so
Code:
; add the following items into all popup sections
menu * {
  -
  Find Text in current window:/dialog -m SearchInActive SearchInActive
}

; Add the selected ( $1 ) item to the front of the list if it isn't 
; already in there then, if we have reached 7 items in the list delete
; the 7th to keep the list to only 6 items

Alias -l UpdateSearchList {
  var %localitem = $1
  var %NewTexts = %SearchTexts
  if (%SearchTexts == $null) { %NewTexts = %localitem }
  else {
    if ($istok(%NewTexts,%localitem,44)) { %NewTexts = %SearchTexts }
    else { %NewTexts = $instok(%NewTexts,%localitem, 1, 44) }
  }
  if ($gettok(%NewTexts,0,44) == 7) { %NewTexts = $deltok(%NewTexts,-1,44) } 
  Return %NewTexts
}

; -------------------------------------------------
; search for text in current/active window dialogue
; -------------------------------------------------

dialog SearchInActive {
  title "Find Text"
  size -1 -1 168 62
  option dbu
  text "Find Text:", 10, 12 15 28 10
  combo 20, 42 14 80 10, drop, edit
  button "Up" 30, 128 14 38 12
  button "Down" 40, 128 30 38 12
  button "Cancel" 50, 128 46 38 12, cancel
}

; Up button clicked
on *:dialog:SearchInActive:sclick:30: {
  var %SearchItem = $did($dname, 20, 0).text
  %SearchTexts = $UpdateSearchList(%SearchItem)
  /findtext %SearchItem
}

; Down button clicked
on *:dialog:SearchInActive:sclick:40: {
  var %SearchItem = $did($dname, 20, 0).text
  %SearchTexts = $UpdateSearchList(%SearchItem)
  /findtext -n %SearchItem
}

; SearchInActive Dialogue initialisation
on *:dialog:SearchInActive:init:0:{
  didtok $dname 20 44 %SearchTexts
  ; did -c $dname 20 1
}


It works, and looks, pretty much like the CTRL-F dialogue, except for the fact that I don't know how to remove the mIRC icon in the dialog title bar.

I limited the combo drop down list to only storing 6 items in the list, but that can be easily changed (2nd last line in the alias).

In the end it was easier to do this, and no I didn't use any dialog design tool.
Now do I need to replace another wheel ? smile

Top