|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
Why is it that sometimes, $did(1,seltext) only works and sometimes $did(1).seltext only works? Why is this so?
|
|
|
|
Joined: Dec 2002
Posts: 774
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 774 |
give us a example of each situation?
and we might be able to find out?
//if ( khaled isgod ) echo yes | else echo no
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
Can't give any example. $did(1).seltext works sometimes and sometimes $did(1,seltext) works. I am wondering about this inconsistency.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
I've never used or seen used $did(n,seltext). I couldn't get it to work in any situation when I gave it a quick test just now. If you were using it to test the selected text in an editbox then that parameter is invalid and so mIRC reads it simply as $did(n), which returns the full text of the editbox. Besides that I can't see any way where that identifier would even appear to do anything.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
Sometimes, $did(6).seltext works in some situations but $did(6,seltext) works in some situation, its very strange..
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
heres a sample dialog for u to check...
on *:dialog:cppp:close:*:{ if ($did(8,seltext) == $null) { set %bdisable o } } dialog cppp { title "Control Panel" size -1 -1 230 128 option dbu tab "Tab 1", 1, -3 -14 245 148 text "Welcome to the Control Panel of TrenzTerra Tornado! Check out the links on the right side and you can adjust settings according to what you want. Have fun.", 5, 5 4 164 112, tab 1 tab "aj", 2 box "Web browser", 6, 1 1 176 34, tab 2 button "Browse", 7, 144 13 30 10, tab 2 edit %browser, 8, 3 13 141 10, tab 2 autohs check "Use mIRC Default", 9, 57 25 53 9, tab 2 box "Warnings for opening URL:", 10, 1 39 176 33, tab 2 check "Any URL", 11, 4 49 50 10, tab 2 check "URLs that ends with extensions commonly used to spread viruses", 12, 4 60 171 10, tab 2 tab "Tab 3", 13 list 14, 2 3 50 50, tab 13 size box "Information", 15, 53 1 124 40, tab 13 text "Server:", 16, 58 11 20 8, tab 13 edit "", 17, 78 10 97 10, tab 13 read autohs check "", 18, 99 22 7 10, disable tab 13 text "All Servers", 19, 108 23 31 8, tab 13 button "Remove Channel", 20, 88 43 47 10, tab 13 box "Add a channel", 21, 2 55 175 69, tab 13 text "Channel: #", 22, 6 67 28 8, tab 13 edit "", 23, 34 66 140 10, tab 13 autohs text "Server:", 24, 6 77 20 8, tab 13 edit "", 25, 27 76 146 10, tab 13 autohs check "All Servers", 26, 72 88 37 10, tab 13 text "(seperate servers with space)", 27, 50 98 74 8, tab 13 button "Add Channel", 28, 70 110 41 10, tab 13 box "Navigation", 4, 178 1 52 123 list 3, 179 10 50 112, size } on *:dialog:cppp:sclick:9:{ if ($did(9).state == 1) { did -m cppp 8 | set %bdisable o } else { did -n cppp 8 | set %bdisable b } } on *:dialog:cppp:sclick:11:{ if ($did(11).state == 1) { set %allurl on | did -b cppp 12 } else { set %allurl off | did -e cppp 12 } } on *:dialog:cppp:sclick:12:{ if ($did(12).state == 1) { set %haurl on } else { set %haurl off } } on *:dialog:cppp:sclick:7:{ set %browser $$file="Choose the internet browser:" $mircdir\*.* did -ra cppp 8 %browser if ($did(9).state == 1) { did -n cppp 8 | set %bdisable b | did -u cppp 8 }
} on *:dialog:cppp:edit:8:{ set %browser $did(8,seltext) } on *:dialog:cppp:sclick:20:{ var %theid = $did(14).sel rexecute $did(14).seltext did -r cppp 14 var %aj = 1 while (%aj <= $lines(store\aj.txt)) { if ($chr(60) != $left($read(store\aj.txt,%aj),1)) && ($chr(62) != $left($read(store\aj.txt,%aj),1)) { did -a cppp 14 $read(store\aj.txt,%aj) inc %aj } else { inc %aj } } if ($did(14,%theid).text != $null) { did -c cppp 14 %theid | dexecute $did(14,%theid).text } elseif ($did(14, $calc(%theid - 1)).text != $null) { did -cf cppp 14 $calc(%theid - 1) | dexecute $did(14,$calc(%theid - 1)).text } elseif ($did(14, 1).text != $null) { did -cf cppp 14 | dexecute $did(14,1).text } else { did -r cppp 25 } } alias lexecute {
did -ra autoj 7 Update! var %cj2 = $1- var %cj = 1 while (%cj <= $lines(store\aj.txt)) { if (%cj2 == $read(store\aj.txt,%cj)) { if ($read(store\aj.txt,$calc(%cj + 2)) == >a) { did -c cppp 18 | did -m cppp 12 } did -ra cppp 23 $right($read(store\aj.txt,%cj),$calc($len($read(store\aj.txt,%cj)) - 1)) did -ra cppp 25 $right($read(store\aj.txt,$calc(%cj + 1)),$calc($len($read(store\aj.txt,$calc(%cj + 1))) - 1)) return
} else { inc %cj } } } alias dexecute { var %cj2 = $1- var %cj = 1 while (%cj <= $lines(store\aj.txt)) { if (%cj2 == $read(store\aj.txt,%cj)) {
did -ra cppp 17 $right($read(store\aj.txt,$calc(%cj + 1)),$calc($len($read(store\aj.txt,$calc(%cj + 1))) - 1))
if ($read(store\aj.txt,$calc(%cj + 2)) == >a) { did -c cppp 18 } else { did -u cppp 18 } return } else { inc %cj } } } alias rexecute { var %cj2 = $1- var %cj = 1 while (%cj <= $lines(store\aj.txt)) { if (%cj2 == $read(store\aj.txt,%cj)) { write -dl [ $+ [ %cj ] ] store\aj.txt write -dl [ $+ [ %cj ] ] store\aj.txt write -dl [ $+ [ %cj ] ] store\aj.txt
} else { inc %cj } } } dialog browser { title "Browser links" size -1 -1 174 72 option dbu box "Web Browser", 1, 0 2 173 33 edit %browser, 2, 2 10 144 10, autohs button "Browse", 3, 146 10 24 10 check "Use mIRC Default", 4, 63 21 55 10 check "URLs that ends with extensions commonly used to spread viruses", 7, 2 58 167 10 check "Any URL", 6, 2 47 31 10 box "Warnings for opening URLs", 8, 0 35 173 37 }
on *:dialog:browser:edit:2:{ set %browser $did(2).seltext } on *:dialog:browser:sclick:3:{ set %browser $$file="Choose the internet browser:" $mircdir\*.* did -ra browser 2 %browser if ($did(4).state == 1) { did -n browser 2 | set %bdisable b | did -u browser 4 } } on *:dialog:browser:sclick:7:{ if ($did(7).state == 1) { set %haurl on } else { set %haurl off } } on *:DIALOG:browser:sclick:6:{ if ($did(6).state == 1) { set %allurl on | did -b browser 7 } else { set %allurl off | did -e browser 7 }
} on *:dialog:browser:sclick:4:{ if ($did(4).state == 1) { did -m browser 2 | set %bdisable o } else { did -n browser 2 | set %bdisable b }
} on *:dialog:browser:init:*:{ if (%bdisable == o) { did -c browser 4 | did -m browser 2 } if (%haurl == on) { did -c browser 7 } if (%allurl == on) { did -c browser 6 | did -b browser 7 } }
on *:dialog:cppp:sclick:28:{ var %theid = $did(14).sel
write store\aj.txt $chr(35) $+ $did(23,seltext) write store\aj.txt < $+ $did(25,seltext) if ($did(26).state == 1) { write store\aj.txt >a } else { write store\aj.txt >b } did -r cppp 14 var %aj = 1 while (%aj <= $lines(store\aj.txt)) { if ($chr(60) != $left($read(store\aj.txt,%aj),1)) && ($chr(62) != $left($read(store\aj.txt,%aj),1)) { did -a cppp 14 $read(store\aj.txt,%aj) inc %aj } else { inc %aj } } if (%theid != $null) { did -fc cppp 14 %theid | dexecute $did(14).seltext } elseif ($did(14).lines == 1) { did -cf cppp 14 1 | dexecute $did(14).seltext } }
on *:dialog:cppp:init:0:{ if (%bdisable == o) { did -c cppp 9 | did -m cppp 8 } if (%haurl == on) { did -c cppp 12 } if (%allurl == on) { did -c cppp 11 | did -b cppp 12 } did -az cppp 3 Welcome did -az cppp 3 Browser Links did -az cppp 3 Auto join var %aj = 1 while (%aj <= $lines(store\aj.txt)) { if ($chr(60) != $left($read(store\aj.txt,%aj),1)) && ($chr(62) != $left($read(store\aj.txt,%aj),1)) { did -a cppp 14 $read(store\aj.txt,%aj) inc %aj } else { inc %aj } } } on *:dialog:cppp:sclick:14:{ dexecute $did(14).seltext } on *:dialog:cppp:sclick:3:{
if ($did(3).seltext == Auto join) { did -fu cppp 13 did -f cppp 3 } if ($did(3).seltext == Browser Links) { did -fu cppp 2 did -f cppp 3 } if ($did(3).seltext == Welcome) { did -fu cppp 1 did -f cppp 3 } }
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
I didn't use the whole code since it had a lot of code that wasn't necessary to test, I just used the on close event and the dialog table definition. It worked in the way I described in my previous post, the $did(8,seltext) was treated as if it was just $did(8) (not a bug), then when I switched it to $did(8).seltext it worked correctly.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Dec 2002
Posts: 196
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 196 |
Strange, it didn't work for me. Anyone know why?
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Hmm.. better just make sure you understand what the .seltext property is for: It is to return the text in a given ID which has been selected (highlighted). eg. dialog blah {
option dbu
size -1 -1 120 80
edit "Hello", 1, 10 10 100 10
}
on *:dialog:blah:close:*:if ($did(1)) echo -a Text: $+(04,$ifmatch,,$chr(44)) Selected text: $+(12,$did(1).seltext) If you just open the dialog with /dialog -m blah blah and then close it again it will simply return: Text: Hello, Selected text: Now open it again, select some of the text and close it and you'll get something like: Text: Hello, Selected text: ellIf you change the $did(1).seltext in the code to $did(1,seltext) you'll see that both parts will always return the same value. Your dialog code might not work, I didn't check through it for errors. But I can say that I'm confident that $did( n, seltext) will never behave like $did( n).seltext does and that $did( n).seltext will always return correctly for selected text.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
|