AutoHotkey Community

It is currently May 27th, 2012, 1:00 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: October 24th, 2011, 1:19 pm 
Offline

Joined: August 7th, 2011, 1:23 pm
Posts: 754
The main purpose of this tiny script is to run on-the-fly the AHK code posted in this forum simlpy selecting the code and pressing the appropriate hotkey.
Obviously it will produce some results only for the code that it does. I mean if the highlighted code is a function without any call to it it will produce nothing. It doesn't neither make any syntax check.
Could be enhanced by presenting the grabbed code in an Edit box giving the user a way to modify it and run it by pressing a button but this is not my goal.
It's only a really basic way to test the code, whenever possible, and ( as I do a lot of times ) once tested, leave the user to decide to saving it in some location for future use. Nothing more.
I hope can be useful for someone.
Code:
#SingleInstance force
#Persistent
SetWorkingDir %A_ScriptDir%

#b::
   fnam = %A_ScriptDir%\%a_now%.ahk
   oldClipboard := ClipboardAll
   send ^c
   ClipWait, 1
   FileDelete,%fnam%
   code := clipboard "`r`nOnexit, DeleteTemp`r`nDeleteTemp:`r`nFileDelete, " fnam "`r`nExitApp`r`n`r`nreturn`r`n"
   FileAppend, %code%, %fnam%
   Run, %fnam%
   Clipboard := oldClipboard
return

P.S: The code will be saved in a temporary file that will be deleted by exiting the running script, so nothing will change in your script folder.
Regards

_________________
Win7 - Firefox 10.0.2 - AHK_L 1.1.07.00
Please bear with me and my English which is so bad at times that even I don't understand myself


Report this post
Top
 Profile  
Reply with quote  
PostPosted: October 24th, 2011, 6:41 pm 
Offline

Joined: February 16th, 2010, 8:01 am
Posts: 800
Location: SciTE
I had the same idea a few days ago. Your looks like an OK option, however being able to close the slave script with a hotkey was a useful feature to me. Take a look here.

It also uses an edit box as you mentioned.

_________________
AutoHotkey Basic - Windows 7
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2011, 7:16 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
 
Wheel, reinvented (one thread on many).

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bon, sks and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group