Kirby commented on a Page, Hawkee Snippet Ripper v1.0  -  Feb 01, 2009

This might be my scripting habit, but here are some things that I can suggest that might shorten the length of your script by some.

on *:dialog:hawkeepage:edit:2:{
  set %hawkeepage $did(hawkeepage,2).text 
}
on *:dialog:hawkeepage:sclick:3: {
  if (hawkee.com/snippet/ !isin %hawkeepage) {
    dialog -mo invalidadd invalidadd
    halt
  }
  set %next 0
  set %hawkeepage $remove(%hawkeepage,http://,www,hawkee,.,com)
  if ($sock(gethawkee)) {
    .sockclose gethawkee
  }
  sockopen gethawkee www.hawkee.com 80
}

on *:dialog:doneload:sclick:*: {
  if ($did == 2) {
    .load -rs $qt($scriptdir $+ %filename $+ .mrc)
    echo -a 4 %filename $+ .mrc Successfully Loaded!
  }
  if ($did == 3) {
    echo -a 4 %filename $+ .mrc Successfully Saved But Not Loaded!
  }
}

As you might already know:

on *:dialog:name:event:id: {

name would be $dname, event would be $devent, and id would be $did.

Hence, you can shorten the code that I pasted above into smaller amounts like this:

on *:dialog:*:*:*: {
  if ($dname == hawkeepage) {
    if ($devent == edit) {
      if ($did == 2) { set %hawkeepage $did(hawkeepage,2).text }
    }
    if ($devent == sclick) {
      if ($did == 3) {
        if (hawkee.com/snippet/ !isin %hawkeepage) { dialog -mo invalidadd invalidadd | halt }
        set %next 0 | set %hawkeepage $remove(%hawkeepage,http://,www,hawkee,.,com)
        if ($sock(gethawkee)) { .sockclose gethawkee }
        .sockopen gethawkee www.hawkee.com 80
      }
    }
  }
  if ($dname == doneload) {
    if ($devent == sclick) {
      if ($did == 2) { .load -rs $qt($scriptdir $+ %filename $+ .mrc) | echo -a 4 %filename $+ .mrc Successfully Loaded! }
      if ($did == 3) { echo -a 4 %filename $+ .mrc Successfully Saved But Not Loaded! }
    }
  }
}

Of course, I'm a dialog-nazi so you can ignore me if you want. :P
Just giving you suggestions. ^^

/me rates 7.0 because he hates copying and pasting scripts and then loading them. >:[

Saves me time. =D

 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.