Alias Manager Dialog

By vaseline28 on May 27, 2008

This is simply an Alias Manager Dialog. Should be bug free and allows you to edit the name or commands of an alias, delete one or edit one. Feedback/bugs appreciated!

Image

alias aliasdialog $iif(!$dialog(AliasEditor),dialog -mied AliasEditor AliasEditor,halt)
menu status,channel {
  [Alias Manager]: $iif(!$dialog(AliasEditor),dialog -mied AliasEditor AliasEditor,halt)
}
dialog AliasEditor {
  title "Alias Manager"
  size -1 -1 220 265
  text "Alias Editor ~Vaseline28", 1, 10 10 200 20, center
  text "", 2, 10 240 200 20
  tab "Current", 3, 10 40 200 200
  box "List of Aliases", 4, 20 70 80 150
  combo 5, 25 95 70 120
  box "Options",6, 115 70 80 150 
  button "New", 7, 125 100 60 30
  button "Edit", 8, 125 135 60 30
  button "Delete", 9, 125 170 60 30
  box "New Alias Information", 10, 10 260 200 100, hide
  edit "Type alias name", 11, 20 280 180 20, hide, autohs, autovs
  edit "Commands (put | between each)", 12, 20 305 180 20, hide, autohs, autovs
  button "Save Alias", 13, 140 337 60 20, hide
  button "Cancel", 14, 85 337 50 20, hide
  button "Confirm", 17, 160 240 50 20, hide
  box "Edit Options", 18, 10 260 200 75, hide
  edit "Name", 19, 20 280 120 20, hide, autohs, autovs
  edit "Commands", 20, 20 305 120 20, hide, autohs, autovs
  button "Edit", 21, 145 280 40 20, hide
  button "Edit", 22, 145 305 40 20, hide
  button "Refresh List", 23, 140 37 70 20

}
on *:dialog:AliasEditor:init:*: {
  var %x 0
  while (%x < $alias(0)) {
    inc %x
    var %AliasFile $alias(%x)
    var %t = 1, %l = $ini(%AliasFile,aliases,0)
    while (%t <= %l) {
      tokenize 32 $readini(%AliasFile, n, aliases, n $+ %t)
      did -i $dname 5 %t $1
      inc %t
    }
  }
}
on *:dialog:AliasEditor:sclick:7: {
  did -h $dname 10-14,17-22
  $iif($did == 7,did -v $dname 10-14,)
  dialog -s $dname -1 -1 220 370
}
on *:dialog:AliasEditor:sclick:8: {
  if (!$did($dname,5).seltext) {
    did -h $dname 10-14,17-22
    dialog -s $dname -1 -1 220 265
    did -av $dname 2 Please specify alias to edit.
    halt
  }
  did -av $dname 2 
  did -h $dname 10-14,17-22
  did -v $dname 13,14,18-22
  did -b $dname 19,20
  dialog -s $dname -1 -1 220 370
  set %OldName $did($dname,5).seltext
  did -o $dname 19 1 $did($dname,5).seltext
  var %x 0
  while (%x < $alias(0)) {
    inc %x
    var %AliasFile $alias(%x)
    var %t = 1, %l = $ini(%AliasFile,aliases,0)
    while (%t <= %l) {
      var %p $readini(%AliasFile, n, aliases, n $+ %t)
      if ($did($dname,5).text isin %p) {
        tokenize 32 $readini(%AliasFile, n, aliases, n $+ %t)
        did -i $dname 20 %t $2-
      }
      inc %t
    }
  }
}
on *:dialog:AliasEditor:sclick:21-22: {
  $iif($did == 21, did -e $dname 19,)
  $iif($did == 22, did -e $dname 20,)
}
on *:dialog:AliasEditor:sclick:13: {
  if ($did($dname,21).visible == $true) {
    .alias %OldName
    .alias $did($dname,19).text $did($dname,20).text
    unset %OldName
    did -h $dname 13-14,18-22
    did -b $dname 19,20
    did -av $dname 2 Alias Edited!
    dialog -s $dname -1 -1 220 265
    refresh
    halt
  }
  if (($did($dname,11).edited != $true) && ($did($dname,12).edited != $true)) { did -av $dname 2 Insufficient Parameters | halt }
  did -av $dname 2 
  .alias $didtok($dname,11) $didtok($dname,12)
  did -av $dname 2 Alias Saved.
  did -h $dname 10-14
  dialog -s $dname -1 -1 220 265
  did -i $dname 5 $didtok($dname,11)
  refresh
}
on *:dialog:AliasEditor:sclick:14: {
  dialog -s $dname -1 -1 220 265
  did -h $dname 10-14,17-22
  did -b $dname 19,10
  did -av $dname 2 Action Cancelled.
}
on *:dialog:AliasEditor:sclick:9: {
  $iif($did($dname,5).seltext == $null,did -av $dname 2 Please specify alias to delete,)
  $iif($did($dname,5).seltext == $null,halt,)
  did -av $dname 2 
  did -h $dname 2
  did -v $dname 17
  set %p $did($dname,5).seltext
  set %t $did($dname,5).sel
}
on *:dialog:AliasEditor:sclick:17: {
  .alias %p
  did -d $dname 5 %t
  unset %p %t
  did -h $dname 17
  did -av $dname 2 Alias Deleted.
  refresh
}
on *:dialog:AliasEditor:sclick:23: {
  refresh
}
on *:dialog:AliasEditor:close:*: {
  unset %OldName
}
alias refresh {
  saveini
  var %x 0
  while (%x < $alias(0)) {
    inc %x
    var %AliasFile $alias(%x)
    var %t = 1, %l = $ini(%AliasFile,aliases,0)
    while (%t <= %l) {
      tokenize 32 $readini(%AliasFile, n, aliases, n $+ %t)
      did -o AliasEditor 5 %t $1
      inc %t
    }
  }
}

Comments

Sign in to comment.
ChrisFarmer   -  Jan 23, 2011

can someone tell me why the list is not showing up after I add alias to it

 Respond  
vaseline28   -  Jun 03, 2008

It\'s just there for people who aren\'t so keen on the script editor. I don\'t know who they are, but there are always some.

 Respond  
Eugenio   -  Jun 02, 2008

Im the Same as Phoenix really but it can come in handy.

 Respond  
Phoenix847   -  Jun 02, 2008

Still good; 9/10.

But I still find no use to it lol. I\'m more into the full window thing with the Script Editor.

 Respond  
vaseline28   -  May 28, 2008

Update: Now automatically refreshes the id list after you delete/edit/create.
And automatically saves the alias files.

 Respond  
vaseline28   -  May 28, 2008

Good suggestion Eugenio, thanks!

alias aliasdialog $iif(!$dialog(AliasEditor),dialog -mied AliasEditor AliasEditor,halt)
menu status,channel {
[Alias Manager]: $iif(!$dialog(AliasEditor),dialog -mied AliasEditor AliasEditor,halt)
}

Can now be prompted either with a write click, or by typing /aliasdialog

 Respond  
Eugenio   -  May 28, 2008

Like Criminal said rating 5 is ludacris ffs -.-\'
/me rates 8

alias aliasmanager dialog -mied AliasEditor AliasEditor
added that ^^
and deleted the:
menu status,channel {
[Alias Manager]: $iif(!$dialog(AliasEditor),dialog -mied AliasEditor AliasEditor,halt)
}

-.-\' im picky on what I have with right click ffs :p

btw why the name vaseline28 ?!?

 Respond  
criminal   -  May 28, 2008

5.0 rating? This diserves more :) 8/10

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.