Run Dialog In MIRC

By StaticX__ on Aug 29, 2008

Download the following image and put it in your mIRC folder:
http://img385.imageshack.us/img385/8039/runiconhh6.png

Then just load the remote.
To open the RUN Dialog you have to type: /mirc.run
It Keeps History of the entries you typed too
And they are cleared when the entries reach 10.
Sry for my english ^-^
Here is the screenshot:

Image

dialog run {
  title "Run"
  size -1 -1 340 158
  option pixels
  icon 1, 11 18 40 40, noborder
  text "Type the name of a program,", 2, 60 8 234 18
  text "folder, file or Internet resource and Windows", 3, 60 22 234 18
  text "will open it.", 4, 60 36 234 18
  text "Open:", 5, 8 82 38 18
  button "OK", 7, 51 110 66 24, ok
  button "Cancel", 8, 119 110 66 24, cancel
  combo 6, 51 81 246 70, edit hsbar drop
  button "Browse..", 9, 187 110 66 24
  button "Clear History", 10, 255 110 77 24
}

on *:dialog:run:sclick:9:{
  set %run.dir $sfile(C:)
  did -i run 6 0 %run.dir
}

on *:dialog:run:sclick:10:{
  clrmemory
  history.check
  dialog -t run History cleared.. | .timer 1 1 tChange
}
alias -l tChange $iif($dialog(run),dialog -t run Run)

on *:dialog:run:sclick:7:{
  if ($did(6) == $null) { dialog -x run | halt }
  if ($did(6) == regedit) { 
    if ($hget(run) != run) { hmake run 10 }
    var %i = 1
    while (%i <= %added.progs) {
      if ($hget(run,%i) == $did(6)) { run regedit | dialog -x run | halt }
      inc %i
    }
    run regedit
    inc %added.progs  
    hadd run %added.progs $did(6)
    dialog -x run
    halt
  }
  if ($did(6) == msconfig) { 
    if ($hget(run) != run) { hmake run 10 }
    var %i = 1
    while (%i <= %added.progs) {
      if ($hget(run,%i) == $did(6)) { run msconfig | dialog -x run | halt }
      inc %i
    }
    run msconfig
    inc %added.progs  
    hadd run %added.progs $did(6)
    dialog -x run
    halt
  }
  if ($did(6) == cmd) {
    if ($hget(run) != run) { hmake run 10 }
    var %i = 1
    while (%i <= %added.progs) {
      if ($hget(run,%i) == $did(6)) { run cmd | dialog -x run | halt }
      inc %i
    }
    run cmd
    inc %added.progs
    hadd run %added.progs $did(6)
    dialog -x run
    halt
  }
  if ( $exists($did(6)) == $true ) {
    if ($hget(run) != run) { hmake run 10 }
    var %i = 1
    while (%i <= %added.progs) {
      if ($hget(run,%i) == $did(6)) { run $did(6) | dialog -x run | halt }
      inc %i
    }
    inc %added.progs
    run $did(6)
    hadd run %added.progs $did(6)
  }
  else { dialog -t run File does not exist. | .timer 1 1 dialog -t run Run }
}

alias mirc.run /dialog -m run run

on *:dialog:run:init:0:{
  if ($isfile($qt($mircdirruniconhh6.png))) { did -g run 1 $qt($mircdirruniconhh6.png) }
  history.check
}

alias -l clrmemory /set %added.progs 0 | /hfree run | /hmake run
alias -l history.check  {
  if (%added.progs >= 1) && (%added.progs < 10) {
    var %i = 1
    while (%i <= %added.progs) {
      did -a run 6 $hget(run,%i)
      inc %i
    }
  }
  else { 
    var %i = 1
    while (%i <= $did(6).lines) { 
      did -r run 6 %i
      inc %i
    }
  }
}

on *:EXIT:{ hsave run runhistory.txt }
on *:START:{ hmake run | hload run runhistory.txt }

Comments

Sign in to comment.
StaticX__   -  Sep 05, 2008

Zmodem: why disabling the OK button? i don't have any problems with the OK button. Thx for the tChange and the icon.

 Respond  
