mIRC Home    About    Download    Register    News    Help

Print Thread
export/import notifies ? #135058 07/11/05 12:21 PM
Joined: Mar 2005
Posts: 27
N
Name141 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2005
Posts: 27
anyway to export import notifies? from script to script? only place i found them are in mirc.ini. In which i pasted the new [notifes]
n1 = etc..
n2 = etc..

in the new scripts mirc.ini. but soon as i opened the new mirc.exe the .ini is overwriten with the old data and the notifies aren't there.

Re: export/import notifies ? #135059 07/11/05 07:19 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Not that I know of but you can easily script it. smile

Code:
alias notify.import {
  var %file = $$sfile("s")
  var %x = 1
  echo -a Importing the following nicknames:
  while (%x <= $lines(%file)) {
    echo -a $read(%file,%x)    
    notify $read(%file,%x)
    inc %x
  }
}

alias notify.export {
  var %x = 1 
  var %file = $$1
  echo -a Exporting the following nicknames:
  while (%x <= $ini(mirc.ini,notify,0)) {
    write %file $readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)))
    echo -a $readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)))
    inc %x
  }
}


/notify.export writes to the file you choose.

example:

/notify.export

You can have any filename and any extension.

notify.not would work
somefile.txt would also work.

/notify.import

This command adds all nicknames to notify list in a file you choose, so make sure it's an export file instead of a code file otherwise your going to try adding code to your notify list.

Here's the notify import/export code implemented in my notify system, it may gfive you some ideas on maybe to create your own. smile

Code:
menu menubar {
  notify:dialog -dm notify notify
}

dialog notify {
  title "notify List"
  size -1 -1 115 167
  option dbu
  list 2, 3 11 51 50, size sort
  list 4, 60 11 51 50, size sort
  text "Online:                        Offline:", 5, 18 2 83 7
  button "Add", 6, 18 138 37 12
  button "Rem", 7, 59 138 37 12
  button "Close", 8, 39 156 37 8
  button "Import..", 16, 1 156 37 8
  button "Export..", 17, 77 156 37 8  
  list 10, 36 81 51 50, size sort
  text "Total notify nicks:", 11, 36 71 52 7
  menu "File", 12
  item "Exit", 13, 12
  menu "Prefrences", 14
  item "Options", 15, 14
}

on 1:dialog:notify:menu:13: {
  dialog -x notify notify
}

on 1:dialog:notify:menu:15: {
  dialog -dmo notify.opt notify.opt
}


On ^*:notify: {
  if ($isfile(C:\WINDOWS\Media\ringout.wav) && $readini(notify.ini, Options,sounds) == on) {
    splay C:\WINDOWS\Media\ringout.wav
    .timer 1 2 splay C:\WINDOWS\Media\ringout.wav
  }
  if ($readini(notify.ini, Options,notifymsg) == on) {
    if (%notify.msg) { 
      msg $nick %notify.msg 
    }
    else { 
      msg $nick Helloooooooo $nick $+ , how are you? 
    }
  }
  if ($readini(notify.ini, Options,notifynotice) == on) {
    if (%notify.notice) { 
      notice $nick %notify.notice 
    }
    else { 
      notice $nick Helloooooooo $nick $+ , how are you?
    }
  }
  if ($dialog(notify)) { 
    echo 7 -as *** notify: $+($chr(2),$nick,$chr(2)) is online!
    .dialog -x notify notify
    .timer 1 1 echo -a *** notify: Refreshing notify list.
    .timer 1 2 dialog -dm notify notify
  }
  else {
    echo -a echo 7 -as *** notify: $+($chr(2),$nick,$chr(2)) is online!
  } 
  haltdef
}

On ^*:Unotify: {
  if ($isfile(C:\WINDOWS\Media\notify.wav) && $readini(notify.ini, Options,sounds) == on) {
    splay C:\WINDOWS\Media\notify.wav
  }
  if ($dialog(notify)) { 
    echo 7 -as *** notify: $+($chr(2),$nick,$chr(2)) is offline!
    .dialog -x notify notify
    .timer 1 1 echo -a *** notify: Refreshing notify list.
    .timer 1 3 dialog -dm notify notify
  }
  else { 
    echo 7 -as *** notify: $+($chr(2),$nick,$chr(2)) is offline!
  }
  haltdef
}

