Emerald Editor Discussion
September 26, 2017, 10:33:56 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register  
Pages: [1]
Author Topic: Compile Key Support (script included)  (Read 3805 times)
0 Members and 1 Guest are viewing this topic.
Posts: 1

« on: December 28, 2010, 10:17:52 am »

Hello, there. I've been using Crimson Editor on-and-off for a few years, after I lost my copy of Notetab Pro. One thing which has been bothering me lately is that I can't seem to assign a command to run when I press a key. Well. If that just isn't what the autohotkey scripting utility is for! I've written a script which runs a program with the current tab's file as the target. You can press f1 to access a bit of help.

1) Install autohotkey.
2) Save the below code as quick-compile.ahk. It must have the .ahk extension.
3) Double-click the file in windows explorer. Now, it's running.
4) Press f9 with Crimson Editor open. It attempts to run the script as a python program, using the default python install location.

; A script to allow fast running of Starcube, when editing the source.
; F9 - Run script listed.
; Shift-F9 - quit().
; f10 - Run script and immeadiatly quit.
; (gpl) 2010, David D. Roberts (DDR)

;F1 - splashscreen

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir C:\Documents and Settings\David\My Documents\Python\Starcube b0\  ; Ensures a consistent starting directory.

;path = C:\Panda3D-1.7.0\samples\Ball-in-Maze\Tut-Ball-in-Maze.py

Send quit(){enter}

#IfWinActive Crimson Editor

SplashImage, C:\Documents and Settings\David\My Documents\My Pictures\3d pointer.JPG, w385 h460 , Released under same license as Starcube. Contact: robertsdavidddr@gmail.com, Quick-Compile - A quick compiling hotkey for Starcube. F9: Run persistant. Shift-F9: send quit(). F10: Run normal. Esc: Close this., Quick-Compile
KeyWait, Esc, D T10
SplashImage, OFF

F9:: ;Save and run script.
WinGetActiveTitle, Title
Title := RegExReplace(Title, "]$", "") 
Title := SubStr(Title, 19)
Run C:\Python26\python.exe -i "%Title%"


WinGetActiveTitle, Title
Title := RegExReplace(Title, "]$", "") 
Title := SubStr(Title, 19)
Run C:\Python26\python.exe "%Title%"
To change the python executable location, change "C:\Python26\python.exe" to the python executable of your choice. Example: I'm currently using the Panda3D version of Python, so I'd replace that string with "C:\Panda3D-1.7.0\python\python.exe" to have the script use that. I imagine it's fairly simple to change the script to use another language, too. Just replace the .exe with the program of your choice. Remember, %Title% is the title of the currently open document in Crimson Editor.

Sorry for the wall of text, the forum required an odd and long password - basically, I'm not coming back. I'll watch, though, and send myself a reset email if necessary. Wink

All the best, and happy one-key compiling.
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.08 seconds with 18 queries.