Zmodem   -  Sep 02, 2008

Hey, BlueThen brings up a great point! Why not put this in the dialog:

  icon 1, 11 18 40 40, noborder

Then, add this to the 'init' event:

if ($isfile($qt($mircdirruniconhh6.png))) { did -g run 1 $qt($mircdirruniconhh6.png) }
 Respond  
Eugenio   -  Sep 02, 2008

lmao

 Respond  
BlueThen   -  Sep 02, 2008

I don't like how you have to download an image which has nothing to do with the functionality of the snippet. :(

 Respond  
Zmodem   -  Sep 02, 2008

StaticX__: Perhaps disabling the OK button on the dialog init event will help to solve your OK button issues? Change the init event for the run dialog to this:

ON *:DIALOG:run:init:0: {
  history.check
  did -b run 6
}

Also, you will want to enable this feature when the combo-box is editted/sclicked:

ON *:DIALOG:run:*:6: {
  if (($devent == sclick) || ($devent == edit)) {
    did - $+ $iif($remove($did(6),$chr(32)) != $null,e,b) run 7
  }
}

You get an error if you click 'Clear History' and then close the dialog immediately. This is because of the timer for that command. Use this in place of your clear event, plus the timer event:

on *:dialog:run:sclick:10:{
  if ($hget(run)) {
    clrmemory
    history.check
    dialog -t run History cleared.. | .timer 1 1 tChange
  }
}
alias -l tChange $iif($dialog(run),dialog -t run Run)

Also, when I clicked on Clear History without having a history, I got this error: * /hfree: no such table 'run' . This is because there is no error-checking for if the table exists. You will notice that in the above code, I have already included the fix for this, which is: if ($hget(run)) { ... }. Essentially, your best option would be like the one I have for the OK button, which would be to disable the Clear History button until a history has been made. Enjoy!

 Respond  
StaticX__   -  Aug 31, 2008

UPDATED:
If the editbox is empty and you press ok, it exits the dialog. No more errors.
Removed extra space and dialog + buttons are resized.

 Respond  
StaticX__   -  Aug 31, 2008

Ok.. wait:)

 Respond  
^Neptune   -  Aug 31, 2008

I suggest making the width of the dialog a bit smaller (it's just extra space), and moving the buttons along a bit so you can fit the clear file history button on the same row as the others. It just looks like it's stuck out there randomly imo.

 Respond  
Eugenio   -  Aug 31, 2008

remove some of that space on the right of the dialog
/me rates 6

 Respond  
StaticX__   -  Aug 31, 2008

sure.. just wait

 Respond  
^Neptune   -  Aug 31, 2008

Can we have a screenshot? :D

 Respond  
StaticX__   -  Aug 31, 2008

Ok, Updated a lot. It doesn't add the entry in the history if it already exists, and ADDED a button to clear the history.

 Respond  
^Neptune   -  Aug 31, 2008

It would be better if you used a button to clear the history list other than waiting for it to reach 10. Some people will want to look longer back than that.

 Respond  
StaticX__   -  Aug 31, 2008

UPDATED - RUNICONTH3.BMP [31/8/2008]

 Respond  
EL   -  Aug 29, 2008

/me waits for Zmodems IDEA O_O

 Respond  
Zmodem   -  Aug 29, 2008

The main trouble is the file you tell us to get is called runiconth3.png and the one that you've told the script of yours to load in the dialog is called runicon.bmp. So, hence, you get this error:

* /dialog: 'run' error loading icon 'C:\mIRC\runicon.bmp' (line 55, mircrun.mrc)

A simple fix got me the dialog up and running. It never gave me the right information, as well it will create multiples of the same entry if you do the same run twice. Also, the first run is never saved.

Another big issue is that you've set variables as well as hash entries. Why not use the hash table for everything?

There is no unload feature, so it's impossible to unload your hash table unless you shut mIRC off or type: /hfree run.

This snippet has given me an idea ;-)

 Respond  
EL   -  Aug 29, 2008

Umm ok it simply runs the program you select and saves the last 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.