Results 1 to 4 of 4

Thread: Vista macros

  1. #1
    Star Lounger
    Join Date
    Feb 2009
    Location
    Evanston, Illinois, USA
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Vista macros

    How can I construct a Windows Vista macro to eliminate the manual steps in (for instance) auto starting excel and word and automatically opening several files ?? Also is there a procedure in assigning a function key to execute the newly constructed macro ?

    Thanks for any step by step help !!

    Theodore

  2. #2
    3 Star Lounger
    Join Date
    Dec 2009
    Posts
    322
    Thanks
    16
    Thanked 70 Times in 58 Posts
    Vista includes VBScript (VBScript aka Visual Basic Scripting Edition) by default but VBScript doesn't include built-in support for hotkeys (aka shortcut keys). Instead you would have to write the VBS script then create a shortcut to it then amend the properties of the shortcut to include a shortcut key.

    An alternative is AutoHotkey (aka AHK), a scripting language which - as the name suggests - was originally written for exactly the purpose you need, i.e. hotkeys (but has since grown exponentially in functionality).

    An AHK script to do what you want, using the F2 key as the hotkey would be something like:

    Code:
    #F2::
    Run, open "My Example Spreadsheet.xls"
    Run, open "My Example Document.doc"
    return
    The first line assigns the F2 key as the hotkey to run the rest of the script.
    The second and third lines open the files you want, e.g. "C:\Users\Theodore\My Documents\My Example Document.docx".
    The fourth line just serves to end the action of the hotkey.

    Alternatively, you could use something like:
    Code:
    #F2::
    RunWait, "C:\Program Files\Microsoft Office\Office14\EXCEL.EXE"
    Run, "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE"
    return
    
    #F3::
    Run, open "My Example Spreadsheet.xls"
    return
    
    #F4::
    Run, open "My Example Document.doc"
    return
    In the second example, F2 would start Excel first, wait until it was running then start Word. If you pressed F3 then the example spreadsheet would open and if you pressed F4 then the example document would open.

    AutoHotkey can be downloaded from here, documentation is here and has 2 active Support forums - http://www.autohotkey.com/board/ and http://ahkscript.org/boards/. Both forums offer, in my opinion, excellent support for newcomers to AutoHotkey (AHK).

    Hope this helps...
    Last edited by Rick Corbett; 2014-04-29 at 19:56.

  3. The Following User Says Thank You to Rick Corbett For This Useful Post:

    sffrog (2014-05-30)

  4. #3
    Star Lounger
    Join Date
    Feb 2009
    Location
    Evanston, Illinois, USA
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Rick for your timely advice and a nice example of AHK coding. Could you also tell me if AHK has a macro recorder which codes in actual key taps and mouse clicks ??

    Thanks Theodore

  5. #4
    3 Star Lounger
    Join Date
    Dec 2009
    Posts
    322
    Thanks
    16
    Thanked 70 Times in 58 Posts
    AHK is just the scripting language. Once it's installed you could use Notepad to write your AHK scripts... but that's not easy whilst you're getting the hang of things. Instead, I suggest using SciTE4AutoHotkey as your AHK editor because it also includes a number of tools, including a rudimentary macro recorder.

    ahkrecorder.jpg
    Click to expand

    You would use the macro recorder to record your keystrokes then save the macro and, finally, add the hotkey you wanted to use (at the top of the script).

    Like AHK, SciTE4AutoHotkey is free and can be downloaded from here.

    Hope this helps...
    Last edited by Rick Corbett; 2014-04-30 at 15:16.

  6. The Following User Says Thank You to Rick Corbett For This Useful Post:

    sffrog (2014-05-30)

Posting Permissions

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