alias notify.status {
  var %x = $notify(0).ison
  while (%x) {
    if ($dialog(notify)) {
      if ($notify(%x).ison == $true) { 
        did -a notify 2 $notify(%x)
      }
      if ($notify(%x).ison == $false) { 
        did -a notify 4 $notify(%x)
      }
    }
    dec %x
  }
}

alias notify.all {
  var %x = $notify(0)
  while (%x) {
    if ($dialog(notify)) {
      did -a notify 10 $notify(%x) 
      did -a notify 11 Total notify nicks: $notify(%x) 
    } 
    dec %x
  }
  did -a notify 11 Total notify nicks: $notify(%x) 
}

on 1:dialog:notify:sclick:6: {
  set %notify.add $$?="Enter nickname"
  if (!$didwm(notify,10,%notify.add)) {
    echo -a *** notify: Added $+($chr(2),%notify.add,$chr(2)) to notify list!
    .notify %notify.add
    dialog -x notify notify
    .timer 1 1 echo -a *** notify: Refreshing notify list.
    .timer 1 3 dialog -dm notify notify
  }
}

on 1:dialog:notify:sclick:7: {
  did -d notify 10 $didwm(notify,10,%notify.sel)
  echo -a *** notify: Removed $+($chr(2),%notify.sel,$chr(2)) from notify list!
  .notify -r %notify.sel
  did -b notify 7
  dialog -x notify notify
  .timer 1 1 echo -a *** notify: Refreshing notify list.
  .timer 1 3 dialog -dm notify notify
}

on 1:dialog:notify:sclick:8: {
  dialog -x notify notify 
}

on 1:dialog:notify:sclick:10: { 
  set %notify.sel $did(10,$did(10).sel)
  did -e notify 7
}

on 1:dialog:notify:dclick:10: {
  if ($readini(notify.ini, Options,whois) == on) {
    whois %notify.sel
  }
  if ($readini(notify.ini, Options,query) == on) {
    query %notify.sel
  }
  if ($readini(notify.ini, Options,msg) == on) {
    if (%notify.msg) { 
      msg %notify.sel %notify.msg 
    }
    else {
      msg %notify.sel Helloooooooo %notify.sel $+ , how are you?
    }
  }
  if ($readini(notify.ini, Options,notice) == on) {
    if (%notify.notice) { 
      notice %notify.sel %notify.notice 
    }
    else { 
      notice %notify.sel Helloooooooo %notify.sel $+ , how are you?
    }
  }
}

On *:Dialog:notify:sclick:16: {
  notify.import
}

On *:Dialog:notify:sclick:17: {
  notify.export
}

on 1:dialog:notify:init:0: {
  did -b notify 7
  did -r notify 11
  notify.status
  notify.all
}

dialog notify.opt {
  title "notify Options"
  size -1 -1 133 107
  option dbu
  check "Play sounds", 1, 5 8 50 10
  box "Double a nickname in notify dialog", 2, 2 42 130 47
  check "Whois User", 3, 5 48 39 10
  check "Query User", 4, 5 58 39 10
  check "MSG User", 5, 5 67 39 10
  check "Notice User", 6, 5 76 39 10
  edit "", 7, 44 76 84 9
  edit "", 8, 44 67 84 9
  button "Save / Exit", 9, 43 92 37 12
  check "MSG User", 10, 5 18 39 10
  check "Notice User", 11, 5 28 39 10
  box "On notify", 12, 2 2 130 38
}

On 1:dialog:notify.opt:sclick:1: {
  if ($did($dname,1).state == 1) { 
    writeini notify.ini options sounds on 
  }
  else { 
    writeini notify.ini options sounds off
  }
}

On 1:dialog:notify.opt:sclick:3: {
  if ($did($dname,3).state == 1) { 
    writeini notify.ini options whois on
  }
  else { 
    writeini notify.ini options whois off
  }
}

On 1:dialog:notify.opt:sclick:4: {
  if ($did($dname,4).state == 1) { 
    writeini notify.ini options query on 
  }
  else { 
    writeini notify.ini options query off
  }
}

On 1:dialog:notify.opt:sclick:5: {
  if ($did($dname,5).state == 1) { 
    writeini notify.ini options msg on
  }
  else {
    writeini notify.ini options msg off 
  }
}

On 1:dialog:notify.opt:sclick:6: {
  if ($did($dname,6).state == 1) { 
    writeini notify.ini options notice on 
  }
  else { 
    writeini notify.ini options notice off 
  }
}

On 1:dialog:notify.opt:sclick:10: {
  if ($did($dname,10).state == 1) { 
    writeini notify.ini options notifymsg on
  }
  else { 
    writeini notify.ini options notifymsg off
  }
}

On 1:dialog:notify.opt:sclick:11: {
  if ($did($dname,11).state == 1) {
    writeini notify.ini options notifynotice on 
  }
  else { 
    writeini notify.ini options notifynotice off
  }
}

on 1:dialog:notify.opt:sclick:9: {
  if ($did(7)) {
    set %notify.notice $did(7)
  }
  if ($did(8)) { 
    set %notify.msg $did(8) 
  }
  dialog -x notify.opt notify.opt
}

on 1:dialog:notify.opt:init:0: {
  if ($readini(notify.ini, options, sounds) == on) {
    did -c notify.opt 1 
  } 
  if ($readini(notify.ini, options, notifymsg) == on) {
    did -c notify.opt 10 
  }
  if ($readini(notify.ini, options, notifynotice) == on) { 
    did -c notify.opt 11
  }
  if ($readini(notify.ini, options, whois) == on) { 
    did -c notify.opt 3
  }
  if ($readini(notify.ini, options, query) == on) { 
    did -c notify.opt 4
  }
  if ($readini(notify.ini, options, msg) == on) { 
    did -c notify.opt 5
  }
  if ($readini(notify.ini, options, notice) == on) { 
    did -c notify.opt 6
  }
  if (%notify.notice) { 
    did -a notify.opt 7 %notify.notice
  }
  if (%notify.msg) { 
    did -a notify.opt 8 %notify.msg
  }
}

alias notify.import {
  var %file = $$sfile("s")
  var %x = 1
  echo -a Importing the following nicknames:
  while (%x <= $lines(%file)) {
    echo -a $read(%file,%x)    
    notify $read(%file,%x)
    inc %x
  }
}

alias notify.export {
  var %x = 1 
  var %file = $input(Filename? $crlf $+ somefile.ext,e,)
  echo -a Exporting the following nicknames:
  while (%x <= $ini(mirc.ini,notify,0)) {
    write %file $readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)))
    echo -a $readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)))
    inc %x
  }
}


-Andy

Re: export/import notifies ? #135060 08/11/05 01:44 AM
Joined: Mar 2005
Posts: 27
N
Name141 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2005
Posts: 27
that seems to work if there is no comment or note.

perhaps this would work better?

alias notify.export {

var %x = 1

var %file = $$1

echo -a Exporting the following nicknames:

while (%x <= $ini(mirc.ini,notify,0)) {

write %file $replace($gettok($readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)),1,58),NOTE,$null)

echo -a $replace($gettok($readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)),1,58),NOTE,$null)

inc %x

}

}

Last edited by Name141; 08/11/05 01:47 AM.
Re: export/import notifies ? #135061 08/11/05 09:24 AM
Joined: Mar 2005
Posts: 27
N
Name141 Offline OP
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Mar 2005
Posts: 27
it seems + is also a problem. so i finally ended up with:
Code:
alias notify.import {

  var %file = $$sfile("s")

  var %x = 1

  echo -a Importing the following nicknames:

  while (%x &lt;= $lines(%file)) {

    echo -a $read(%file,%x)    

    notify $read(%file,%x)

    inc %x

  }

}



alias notify.export {

  var %x = 1 

  var %file = $$1

  echo -a Exporting the following nicknames:

  while (%x &lt;= $ini(mirc.ini,notify,0)) {

    set -u2 %notifynickstart $replace($gettok($readini(mirc.ini,notify,$ini(mirc.ini,notify,%x)),1,58),NOTE,$null)

    set -u2 %notifynick $replace(%notifynickstart,$chr(43),$null)

    write %file %notifynick

    echo -a %notifynick

    inc %x

  }

} 

Re: export/import notifies ? #135062 08/11/05 07:20 PM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
When I came up with the code I didn't stop to think about notes etc, nice additions.. smile

-Andy