Monday, July 16, 2007

 
A new version of csound routines is out includes an autoit script and some popen code to run awk programs. Also included is a script to control gvim It is a working version of loading an orc into a csd. https://sourceforge.net/project/showfiles.php?group_id=156455&package_id=202823 The code that is required to control gvim is listed below

from win32com.client.dynamic import Dispatch

def load_instrument_vim(csdfile, orcfile, tagname):
csdfile2 = re.sub(r"\\",r"/",csdfile) #replace \ with /
orcfile2 = re.sub(r"\\",r"/",orcfile) #re[lace \ with /
vim = Dispatch('Vim.Application')
os.path = 'c:\dex_tracker'
vim.SendKeys(':e '+ csdfile + '')
vim.SendKeys('/' + tagname + '')
vim.SendKeys('/;')
vim.SendKeys(':r ' + orcfile2 +'')
vim.SendKeys(':w')

It should reqire pywin. This is a much better example of the ole com control than is listed on the gvim website and it is very easy to write scripts for

Labels: , , , ,


Friday, July 13, 2007

 

fun with csound and autoit and notepad

Besides doing things that are obnoxious (like denial of service attacks and click fraud) it appears you can use text editors to manipulate text... My first try was with gvim and it would appear at firs that gvim would make loading instruments easy.. not so it doesn't like to script. The following is in notepad but notepad will not insert a file so it is just a curosity and a proof of concept that in theory it can be done. you will see alot that is commented out because it is a modified example that was included. They also have screen capture without the copyright restrictions...


send("^f")
send(";{ENTER}")

; Now that the Notepad window is active type some text
;Send("Hello from Notepad.{ENTER}1 2 3 4 5 6 7 8 9 10{ENTER}")
Sleep(500)
;Send("+{UP 2}")
Sleep(500)


; Now quit by pressing Alt-f and then x (File menu -> Exit)
;Send("!f")
;Send("x")


; Now a screen will pop up and ask to save the changes, the window is called
; "Notepad" and has some text "Yes" and "No"
WinWaitActive("Notepad", "No")
Send("n")


; Now wait for Notepad to close before continuing
WinWaitClose("Untitled - Notepad")


; Finished!

Labels: , , ,


This page is powered by Blogger. Isn't yours?