Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global proc selectionToShelf(){
- string $option = `confirmDialog -title "Selection to shelf" -message "Create a button for this unique character or all similar characters ?"
- -button "This character"
- -button "All characters" -defaultButton "All characters"
- -button "Cancel"
- -cancelButton "Cancel" -dismissString "No"`;
- if($option!="Cancel" && size(`ls -sl`)>0){
- string $sel[] = `ls -sl`;
- string $text;
- string $result = `promptDialog
- -title "Selection Name"
- -message "Name your shelf button (3-6 letters):"
- -button "OK" -button "Cancel"
- -defaultButton "OK" -cancelButton "Cancel"
- -dismissString "Cancel"`;
- $text = `promptDialog -query -text`;
- if ($result == "OK") {
- if($option=="This character"){
- $selstring = "select -add "+stringArrayToString($sel," ");
- textToShelf ($text, $selstring);
- }else{
- $namespace = `match ".*:" $sel[0]`;
- for($i=0;$i<size($sel);$i++){
- $sel[$i] = `match "[^:.]*$" $sel[$i]`;
- }
- string $str= "__NS__"+stringArrayToString($sel," __NS__");
- $selstring = "string $sel[] = `ls -sl`;string $ns = `match \".*:\" $sel[0]`;string $se[] = stringToStringArray(substituteAllString(\""+$str+"\",\"__NS__\",$ns),\" \");select -r $se;";
- textToShelf ($text, $selstring);
- }
- }
- }else{
- warning "Select one or more object";
- }
- }
- selectionToShelf;
Add Comment
Please, Sign In to add comment