AutoHotkey Community

It is currently May 27th, 2012, 10:01 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: November 2nd, 2009, 10:42 am 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 65
Location: Kerala, India
Compiling a script using the context menu is really handy when testing scripts. But it becomes really difficult when compiling scripts using custom AutohotkeySC.bin. Its ok when we are dealing with additions/modifications in Version Info & such of a single SC file. But when we are dealing with SC file with internal file/bitmap references, we need to modify the script & the SC file simultaneously & replace the original SC file with the modified one, then compile.

Say you are compiling many scripts with different SC files in one go. Its really a messed up situation(not if you have phenomenal patience ;-) ).

Herecomes the use of this script. I felt that the compiler should have an additional feature to Compile the script using an AutohotkeySC.bin if it is present in the script directory. i have decided to modify the compiler. but thought "when i have the power of AHK in my hand, why should i use other?" it lead to the coding of this script.

You can freely modify the script without any restrictions :-)

Code:
;AHK2EXE Custom Compiler
;Coded/Developed By Aravind.V.S
;vsaravind007@gmail.com
;Description : When Compiling An AHK
;              Script With "RightClick->Custom_Compile", This Script Searches The Directory
;              For Custom "AutoHotkeySC.bin" File & Uses It To Compile The Script Rather Than
;              Using The Default "AutoHotKeySC.bin". Useful When Testing Scripts With Internal File References
;How To Use : 1) Compile This Code Using The Existing AHK2Exe & Rename "Ahk2Exe_.exe"
;3) Put This Script In The Compiler Folder & You Are Ready To Go!
;This Code Can Be Used/Modified Without Any Restrictions
;Special Thanks to gwarble for his valuabe Reg Key Info
RegWrite, REG_SZ, HKCR, AutoHotkeyScript\Shell\Custom_Compile\Command,, "%A_AhkDir%\Compiler\Ahk2Exe_.exe" /in "%l"

If 0<1
{
Run,Ahk2Exe.exe
exitapp
}
else
{
SplitPath,2,name,dir,ext,name_no_ext,drive
IfExist,%dir%\AutoHotkeySC.bin
{
FileMove,%A_ScriptDir%\AutoHotKeySC.bin,%A_ScriptDir%\AutoHotKeySC_Backup.bin,1
FileCopy,%Dir%\AutoHotKeySC.bin,%A_ScriptDir%\AutoHotKeySC.bin,1
}
RunWait,Ahk2EXE.exe /in "%2%"
FileMove,%A_ScriptDir%\AutoHotKeySC_Backup.bin,%A_ScriptDir%\AutoHotKeySC.bin,1
exitapp
}

_________________
Image

Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway ;)


Last edited by Aravind on November 6th, 2009, 5:07 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 5:24 pm 
Offline

Joined: June 17th, 2008, 7:51 am
Posts: 243
Aravind, have a look on http://www.autohotkey.com/forum/viewtopic.php?t=22975

_________________
Greetings
Rog


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2009, 6:13 pm 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 65
Location: Kerala, India
Both are entirely different ruespe, my script simply checks for an "Autohotkeysc.bin" & uses it if exist while AHK_Compile II is having an option to select a custom copy from somewhere else & that program is complicated & of course it is HUGE! requiring additional resources.

Anyway, thanks for your review :-)

You are the first one to review my my first post ruespe! Thanks again dude ;-)

_________________
Image

Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 1:15 am 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 363
Location: north bay, california
i made a stdlib-compliant function to handle this for you, see Compile():

http://www.autohotkey.com/forum/viewtop ... ht=gwarble

you basically get the above, as well as custom icon (if you don't bother with an entire custom .bin)

simply put:
Quote:
Compile()
somewhere in your script, or i like to use:
Quote:
Compile("Run")
which makes the .ahk file compile itself when run, close itself and run the created .exe for you!

or the simplest:
Quote:
F12::Compile("NoWait")

which will just compile it for you when you want, while script is running, without stopping script

- gwarble


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 3rd, 2009, 3:44 am 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 363
Location: north bay, california
but i started with something similar to your app here... the only recommendation i have is to leave everything from the installation at its defaults (ie don't rename ahk2exe) and instead name your compiled script ahk2exe_.exe, and then use:

Quote:
HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Compile_\Command\"C:\Programs\AutoHotkey\Compiler\Ahk2Exe_.exe" /in "%l"
or, from your script:
Quote:
RegWrite, REG_SZ, HKCR, AutoHotkeyScript\Shell\Compile_\Command,, "C:\Programs\AutoHotkey\Compiler\Ahk2Exe_.exe" /in "%l"


this will give you another entry to the context menu for .ahk files, and won't break any functionality for anyone expecting ahk2exe.exe to be the actual ahk2exe.exe file

- gwarble


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thats cool gwarble! :-)
PostPosted: November 6th, 2009, 5:48 am 
Offline

Joined: October 30th, 2009, 7:32 am
Posts: 65
Location: Kerala, India
The idea of creating a Reg key to handle the Custom Compilation is great! you rock! i

thanks gwarble! mind if i update my script with your idea of a seperate Reg Key??

_________________
Image

Don't Take Life Too Seriously,Because In The End, You Won't Escape It Alive Anyway ;)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 3:17 pm 
Offline

Joined: May 23rd, 2009, 4:48 am
Posts: 363
Location: north bay, california
of course not, i highly recommend it (i started by making a similar script which i called ahk2exe+.exe and added to the context menu as Compile+)

the only reason i went to a function in the script instead was for some ahk-apps that i wanted to basically run the ahk after editing, and have it run the new exe like a shortcut (other apps expecting that process name instead of ahk.exe mostly, or embedded icon testing) and when i'm at work and writing a script i could be on any of a few different computers so i like the portable aspect

anyway, glad i could help
- gwarble


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], sks and 21 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