Copyright © 2019 Mediachance. All rights reserved.
US $29
Windows 7,8,10 (5MB)

THE ULTIMATE SOLUTION FOR WINDOWS MACROS

Volume Discounts available at the shopping cart

Version 2.28

Script

Now we are getting into a much more advanced area! Till now we could add a sequence of various pre-set steps. Often that functionality may be enough, but what if we want more?. In version 2.0 we added a scripting command... and that is a big deal! This little block hides an an enormous power - almost like a whole new application itself. It is important to note that using script is entirely optional. You don't have to if you don't want to, but it can open the door to things that other macro software can only dream of. The script itself is quite well suited to process clipboard text and has a large amount of string operation including tag extraction, tokenizer, even regex. A script can grab text from under your cursor, process it in different ways and then type it back or save it to a file. Think of selecting a name in your mailbox, pressing a key and it will instantly format a whole letter. Or just copy a block of text and it will extract names, email addresses etc. We made few examples, that only scratch the surface - multiple clipboards, XML tag extraction etc. It can be also used to create a very special logic, where some keys would be modifiers to other keys. An Example 1: a single macro key key could: send CTR+C to capture selected text under cursor process the text with full and rich suite of string operations (including string tokenizer, tag extraction and full regex) type it changed back to the application. all with pressing just a single key An instant text processor where only the sky is the limit. An Example 2: a key can have modifier keys, for example pressing Key A before Key B will do a different functionality than just pressing Key B alone. An Example 3 Create secondary clipboard, for example pressing Key A will copy text, Key B will paste text, but it will be a fully separate from Ctr+C and Ctrl+V that can copy and paste its own text Create FIFO clipboard: pressing Key A will copy text to a stack, pressing Key B will Paste text from the stack and get ready for previous text to be pasted. To be honest, we don’t know yet the full potential, but these are some of the functionality we tried ourselves.
Buy
We have used various scripts in different Mediachance products, but this is honestly by far our finest script yet! It has full array support, user functions, full step debugger etc. The language is loosely based on a BASIC for its simplicity and familiarity but it omits many of the old Basic idiosyncrasies and where it was beneficial it borrows syntax and features from modern languages like Java, Lua or C. If you ever programmed in any of the modern languages you will be right at home. The core language is kept at minimum to keep it familiar. On top of the core language are arithmetic and string functions for both normal parameters and their array equivalents.

Oscar Script is Basic, but not basic

For full language syntax description, please refer to the manual:
Example: Secondary Clipboard
Task: We want to have a secondary text clipboard CTR+C and CTRL+V would work with normal windows clipboard and we want to assign two other keys that would work as a Copy 2 and Paste 2 - a secondary clipboard, so we are able to copy and paste two things independently of each other. Such script is extremely simple in Oscar Basic and only needs few lines in each button
// remember what is in the clipboard right now previous = GetClipboardText() // send COPY to app SendKeyStroke("CTRL C") // grab the clipboard now GLB_clipboard2 = GetClipboardText() // put the previous clipboard back SetClipboardText(previous)
//Just put whatever is in the global variable to the clipboard if GLB_clipboard2!="" then SendText(GLB_clipboard2) endif
Example: Modifier Key
Task: Pressing KEY (Num 9) will do one action Pressing MODKEY (Num 8) and then shortly afterward KEY (Num9) within 1 sec will do different action. (This of course make sense only if there is more than one Action keys - otherwise you can just define two actions on each key)
//Script on MODKEY //Put current time to Global variable GLB_ModKeyTime = GetTickCount() DisplayText("Mod Key Pressed")
//Script on ACTIONKEY //Check the elapsed time from the Global variable to NOW timeElapsed = TimeElapsed(GLB_ModKeyTime) if timeElapsed>1000 then // too long, we assume the modifier was not pressed or it was too long time ago so just ignore it goto NoModKey endif // mod key was pressed within the 1 sec DisplayText("Mod Key 1 Action") // do the MOD action here - whatever it needs to be // don't forget to use ‘end’ so we don't go to NoModKey part end NoModKey: DisplayText("No Mod Key Action") // do the NO MOD action here - whatever it needs to be
Example: BASE64 encoding
BASE64 example, Encode/Decode Secret Text or Link:
Script A: Encodes string in clipboard to BASE64, obfuscating it by encoding it multiple times in a loop
Script B: Decodes string in clipboard from Base64. Determines number of times it has been encoded
//Encode to BASE64 multiple times // get the text from clipboard clipboard = GetClipboardText() trace "Text in clipboard: ",clipboard nDifficulty = 3 for i = 0 to nDifficulty clipboard = BASE64(clipboard,ENCODE) next i // send the encoded text to clipboard SendText(clipboard)
//BASE64 "Secret" decoding example // get the text from clipboard clipboard = GetClipboardText() nc = Length(clipboard) if nc==0 then DisplayText("No String in Clipboard") terminate endif // loop sufficiently enough for i = 0 to 10 test = BASE64(clipboard,DECODE) // if non BASE64 characters are found // then it returns "" if (test=="") then if i>0 then // it failed this iteration, but we are > 0 // it means previous iteration must have succeeded SetClipboardText(clipboard) DisplayText(clipboard) break else // it failed to decode on first try // must be garbage, not BASE64 DisplayText("Failed to decode, no Base64") terminate endif endif clipboard = test next i
There are more examples in the manual:
These are just some simple examples to show the programming language.
MULTI KEYBOARD MACROS
Tips for working with web pages:
Web pages can be easily parsed from within the Script, but first we need to get the source code to the clipboard. This following example is for FIREFOX, google chrome may have different shortkeys
CTRL+U opens source code in new tab Pause because it may take a bit time for firefox CTRL+A - select all text CTRL+C - send it to clipboard << now the script takes over
string = GetClipboardText() n = Find(string,"<div class=\"main-news\">") title = Mid(string,n+22,100) title = Extract(title,"<h1>","</h1>",0)
Example of parsing the web page:
Example of extracting exe file link (works for example on this page)
string = GetClipboardText() // Test for .exe” which will get the exe in link such as // href=”http://www.mediachance.com/something.exe n = Find(string,".exe\"") if n<1 then DisplayText("Error, No link Found") terminate endif // get text from beginning to just after the .exe” string = Left(string,n+5) // Find the closest href= to the end n = ReverseFind(string,"href=") // Get the string from the end of href= to the end string = Mid(string,n+5,0) // Replace “ with nothing link = Replace(string,"\"","") SetClipboardText(link) // Move cursor to address box, paste the link and press Enter SendKeyStroke("CTRL L") SendKeyStroke("PAUSE") SendKeyStroke("CTRL V") SendKeyStroke("ENTER")
// Move cursor to address box. SendKeyStroke("CTRL L") // copy the address bar link to clipboard SendKeyStroke("PAUSE") SendKeyStroke("CTRL A") SendKeyStroke("CTRL C") // Send Esc to close address bar… // oops, in version before 2.04 there is no ESC in SendKeyStroke and you need to use SendKeyStroke(“0x1B”) SendKeyStroke("ESC") string = GetClipboardText() DisplayText(string)
Example of extracting link from address bar of firefox
About MediaChance
Products
Links
E-mail:
Sign up to receive Mediachance newsletter featuring new announcements and special offers.