Winscript - Script launcher/Manager

Post your working scripts, libraries and tools for AHK v1.1 and older
jpginc
Posts: 124
Joined: 29 Sep 2013, 22:35

Winscript - Script launcher/Manager

20 Jan 2014, 04:40

The idea for this program came from my use of the text editor Vim (A (much) better version of notepad). The basic idea of Vim is that there are two modes; there is ‘insert mode’ which is just like using notepad, you type and the characters appear on the screen, and then there is ‘normal mode’. When your in normal mode each key can become a shortcut to do nifty things. For example one of the most useful shortcuts I use is the mapping of the ‘h j k l’ keys to be ‘left down up right’ respectively.

So I started thinking to myself ‘I wish windows had two modes like vim’ Winscript is my answer to this problem. It is very simple, press ‘Caps + Shift’ and windows goes into ‘normal mode’ and brings up a list of shortcuts

The default version of winscript comes with two important shortcuts: New and Add. If you use the new shortcut a file will be created with a commented template which is hopefully self-explanatory. If you develop in this file you can then use the Add shortcut to merge the code with Winscripts main file.

You can get the latest version of the code https://bitbucket.org/JPGInc/winscript/ ... script.ahk and I had a go at making a youtube video demo of the program which can be found here http://www.youtube.com/watch?v=ulzWr_IhWD4

The program is basically a way to display to and get input from a user. An instance of the 'Controller' class is passed to your initialization function or is available in the global scope by the variable name GlobalController. Below is a list of methods available

enterScriptMode()

Brings up a list of shortcuts

mouseClick()

Register a mouse click with the display

esc()

Register an escape key press with the display

showMessage(message, params*)

Show a message on the screen. params[1]/[2] are booleans, if True then clicking/escape key do not clear the display. Use clearDisplay() to clear it manually

clearDisplay()

Clear the screen or cancel input

getChoice(choices, message := "", params*)

Display an array of strings to the user and return one. params[1]/[2] are booleans, if True then clicking/escape key do not clear the display. Use clearDisplay() to clear it manually

getInput(message, params*)

Get input from the user. Displays message. params[1]/[2] are booleans, if True then clicking/escape key do not clear the display. Use clearDisplay() to clear it manually

setContext(newContext)

Sets the string contents of getContext() which can be used to create context sensitive hotkey ie

Code: Select all

#if GlobalController.getContext() == "Your script name"
. . .
getContext()

Return's a string representing the context of the program

getShortcuts()

returns an array of strings which represent all the current winscript shortcuts

getCodeSegments()

Returns an array of strings which represent all the code segments within winscript that weren't added to the shortcut lits

getAllShortcuts()

Returns an array of strings containing all the shortcuts and code segments

isValidShortcut(newShortcut)

Returns true if the given string could be used as a new shortcut or code segment

shortcutExists(newShortcut)

Returns true if the given string exists in the getShortcuts() array

codeSegmentExists(newShortcut)

Returns true if the given string exists in the getCodeSegment() array

codeOrShortcutExists(shortcut)

Returns true if the given string exists in the getShortcut() or getCodeSegment() arrays

edit(filename)

Attempts to run the given filename with the file types associated edit action. If it doesn't have one then opens it in notepad

toggleHighVisiblity()

Changes the color of the display. When in high visiblity it is a lot slower to respond. By default this is toggled by the hotkey Capslock + v when GlobalController.getContext != ""

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 128 guests