mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
#1 Horizontal Bar is not working in the script

#2 I want to know if theres a method where when I do the "Edit, Replace" function and type in something in the Find What box that it will search the dialog and highlight the first word in question. Basically right now I wrote it to only go to the line in question in the dialog but thats it.

here is the script just as I see it no edits

Code:
dialog notepad {
  title "Notepad Editor for IRC"
  size -1 -1 181 197
  option dbu
  edit "", 1, 0 10 181 189, multi return autohs autovs hsbar vsbar
  edit "", 4, 80 0 56 10
  text "Filename:", 5, 55 1 24 8
  menu "File", 8
  item "Open", 14, 8
  item "Close", 13, 8
  item "Save", 15, 8
  item "Save As", 16, 8
  menu "Edit", 9
  item "Replace", 10, 9
  item "Copy (Ctrl + C)", 11, 9
  item "Paste (Ctrl + V)", 12, 9
  menu "Help", 6
  item "About", 7, 6
}


on *:DIALOG:notepad:init:0:{
  .timer 1 0 /hackstyle $dname -1 -1 182 200
  did -a $dname 1 Click Open File to open any readable text format such has txt wpd etc..
}

on *:dialog:notepad:menu:7:{
  echo -a Feature not available yet
}

on *:dialog:notepad:menu:10:{
  dialog -m replace replace
  var %num = 1
  while (%num <= $did($dname,1).lines) {
    write temp.txt $did($dname,1,%num).text $crlf
    inc %num
  }
}

on *:dialog:notepad:menu:13:{
  dialog -x notepad
}

on *:dialog:notepad:menu:14:{
  did -r $dname 1
  var %nsel = $sfile(C:\) , %num = 1
  did -ra $dname 4 $nopath(%nsel)
  while (%num <= $lines(%nsel)) {
    did -a $dname 1 $read(%nsel,%num) $crlf
    inc %num
  }
}

on *:dialog:notepad:menu:15:{
  var %num = 1 , %ndir = $sdir(C:\)
  if ($did($dname,4).edited == $true) { var %nedit = $did($dname,4).text 
    while (%num <= $did($dname,1).lines) {
      write -a $+(%ndir,%nedit) $did($dname,1,%num) $crlf
      inc %num
    }
  }
}

on *:Dialog:notepad:menu:16:{
  echo -a This has no function as of yet.
}

dialog replace {
  title "Replace (notepad)"
  size -1 -1 155 65
  option dbu
  edit "", 1, 42 4 65 10
  edit "", 2, 42 16 65 10
  text "Find What:", 3, 6 5 27 8
  text "Replace With:", 4, 6 17 35 8
  box "", 5, 2 -2 110 35
  box "", 6, 113 -2 40 66
  box "", 7, 115 0 36 62
  button "Find Next", 8, 117 5 32 12, disable flat
  button "Replace", 9, 117 19 32 12, flat
  button "Replace All", 10, 117 33 32 12, flat
  button "Cancel", 11, 117 47 32 12, flat
  box "", 12, 2 31 110 33
  text "This Script is purely Beta I hold no responsibility to damaged files during replace token. This is intetionally meant to edit mIRC scripts or documents.", 13, 3 35 107 27
}

alias xrep { return $read(temp.txt,w,* $+ $did(replace,1).text $+ *,$1) }

on *:dialog:replace:sclick:8:{
  did -c notepad 1 $didwm(notepad,1,* $+ $did($dname,1).text $+ *)
}

on *:dialog:replace:sclick:9:{
  did -r notepad 1
  if ($did($dname,1).edited) && ($did($dname,2).edited) {
    var %rep = $xrep(1) , %num = 1
    write -l $+ $readn temp.txt $replace($xrep(1),$did($dname,1),$did($dname,2).text)
    while (%num <= $lines(temp.txt)) {    
      did -a notepad 1 $read(temp.txt,%num) $crlf
      inc %num
    }
    dialog -x $dname
    remove temp.txt
    clear -s
  }
  else { echo -a Sorry you have NOT entered any information for me to replace or find }
}

on *:dialog:replace:sclick:10:{
  did -r notepad 1
  if ($did($dname,1).edited) && ($did($dname,2).edited) {  
    :START    
    if (!$xrep(1)) {
      goto END
    }
    else {
      var %rep = $xrep(1) , %num = 1
      write -l $+ $readn temp.txt $replace($xrep(1),$did($dname,1),$did($dname,2).text)
      goto START
      :END
      while (%num <= $lines(temp.txt)) {    
        did -a notepad 1 $read(temp.txt,%num) $crlf
        inc %num
      }
      remove temp.txt
      dialog -x $dname
      clear -s
    }
  }
  else { echo -a Sorry you have NOT entered any information for me to replace }
}

on *:dialog:replace:sclick:11:{
  dialog -x replace
}

on *:dialog:replace:close:0:{
  remove temp.txt
  clear -s
}

alias hackstyle {
  set %xra 1
  while (%xra <= $5) {
    .dialog -srb $1 $2 $3 $4 %xra
    inc %xra
  }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Dec 2002
Posts: 417
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
The problem is in the Scroll dialog window. The hackstyle
will not let you scroll unless you have the dialog set for -m
If the dialog is set for -m then you can't get the window to
scroll when it opens


alias hackstyle {
set %xra 1
while (%xra <= $5) {
.dialog -srb $1 $2 $3 $4 %xra
inc %xra
}
}




Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline OP
Hoopy frood
OP Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
good catch I forgot about that, thanks

what about:

#2 I want to know if theres a method where when I do the "Edit, Replace" function and type in something in the Find What box that it will search the dialog and highlight the first word in question. Basically right now I wrote it to only go to the line in question in the dialog but thats it.


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Help file:

You can select a range of text in an editbox using /did -c name id [n] [start [end]]. This selects line N in editbox, and sets selection to specified range of characters.

So, you get the line number with $didwm(); from this, you can get the line content; then you use $pos(line content,search string) to determine the <start> parameter in /did -c; $calc($pos(line content,search string) + $len(search string)) is your <end> parameter.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard