Home Technical Talk

as in a max script will assign a hotkey &

yurysper
null
Offline / Send Message
yurysper null
Hi, I have a script, can I assign a button 

rollout myRoll "switch lod" width:149 height:164


colorPicker 'cp1' "flat_color" pos:[19,102] width:113 height:25 enabled:false color:(color 178 178 178) align:#left
button 'bm1' "lod1" pos:[8,8] width:41 height:21 align:#left
button 'bm2' "lod2" pos:[52,8] width:41 height:21 align:#left
button 'bm3' "lod3" pos:[97,8] width:41 height:21 align:#left
button 'lods1' "add_lod" pos:[9,72] width:132 height:21 align:#left
checkbutton 'ckb3' "flat" pos:[17,129] width:121 height:22 enabled:true align:#left
button 'btn5' "<<<<" pos:[11,40]  width:65 height:22 tooltip:"prewiew_lod" align:#left  
button 'btn6' ">>>>" pos:[78,40] width:65 height:22 tooltip:"next_lod" align:#left 

)
createdialog myRoll 

Replies

  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    Make it a macroscript in order to call a script with hotkeys.

    macroScript MyMacroName
    category:"MyMacroCategory"
    toolTip:""
    (
    rollout myRoll "switch lod" width:149 height:164

    colorPicker 'cp1' "flat_color" pos:[19,102] width:113 height:25 enabled:false color:(color 178 178 178) align:#left
    button 'bm1' "lod1" pos:[8,8] width:41 height:21 align:#left
    button 'bm2' "lod2" pos:[52,8] width:41 height:21 align:#left
    button 'bm3' "lod3" pos:[97,8] width:41 height:21 align:#left
    button 'lods1' "add_lod" pos:[9,72] width:132 height:21 align:#left
    checkbutton 'ckb3' "flat" pos:[17,129] width:121 height:22 enabled:true align:#left
    button 'btn5' "<<<<" pos:[11,40]  width:65 height:22 tooltip:"prewiew_lod" align:#left  
    button 'btn6' ">>>>" pos:[78,40] width:65 height:22 tooltip:"next_lod" align:#left 

    )
    createdialog myRoll 
    )

    Just name the macroscript, category, and tooltip whatever you desire. After that evaluate all and open up the keyboard/hotkey editor. Customize>Customize User Interface>Keyboard. Find the category that you used in the drop down menu and then assign your desired key from the actions panel.


  • yurysper
    Offline / Send Message
    yurysper null
    zachagreg said:
    Make it a macroscript in order to call a script with hotkeys.

    macroScript MyMacroName
    category:"MyMacroCategory"
    toolTip:""
    (
    rollout myRoll "switch lod" width:149 height:164

    colorPicker 'cp1' "flat_color" pos:[19,102] width:113 height:25 enabled:false color:(color 178 178 178) align:#left
    button 'bm1' "lod1" pos:[8,8] width:41 height:21 align:#left
    button 'bm2' "lod2" pos:[52,8] width:41 height:21 align:#left
    button 'bm3' "lod3" pos:[97,8] width:41 height:21 align:#left
    button 'lods1' "add_lod" pos:[9,72] width:132 height:21 align:#left
    checkbutton 'ckb3' "flat" pos:[17,129] width:121 height:22 enabled:true align:#left
    button 'btn5' "<<<<" pos:[11,40]  width:65 height:22 tooltip:"prewiew_lod" align:#left  
    button 'btn6' ">>>>" pos:[78,40] width:65 height:22 tooltip:"next_lod" align:#left 

    )
    createdialog myRoll 
    )

    Just name the macroscript, category, and tooltip whatever you desire. After that evaluate all and open up the keyboard/hotkey editor. Customize>Customize User Interface>Keyboard. Find the category that you used in the drop down menu and then assign your desired key from the actions panel.


    I'll get access to the button through   "tooltip"  ?
  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    No, the tooltip line is left blank in the script as there is nothing between the "". Adding your text in here will pop up as a tooltip if using a button.

    The first 2 lines ensure the script will appear in a custom category of your making in the customise UI list.

    To assign a button you can just select all script text in the editor and drag it into a button on the UI.
  • yurysper
    Offline / Send Message
    yurysper null
    No, the tooltip line is left blank in the script as there is nothing between the "". Adding your text in here will pop up as a tooltip if using a button.

    The first 2 lines ensure the script will appear in a custom category of your making in the customise UI list.

    To assign a button you can just select all script text in the editor and drag it into a button on the UI.
    I do not need to make a button, I want to do hotkey for button 'bm1,'bm2' e.t.c  in script

  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    Okay so then just copy and paste what I posted and rename "MyMacroName" and "MyMacroCategory" then find the same name in the keyboard tab of customize user interface

  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    yurysper said:
    Hi, I have a script, can I assign a button 


    Language barrier. I thought you meant button as in toolbar button.
  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    Language barrier. I thought you meant button as in toolbar button.
    Still good info though, now he knows how to do both :smile:

  • musashidan
    Offline / Send Message
    musashidan high dynamic range
    zachagreg said:
    Still good info though, now he knows how to do both :smile:

    It's all about the info...... :)
  • yurysper
    Offline / Send Message
    yurysper null
    I,  I added your scipt, and it just created a new category  "MyMacroCategory" in  Group main ui. I can only  set a hotkey for run script, but i don't have any actions for my bottoms. https://pp.userapi.com/c845521/v845521990/9a934/BQa_hDpx2Xg.jpg
  • yurysper
    Offline / Send Message
    yurysper null
    I apologize,  I added your scipt, and it just created a new category  "MyMacroCategory" in Group main ui. I can only  set a hotkey for run script, but i don't have any actions for my bottoms. https://pp.userapi.com/c845521/v845521990/9a934/BQa_hDpx2Xg.jpg
  • yurysper
    Offline / Send Message
    yurysper null
    I,  I added your scipt, and it just created a new category  "MyMacroCategory" in  Group main ui. I can only  set a hotkey for run script, but i don't have any actions for my bottoms. https://pp.userapi.com/c845521/v845521990/9a934/BQa_hDpx2Xg.jpg
  • yurysper
    Offline / Send Message
    yurysper null
    I apologize,  I added your scipt, and it just created a new category  "MyMacroCategory" in Group main ui. I can only  set a hotkey for run script, but i don't have any actions for my bottoms. https://pp.userapi.com/c845521/v845521990/9a934/BQa_hDpx2Xg.jpg
  • yurysper
    Offline / Send Message
    yurysper null
    I,  I added your scipt, and it just created a new category  "MyMacroCategory" in  Group main ui. I can only  set a hotkey for run script, but i don't have any actions for my bottoms. https://pp.userapi.com/c845521/v845521990/9a934/BQa_hDpx2Xg.jpg
  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    So from your image can you not press that key combination and launch the LOD window? What functionality are you looking for otherwise?

    Edit: If you're trying to get those bm1, bm2, etc. to be their own keys that is different functionality that is beyond my scope unfortunately.
  • Revel
    Offline / Send Message
    Revel interpolator
    If you want those button to be able to call with its own hotkey, you can put the function into a 'struct' and defined it as global variable. Then you can call them within a macroscript like @zachagreg mentioned above.
Sign In or Register to comment.