Results 1 to 12 of 12

Thread: Autohotkey: A Starter guide video

  1. #1

    Autohotkey: A Starter guide video

    Here, I quickly detail just a fraction of autohotkey's features. First, I cover the "Send" command (which is both easy to use and highly useful), then I explain how you can manipulate windows control elements.

    This tutorial assumes little to no knowledge of programming and I use non-optimized scripting for the sake of simplicity/understanding.

    It is easy to enhance Lightwave as well using AHK, and with image-based scripts you can directly interact with Lightwave's interface as desired. (IE: I've set it up so that I can hit ctrl-shift-LMB in my render options dialogues to cycle through a few render options that I use often. I know a program exists for that, but it left out some options that are vital to my workflow so this is hand-tailored to my needs.)

    Last edited by Ryan Roye; 04-17-2013 at 06:00 AM.
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

  2. #2
    Stuff
    Join Date
    Nov 2006
    Location
    Amherst Nova Scotia
    Posts
    988
    This is a very well done introduction and tutorial.
    I've been using AutoIT to script my Windoze environment, and to automate funtions for certain clients. AutoHotKey has always been in my periphery and now you've de-mystified it somewhat so I am more likely to use it in the near future.
    Thank you.
    Andrewstopheles

  3. #3
    Lightwave rebel Pensart's Avatar
    Join Date
    Feb 2003
    Location
    Belgium
    Posts
    291
    Chazriker thanks for the nice tip! Gonna try it out for sure.
    -------------------------------------
    Joined the Rebellion

  4. #4
    And you keep saying you're just an animator hun... :P Will try this at some point, just hope that all this customization doesn't bite in the back later, ehehe.

    Thanks

  5. #5
    Quote Originally Posted by probiner View Post
    And you keep saying you're just an animator hun... :P Will try this at some point, just hope that all this customization doesn't bite in the back later, ehehe.
    I don't consider myself a programmer by any means... I actually consider Autohotkey's scripting language the most non-programmer friendly that i've ever seen or used. The only other programming language I have meaningful experience with is flash, which has limited practical usages outside of web design, and i've found flash less and less useful as time goes on. I have only really explored lscript as far as lscript commander + code-monkeying can take me (code monkeying = taking snippets of script and modifying/re-arranging them to make new script). Obviously, one should use lscript for any functions that directly involve Lightwave's functions as it is more efficient that way (IE: moving objects, saving graph data, etc).

    The thing that sets autohotkey apart is that it is extremely portable; you can even generate .EXE files if you want to make the program usable without having to download AHK. No fancy compilers required, none of those baffling concepts that have never made sense (like #includes in C++... I've never understood that crap!). Not that it is profitable, but the AHK license also allows you to sell your programs to other people commercially if desired.

    The thing I enjoy most is that my autohotkey scripts can be applied to *all* of my programs easily due to its base design, and it becomes more powerful as time goes on and I continue to add modules as needed or desired to my master Autohotkey script which i've dubbed "W.E.A.P.O.N.S": (Workflow Enhancement Automation Programs for Ongoing Numerous Situations).

    Some other ways I use AHK in Lightwave:

    -For IKbooster, I can use a ctrl+shift+LMB action to recall specific pose save/load items without having to nagivate anywhere.

    -When I bake with IKBooster, I have the option to step-bake if I want a less dense keyframing to happen

    -For the Render Options dialogue, I have presets specifically tailored to Delura's production (Quickshade for previs, thumbnail-mode for render preview, and full detail)

    -I made it so that when I change the grid size in layout, the viewport doesn't move

    -In modeler, mouse wheel up cycles selection modes, and mousewheel down deselects (mousewheel functions seem absent entirely in LW 9.6)

    -Auto image update: whenever I make a change to an image, it automatically updates in Lightwave (this is a combination of an lscript and AHK window trigger). The default is on, but I can turn it off if I'm dealing with images that put burden on my CPU.

    -Package scene is now a 1-click process

    -I have camera and Light presets that I can utilize via ctrl+shift+lmb menus (context sensitive; dependent on whats on screen)

    -Relativity's load/save functions have always bothered me... but now I can ctrl+shift+lmb to bring up a quick menu that sets everything up for me; no locating files needed as the info is all stored in my script in a separate .ini file.

    -Copy/paste coordinates of current object to a new object (I found this more user friendly with AHK)

    -I can change the way my script operates as needed by right clicking on my application's taskbar icon.

    ...and the list goes on and on
    Last edited by Ryan Roye; 04-17-2013 at 10:38 AM.
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

  6. #6
    Registered User
    Join Date
    Nov 2009
    Location
    Iceland
    Posts
    19
    Thanks for this! very informative and handy
    ______________________
    Lightwave user

  7. #7

    i'm a AHK super-newbie, did some tests here >
    http://www.youtube.com/user/erikalst/videos?query=ahk
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  8. #8
    TIP: To elaborate on my image auto-updater... I figured some may find this example script code w/ commentary useful. This is something I consider vital to making my painting process a lot easier.

    There's an uber-useful plugin called "Auto Image Replace" (by dstorm)... but one problem is that you still have to press a button, and you still have to have Lightwave open and active in order for it to work. With Autohotkey, you can take this plugin's functionality outside of Lightwave and make it 100% automatic. On top of that, you can change up things like whether the Lightwave window is "always on top" or not.

    Let's say you wanted auto image replace to trigger every time you save an image file with the key combination of CTRL-S, and you want to be able to have your paint program fill the screen without blocking Lightwave.

    STEPS:

    1) Assign a hotkey to run the Auto Image Replace plugin in Lightwave. For this example, let's use the "r" key.

    2) Write the following code into an Autohotkey script

    Menu, tray, add <------Create separator line
    Menu, tray, add, LayoutAOT, Option1 <----- Creates a new menu item for the right click taskbar icon which will run the script associated with the code beneath "Option1:"
    return

    Option1: <----- referenced from the line above, this section of script fires when the option called "LayoutAOT" is selected
    WinSet, AlwaysOnTop,, Layout <---- Toggles "always on top" for Lightwave Layout. This way you can paint in full screen without blocking Lightwave if you don't have a multi-monitor setup.
    return

    ~^s:: <------ When you press CTRL-S, fire the script below. NOTE: the "~" symbol makes it so that the original key's function will not get suppressed/replaced by the script.
    sleep 1500 <---- Make Autohotkey wait 1.5 seconds before moving to the next line. Images usually take about 1.5 seconds to save for me.
    ControlSend, ahk_parent, r, Layout <------- Sends "r" keystroke directly to Lightwave's Layout without stealing focus or interrupting user's actions*
    return

    *note ABOUT "ahk_parent": this is required for applications like Lightwave that have context-sensitive focus elements. ahk_parent basically tells autohotkey "just send it as if the user made Layout active and pressed a button"

    Also, the following code, if placed at the top of your script, makes it so that the start menu will not ever get blocked by applications:

    WinSet, AlwaysOnTop,, ahk_class Shell_TrayWnd <----- This line may only work to windows XP... I have not tried this on Win 7/8


    Of course, one could add efficiency to this script by making the executed lines windows-conditional if statements, or adding an option to turn on/off auto update selectively, or replacing the "Sleep" command with code that tracks a program's progress and executes when done, but the above is a good example of simplistic but highly useful AHK code.
    Last edited by Ryan Roye; 04-20-2013 at 04:30 PM.
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

  9. #9



    hi Ryan,

    i'm having an extra look at the AHK ImageSearch function, wonder, would it be possible for you to share some of the ImageSearch code you made? thought this PLD trick looked interesting > http://www.youtube.com/watch?v=dAiBHjCS9Qk (9m05s into video)
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  10. #10
    Quote Originally Posted by erikals View Post
    i'm having an extra look at the AHK ImageSearch function, wonder, would it be possible for you to share some of the ImageSearch code you made? thought this PLD trick looked interesting > http://www.youtube.com/watch?v=dAiBHjCS9Qk (9m05s into video)
    I don't have the code anymore as I was using a really old computer back when I made that tutorial and a lot of stuff was dumped during the transfer, including a large majority of the source files for the tutorials i've made over the years as I had no plans to revisit them.

    Basically, just use printscreen and crop out what you want imagesearch to look for, assign it to a hotkey, and utilize the variables it produces to pair with the desired mouse move/click commands. Know that if you changed the UI scheme, or want to use this script on a different computer the font size and UI color must be identical for it to work... so even if I had the old script you'd still need to chop up the UI elements to search for to match LW 11+'s new color scheme.
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

  11. #11

    ah, well, that happens at times. cleaning / reinstalling is a dangerous thing... :]

    thank you for the summary tough,
    and absolutely worth remembering as far as changing screen resolution and UI.

    i wonder though, does the cursor snap to the image when hovering over?
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  12. #12
    Quote Originally Posted by erikals View Post
    and absolutely worth remembering as far as changing screen resolution and UI.

    i wonder though, does the cursor snap to the image when hovering over?
    Actually screen resolution is irrelevant if you use the right coordinate mode (you can have AHK search relative to the window, or the entire screen, or a specific pixel area). So, mainly it's just font/color to concern yourself with.

    In the video, I set it up so that when I hit various hotkeys, it moved the mouse to where it detected the image... by default, the upper-left corner of the detected image is used, moving it somewhere other than the upper left corner requires adding/subtracting a static number of pixels from the variables that imagesearch generates. Whether the mouse "snaps" to the position or not is determined by the mousemove speed parameter.

    Obviously, it isn't the most efficient way to perform interface manipulations; it is only viable when no other options for performing the task are available.
    Professional-level 3d training: Ryan's Lightwave Learning
    Plugin Developer: RR Tools for Lightwave

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •