mIRC Home    About    Download    Register    News    Help

Print Thread
#263973 16/10/18 05:10 PM
Joined: Apr 2018
Posts: 83
E
Babel fish
OP Offline
Babel fish
E
Joined: Apr 2018
Posts: 83
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 ?

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
/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? -> https://irc.chathub.org <-
Joined: Apr 2018
Posts: 83
E
Babel fish
OP Offline
Babel fish
E
Joined: Apr 2018
Posts: 83
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.

Last edited by Erasimus; 16/10/18 06:39 PM.
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Change $input to $$input and you won’t get an error when you hit cancel.

Joined: Apr 2018
Posts: 83
E
Babel fish
OP Offline
Babel fish
E
Joined: Apr 2018
Posts: 83
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


Link Copied to Clipboard