The immediate goal is to capture everything the Julia console outputs for a 
block of input (pasted from the Windows clipboard) and log it in a file, or 
put it in the clipboard. The calling program then gets this data as IJulia 
does, and processes it. (I can do it, with clearing the Julia screen, 
pasting code there, marking everything, copy to clipboard... but it is ugly 
and slow.)

One application of it is my AutoHotkey macro for MS Word. It has three 
hotkeys. #1: takes the text from the caret backwards to a prescribed string 
(double space), and passes this to Julia, replacing the selection with the 
result. I type "There are  7*24*60*60" now I press the #1 hotkey, which 
replaces  7*24*60*60 with 604800 computed by Julia, and I go on with 
typing, "seconds in a week." The final sentence then reads: "There are 
604800 seconds in a week." The #2 hotkey keeps the selection and copies the 
result after it, with an "=" in between, while the #3 hotkey takes the 
whole current paragraph (with Shift-Enter separated lines) and evaluates 
that in Julia. E.g.
for i = 1:9
println((i,i^3))
end

This gives me a small table of the cubes direct in MS Word. All these used 
to work until a couple months ago, but when the new Julia console was 
introduced, it broke. I used a separate thread to read everything from 
STDERR and to copy it to a Julia variable, returned by another function 
call. These stopped working, and my nice AutoHotkey macros are useless.

There are two problems: 1) the results of direct expressions (like "1+2") 
do not appear in STDOUT in the Julia console, while print() calls produce 
no results, which can be assigned to a variable, 2) I cannot capture syntax 
error messages with simply surrounding the computer generated Julia code 
with extra instructions. This happens very often with misplaced parentheses 
and similar errors, and in MS Word I'd like to get the error message. 

Reply via email to