Guest User

Untitled

a guest
Jan 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. global proc selectionToShelf(){
  2. string $option = `confirmDialog -title "Selection to shelf" -message "Create a button for this unique character or all similar characters ?"
  3. -button "This character"
  4. -button "All characters" -defaultButton "All characters"
  5. -button "Cancel"
  6. -cancelButton "Cancel" -dismissString "No"`;
  7. if($option!="Cancel" && size(`ls -sl`)>0){
  8. string $sel[] = `ls -sl`;
  9.  
  10.  
  11. string $text;
  12. string $result = `promptDialog
  13. -title "Selection Name"
  14. -message "Name your shelf button (3-6 letters):"
  15. -button "OK" -button "Cancel"
  16. -defaultButton "OK" -cancelButton "Cancel"
  17. -dismissString "Cancel"`;
  18. $text = `promptDialog -query -text`;
  19. if ($result == "OK") {
  20. if($option=="This character"){
  21. $selstring = "select -add "+stringArrayToString($sel," ");
  22. textToShelf ($text, $selstring);
  23. }else{
  24. $namespace = `match ".*:" $sel[0]`;
  25. for($i=0;$i<size($sel);$i++){
  26. $sel[$i] = `match "[^:.]*$" $sel[$i]`;
  27. }
  28. string $str= "__NS__"+stringArrayToString($sel," __NS__");
  29. $selstring = "string $sel[] = `ls -sl`;string $ns = `match \".*:\" $sel[0]`;string $se[] = stringToStringArray(substituteAllString(\""+$str+"\",\"__NS__\",$ns),\" \");select -r $se;";
  30. textToShelf ($text, $selstring);
  31. }
  32. }
  33. }else{
  34. warning "Select one or more object";
  35. }
  36. }
  37. selectionToShelf;
Add Comment
Please, Sign In to add comment