|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
This is way beyond me. Is there anyone who knows of a way to make a $regex() pattern that matches any timestamp, I've coded something similar to the Confirm Paste $input(). Only it's dialloged and can be called from the F1 function key. I have decided to add an options tab to strip incoming $timestamps. As you know timestamps can be like: [15:05:59] [15:05:59 PM] [3:59] ..::15:05:59::.. ..::15:05:59 PM::.. ..::3:59::.. Here's a few screenshots of just what I'm doing: 1 2 3I'd also like to know what sort of options I should add. These are the following I have thought about. - Strip $timestamp from lines of text.
- Add a timer to delay the display of text.
- By default the check boxes are checked, so an option to make them unchecked by default.
Thanks. Edit: If someone comes up with a solution I'll use that but for now I've changed it to remove default $timestamp [17:10] using if ($+([,*:*,]) iswm $1-) which is all I use anyway, still any help is much appreciated. -Andy
|
|
|
|
Joined: Oct 2005
Posts: 1,741
Hoopy frood
|
Hoopy frood
Joined: Oct 2005
Posts: 1,741 |
I don't think there is any universal way to tell if something is a timestamp or not. If it is one of your own timestamps, and it is the same as your current timestamp format, you can use this code:
alias istimestamp {
var %stf = /^ $+ $replacex($timestampfmt,dddd,\w+,ddd,\w+,dd,\d\d,d,\d?\d,mmmm,\w+, $&
mmm,\w+,mm,\d\d,m,\d?\d,yyyy,\d\d\d\d,yy,\d\d,hh,\d\d,h,\d?\d,nn,\d\d,n,\d?\d,ss,\d\d, $&
s,\d?\d,tt,[ap]m,t,[ap],o,\w\w,zzz,\+\d\d\d\d\sgmt,zz,\+\d\d\d\d,z,\+\d\d?\d?\d?) $+ $/ig
return $regex(,$1,%stf)
}
(not tested for all possible timestamp formats) Usage: //echo -a $istimestamp([6:08:30p]) would echo "1" if your local timestamp format was [h:nn:sst] . You will probably using something like: if ($istimestamp($gettok(%text,1,32))) %text = $deltok(%text,1,32) -genius_at_work
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Hey man, thanks for that. But I decided to go with:
alias istimestamp {
if ($+([,*:*,]) iswm $gettok($1,1,32)) return $gettok($1-,2-,32)
}
May not have been the best away around it, but it was a tiny bit easier for me. I may take another stab at your code tomorrow when I am more awake. If anyone is interested here's the code:
;
;Credits: {
; Matt: Testing, Being a great friend
; genuius_at_work: Hard work and effort in an identifier I decided not to go with.
; Khaled: mIRC, Arnie, mIRC and uh... mIRC?
;}
On *:Load: {
if ($version < 6.17) {
echo -a We're sorry this Paste Utilities addon only works with mIRC 6.17 referring you to download...
echo -a To download click save, to exit click cancel.
url -n http://www.gone.se/mirc/mirc617.exe
.unload -rs $+(",$script,")
}
else {
echo -a Welcome to the Paste Utilities addon, if your F1 key is in use by a different command type /cp.
echo -a Here you can view the lines of text in your clip board and select the ones you want to paste.
echo -a You can choose how you'd like to paste whether it's echo to yourself or display to the active window.
echo -a This addon was coded by SladeKraven (Andy) and tested by Dr|Cameron/Oxedizer (Matt)
}
}
menu channel {
Paste: {
f1
}
}
dialog cp {
title "SladeKraven's Paste Utilities V1.1"
size -1 -1 181 114
option dbu
tab " Paste Utilities ", 7, 0 -2 183 116
text "", 3, 26 14 142 14, tab 7
list 2, 25 29 144 65, size check tab 7
button "Yes", 4, 52 97 37 12, tab 7
button "No", 5, 95 97 37 12, cancel tab 7
check "Select Result", 6, 137 98 50 10, 3state tab7
tab " Options ", 8
box "Paste Utilities Options", 12, 39 15 109 37, tab 8
check "Strip default $timestamp.", 13, 44 22 96 10, tab 8
check "Add timer to delay the display of text.", 14, 44 31 102 10, tab 8
check "Check Boxes On by default.", 15, 44 40 88 10, tab 8
tab " About ", 9
text "The Paste Utilities addon basically evolved from mIRC's built in Confirm Paste feature. This is completely different because you don't need to paste anything to open the dialog as it's called from F1 which can be changed if you want.", 10, 3 16 180 27, tab 9
text "When anything is in your clipboard you can hit the Function Key to display the lines of text. This is meant for mIRC versions 6.17 and up because it uses mIRC's new check property for the listbox control. This is so you can check or uncheck the lines of text you wish to display either by msg or echo.", 11, 3 46 180 34, tab 9
}
On *:Dialog:cp:*:*: {
if ($devent == close) {
unset %cp.method
}
if ($devent == init) {
if (%cp.strip == 1) did -c $dname 13
if (%cp.timer == 1) did -c $dname 14
if (%cp.default == 1) did -c $dname 15
did -a $dname 3 Are you sure you want to paste $iif($cb(0),$cb(0),0) line(s) of text into this window?
var %x = 1
while (%x <= $cb(0)) {
did -a $dname 2 $cb(%x)
if (%cp.default == 1) did -s $dname 2 %x
inc %x
}
}
if ($devent == sclick) {
if ($did == 4) {
var %x = 1
while (%x <= $did($dname,2,0).csel) {
if (%cp.method) {
if (%cp.method == 1) {
if (%cp.strip == 1) $iif(%cp.timer == 1,.timer 1 %x) echo -a $istimestamp($did($dname,2,%x))
else { $iif(%cp.timer == 1,.timer 1 %x) echo -a $did($dname,2,%x) }
}
else {
if (%cp.strip == 1) $iif(%cp.timer == 1,.timer 1 %x) msg $active $istimestamp($did($dname,2,%x))
else { $iif(%cp.timer == 1,.timer 1 %x) msg $active $did($dname,2,%x) }
}
}
inc %x
}
}
if ($did == 6) {
if ($did($dname,6).state == 0) unset %cp.method
elseif ($did($dname,6).state != 0) set %cp.method $did($dname,6).state
did -a $dname 6 $iif($did($dname,6).state == 1,Echo,$iif($did($dname,6).state != 0,MSG,Select)) Result
}
if ($did == 13) { set %cp.strip $iif($did($dname,$did).state == 1,1,0) }
if ($did == 14) { set %cp.timer $iif($did($dname,$did).state == 1,1,0) }
if ($did == 15) { set %cp.default $iif($did($dname,$did).state == 1,1,0) }
}
}
alias f1 {
if (!$dialog(cp)) dialog -dm cp cp
}
alias istimestamp {
if ($+([,*:*,]) iswm $gettok($1,1,32)) return $gettok($1-,2-,32)
else { return $1- }
}
-Andy
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
You could use /play instead of the timers
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
OP
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Isn't that command meant for delaying files to targets?
-Andy
|
|
|
|
Joined: Jul 2003
Posts: 655
Fjord artisan
|
Fjord artisan
Joined: Jul 2003
Posts: 655 |
Glancing through your code it seems you use a while loop with increasing timers, something like dumping the 'new' clipboard to a hidden window and using /play to play it to the targat seems a better choice here (again at a glance without testing any of the code), was just a thought as i read your post
"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
|
|
|
|
|