Program Manager

By HeatedHeart on Sep 20, 2009

Program i made for a friend to manage his programs and such, thought id post it here :P. just one question that i cant figure out, I need to figure out how to add error checking, like making the script halt if they try to click run and nothing is selected. would if be like

if($did(1).seltext == $null) { halt } 
else {

}

if any one could answer this for me it be greatly appreciated.
-HH

;;;;;;;;;;;;;;;;;;;
;;Program Manager;;
;;HeatedHeart----;;
;;;;;;;;;;;;;;;;;;;
;### Popups
menu status,channel,menu {
  Program Manager:dialog -vmd ProgMan ProgMan
}
;### Alias
alias refresh {
  did -r $dname 1
  var %x $hget(ProgMan,0).item
  var %Loop 1
  while (%Loop <= %x) {
    did -a $dname 1 $Hget(ProgMan, %loop).item
    inc %loop
  }
}
Alias Prog# {
  var %x $hget(ProgMan,0).item
  did -r $dname 8
  did -a $dname 8 %x
}
;### Dialog
dialog ProgMan {
  title "Program Manager"
  size -1 -1 275 261
  option pixels notheme
  list 1, 1 5 194 263
  box "", 2, 194 0 82 147
  button "Add", 3, 197 8 75 25
  button "Remove", 4, 198 34 74 25
  button "Clear", 5, 199 118 73 25
  button "Run", 6, 199 62 73 25
  button "Run as Parent", 7, 199 90 73 25
  text "", 8, 242 242 30 17
}
;### Startup
on *:LOAD:{ 
  hmake ProgMan 10
}
on *:START:{ 
  hmake ProgMan 10
  hload ProgMan ProgMan.txt
}
on *:DIALOG:ProgMan:close:*: {
  hsave ProgMan ProgMan.txt
}
on *:EXIT:{ 
  hsave ProgMan ProgMan.txt
}
on *:DIALOG:ProgMan:init:*: {
  Refresh
  prog#
}
;### Coding
on *:dialog:ProgMan:dCLICK:*: {
  if ($did == 1) {
    run $qt($Hget(ProgMan,$did(1).seltext))
  }
}
on *:dialog:ProgMan:sCLICK:*: {
  if ($did == 3) {
    var %x $sfile(dir)
    hadd ProgMan $Gettok(%x,$numtok(%x,92),92) %x
    refresh
    prog#
  }
  if ($did == 5) {
    hfree ProgMan
    hmake ProgMan 10
    did -r $dname 1
    refresh
    prog#
  }
}
on *:dialog:ProgMan:sCLICK:*: {
  if ($did == 4) {
    hdel ProgMan $did(1).seltext
    refresh
    prog#
  }
  if ($did == 6) {
    run $qt($Hget(ProgMan,$did(1).seltext))
  }
  if ($did == 7) {
    var %x $sfile(dir)
    run $qt($Hget(ProgMan,$did(1).seltext)) $qt(%x)
    unset %Ready
  }
}

Comments

Sign in to comment.
PuNkTuReD   -  Oct 15, 2009

what do you mean "preview"?

 Respond  
D-Mag   -  Oct 15, 2009

Hmm... I wonder if you can preview some if not all of the code in the dialog somehow... b.b

 Respond  
PuNkTuReD   -  Oct 02, 2009

i was just wondering why ur saving ur hash files as txt?

also at the very bottom there i see
unset %Ready
but i cant see where youve set that var in the first place.
although it has been a long night lol.

 Respond  
HeatedHeart   -  Oct 01, 2009

Your welcome brah, scripting sh...stuff... like this just helps meh get better, so yeah >.>... anyways.. anyone else gona say any sh...stuff...

 Respond  
Risen   -  Sep 30, 2009

Aye this was for me. I have used it and used it some more. I like it. I dont see anything wrong with it but I'm not a super scripter anyways. Good Job broski

 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.