Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[ARCHIVED THREAD] SciTE4AutoHotkey v2 (beta) in the making


  • This topic is locked This topic is locked
46 replies to this topic

Poll: Do you continue using SciTE4AutoHotkey? (33 member(s) have cast votes)

Do you continue using SciTE4AutoHotkey?

  1. Yes (27 votes [79.41%])

    Percentage of vote: 79.41%

  2. No (7 votes [20.59%])

    Percentage of vote: 20.59%

Vote
fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
This thread is outdated - GO TO THE v3 BETA THREAD INSTEAD
This thread is outdated - GO TO THE v3 BETA THREAD INSTEAD
This thread is outdated - GO TO THE v3 BETA THREAD INSTEAD


Well, after a LONG inactivity period (2 years!) I'm sort of back! :D
The first thing I want to tell the AHK community is that I'm making a new version of SciTE4AutoHotkey.
NEW: Alpha 1 testing has begun. Scroll to the end of the post for more info.
NEW: Toolbar finished. Scroll a bit down to see and download it.
NEW: BETA RELEASE ADDED!
NEW: Beta updated with bugfixes and installer added.
NEW: Added counters courtesy of Titan and release date.

Number of downloads that the beta installer has had this month:
Posted Image

Number of downloads that the beta zip has had this month:
Posted Image

SciTE4AutoHotkey v2 Stable will be released on March 1, 2009.

BETA BETA BETA BETA BETA ARGHH!!
Scroll down to download the beta!

NEW: Webpage

Here is a screenie (yes I switched from XP to Vista!):

Posted Image

Here is a list of things to hopefully come:

[*:3rkkrfjk](done) Different style for syntax highlighting, it will be more readable.
[*:3rkkrfjk](done) A new sort of toolbar which will provide access to a set of different tools for AutoHotkey scripting.
[*:3rkkrfjk](done, I think) Fixed and improved ports of tools for AHK scripting, because the current ports of the tools are a bit hack-ish.
[*:3rkkrfjk](done) This will use the newest SciTE and Scintilla versions. The provided Scintilla version will only have support for AutoHotkey (only the AHK lexer will be present in conjuction with the lexer for error lists), that will make the DLL much smaller.
[*:3rkkrfjk](web installer done) (Installer) There will be an offline installer and a web installer (download packages from autohotkey.net then install them, like Microsoft does).
[*:3rkkrfjk]A version specially designed for inclusion within the AutoHotkey package.
[*:3rkkrfjk](done, I think) Integrated autohotkey.net support.
[*:3rkkrfjk](done) Code fold on open will be turned off by default, I had a lot of posts saying it was annoying.
[*:3rkkrfjk](done) Fix calltips that were disappearing when they weren't supposed to.
Toolbar support

The toolbar I think it's done. I've revamped the toolbar so that it's nicer.
Screenshot:
Posted Image

For existing SciTE4AutoHotkey v2 Alpha 1 users: Unpack the following .zip file into the SciTE folder (it replaces files):

https://ahknet.autoh...newtoolbar1.zip

autohotkey.net support

SciTE4AutoHotkey will come with integrated autohotkey.net support.
That means you will be able to upload your scripts with the ease of
a simple application that will read your script looking for special lines that will tell the tool what files to upload, where, etc.
The application will ask you and store (if you want) your username and password in a settings file. As privacity is a very important thing, the password will be encrypted, and for security reasons the encryption part of the script will not be publicly available, because a clever hacker could create a trojan that could steal your password.
Anyway, the syntax for those commands is (semicolon included):
;#AHKNet_CommandName parameter
or
;#AHKNet_CommandName "param1" "param2" "param3" ...
The current commands are:

UploadScript path/to/remote/script.ahk
It uploads the script (the script where the commands are) to the specified path and filename. The filename is NOT optional (maybe in future releases) while the path is.
It also checks that every specified path is present, if any of them isn't present it creates it.

UploadFile "path\to\local\script.ahk" "path/to/remote/script.ahk"
It uploads the specified file (relative to the directory where the script containing the commands is or absolute path) to the specified path and filename. The filename is NOT optional (maybe in future releases) while the path is.
It also checks that every specified path is present, if any of them isn't present it creates it.
Note: Quotes MUST be present.

ChangeDirectory directory
Works like a regular MS-DOS cd, the only change is that you use / instead of \.
This DOESN'T have directory checking so make sure the directory exists or else the tool will give you an error (use UploadScript or UploadFile before).

Example (uploads the script and its dependencies):

; Upload this script to myScripts/someScript
;#AHKNet_UploadScript myScripts/someScript/main.ahk

; Go to myScripts/someScript. Directory checking takes a lot of time
; so it's better to check only once (UploadScript), go there and upload
; the files without specifying the path.
;#AHKNet_ChangeDirectory myScripts/ahknetutil

; Upload the dependencies
;#AHKNet_UploadFile "dependency1.ahk" "dependency1.ahk"
;#AHKNet_UploadFile "dependency2.ahk" "dependency2.ahk"
;#AHKNet_UploadFile "dependency3.ahk" "dependency3.ahk"

OK, here is the link to the tool, it's a compiled AHK file (source coming soon):

Download

Oh, I forgot to say: It also detects a SciTE window and uses the text from it and the filename in the title bar.

NEW: Source (warning! It contains lots of unused stuff)

ahknetutil.ahk (colorful html version here, that demonstrates the new style)
#NoTrayIcon
#Include ftp.ahk
#NoEnv
#SingleInstance Force
SetWorkingDir, %A_ScriptDir%
DetectHiddenWindows, On

#Include toolbarmessages.ahk
#Include remotebuffer.ahk
#Include crypt.ahk ; contains crypting and decrypting routines
; I can't share that script because of security issues
; The only thing I can tell you is the function definitions:
; InitCrypt() (initializes the encryption system)
; CryptData(data) (compresses data to a 512-byte long hex stream)
; DecryptData(data) (decrypts a 512-byte long hex stream to the plain text)

; Command data
_CommandList = ChangeDirectory,UploadScript,UploadFile
_Command_ChangeDirectory_NParams = 1
_Command_UploadScript_NParams = 1
_Command_UploadFile_NParams = 2

hasSciTE := false
hasToolbar := false
InFile := ""

InitCrypt()

; Find a SciTE window.
IfWinExist, ahk_class SciTEWindow
{
	hasSciTE := true
	SciTE_HWND := WinExist()
	WinGetTitle, TempVar, ahk_id %SciTE_HWND%
	If(!RegExMatch(TempVar, "^(.+?) ([-*]) SciTE", Tempy)){
		MsgBox Bad SciTE window!
		ExitApp
	}else{
		InFile = %Tempy1%
		InFile_IsScratch := Tempy2 = "*" ? true : false
		InFile_IsUntitled := false
		IfNotExist, %InFile%
			InFile_IsUntitled := true ; probabily an Untitled window
		ControlGet, Scintilla_HWND, HWND,, Scintilla1, ahk_id %SciTE_HWND%
		Gosub, ConfigWorkingDir
	}
}

IfWinExist, AHKToolbar4SciTE ahk_class AutoHotkeyGUI
{
	hasToolbar := true
	Toolbar_HWND := WinExist()
}

If hasSciTE
	alltext := ScintillaGetText(Scintilla_HWND)
Else
	Goto, SettingsGUI

Goto, LoginAHKNet
;----------------

LoginAHKNet:
Gui, Add, Text, x12 y12 w170 h20, Login in autohotkey.net
Gui, Add, Text, x12 y32 w60 h20, Username:
Gui, Add, Edit, x82 y32 w100 h20 vAHKNetUser
Gui, Add, Text, x12 y52 w60 h20, Password:
Gui, Add, Edit, x82 y52 w100 h20 +Password Limit128 vAHKNetPassword
Gui, Add, Button, x12 y112 w60 h20 gAHKNetExecute, Execute
Gui, Add, Button, x82 y112 w40 h20 gExit, Exit
Gui, Add, Button, x132 y112 w50 h20 gSettingsGUIOpenFromLogin, Settings
Gui, Add, CheckBox, x12 y82 w170 h20 Checked vAHKNetRemember, Remember me
Gui, Show, w196 h145, autohotkey.net Utility
Gosub, ReadAndShowRecordedData
Return

AHKNetExecute:
Gui, Submit
If AHKNetRemember
{
	IniWrite, %AHKNetUser%, ahknet.ini, LoginData, User
	IniWrite, % CryptData(AHKNetPassword), ahknet.ini, LoginData, Password
}
Gui, Destroy
; <--- Connect to autohotkey.net --->
LittleSplashOn("Connecting to`nautohotkey.net...")
hFTPConnection := FTP_Open("autohotkey.net", 21, AHKNetUser, AHKNetPassword)
If !hFTPConnection
{
	LittleSplashOff()
	MsgBox, 16, autohotkey.net Tool,
	(LTrim
	Failed to connect to autohotkey.net!
	Possible causes:
	· Your Internet connection may be inactive or wrongly set-up
	· Bad username and/or password
	· The autohotkey.net server may be down
	)
	ExitApp
}

; <--- Process the AHK script for FTP commands --->
ncmds = 0
Loop, Parse, alltext, `n, `r
{
	cline = %A_LoopField%
	If(SubStr(cline, 1, 9) == ";#AHKNet_"){
		curcmd := SubStr(cline, 10)
		If(!RegExMatch(curcmd, "^(.+?) (.+?)$", Tempy)){
			MsgBox, 16, autohotkey.net Tool, Syntax error at line %A_Index%.
			ExitApp
		}
		cmd = %Tempy1%
		params = %Tempy2%
		if cmd not in %_CommandList%
		{
			MsgBox, 16, autohotkey.net Tool, Invalid command at line %A_Index%.
			ExitApp
		}
		If(!ParseParams("params", _Command_%cmd%_NParams)){
			MsgBox, 16, autohotkey.net Tool, % "Too few parameters at line " A_Index ", should be " _Command_%cmd%_NParams "."
			ExitApp
		}
		If(!ExecCmd(cmd, params1, params2, params3, params4)){
			FTP_Close()
			LittleSplashOff()
			MsgBox, 16, autohotkey.net Tool, There was an error during the upload!`nCrashed at line number: %A_Index%`nError message:`n`n%LastError%
			ExitApp
		}
	}
}
FTP_Close()
LittleSplashOff()
MsgBox, 64, autohotkey.net Tool, Upload succesful!

goto GUIClose
Return

SettingsGUI:
FileSelectFile, InFile, 1,, Select AHK file to process and upload, AHK scripts (*.ahk)
if InFile =
	ExitApp
IfNotExist, %InFile%
{
	MsgBox, 16, autohotkey.net Tool, File does not exist.
	ExitApp
}
Gosub, ConfigWorkingDir
FileRead, alltext, %InFile%
goto LoginAHKNet
return

ConfigWorkingDir:
SplitPath, InFile,, __Dir
SetWorkingDir, %__Dir%
Return

SettingsGUIOpenFromLogin:
MsgBox, 64, autohotkey.net Tool, Sorry`, settings GUI is currently not available. [*EXITAPP ACTION*]
GUIClose:
Exit:
ExitApp

ReadAndShowRecordedData:
IniRead, usr, ahknet.ini, LoginData, User, %A_Space%
IniRead, pwd, ahknet.ini, LoginData, Password, %A_Space%
; decrypt the password
If(StrLen(pwd) >= 512)
	pwd := DecryptData(pwd)
Else
	pwd =
GuiControl,, AHKNetUser, % usr
GuiControl,, AHKNetPassword, % pwd
pwd = ; security reasons
Return

LittleSplashOn(t){
	Global LS_Text
	Gui 99:Add, Text, vLS_Text w300 h225 +Border, % t
	Gui 99:-Caption +ToolWindow +AlwaysOnTop +Border
	Gui 99:Show, NoActivate
}

LittleSplashText(t){
	GuiControl 99:, LS_Text, % t
}

LittleSplashOff(){
	Gui 99:Destroy
}

;SendMessageUser32(hwnd, msg, wParam=0, lParam=0, type1="int", type2="int"){
;	Return DllCall("SendMessageA", "UInt", hwnd, "int", msg, type1, wParam, type2, lParam)
;}

ScintillaGetLength(hwnd){
	Global SCI_GETLENGTH
	SendMessage, SCI_GETLENGTH, 0, 0,, ahk_id %hwnd%
	Return ErrorLevel+1
}

ScintillaGetText(hwnd){
	Global SCI_GETLENGTH, SCI_GETTEXT
	SendMessage, SCI_GETLENGTH, 0, 0,, ahk_id %hwnd%
	length := ErrorLevel
	RemoteBuf_Open(hSBuf, hwnd, length + 2)
	SendMessage, SCI_GETTEXT, length + 1, RemoteBuf_Get(hSBuf),, ahk_id %hwnd%
	VarSetCapacity(sText, length + 2)
	RemoteBuf_Read(hSBuf, sText, length + 2)
	RemoteBuf_Close(hSBuf)
	Return sText
}

ScintillaSetText(hwnd, txt){
	Global SCI_SETTEXT
	length := StrLen(txt)+1
	RemoteBuf_Open(hSBuf, hwnd, length)
	RemoteBuf_Write(hSBuf, txt, length)
	SendMessage, SCI_SETTEXT, 0, RemoteBuf_Get(hSBuf),, ahk_id %hwnd%
	RemoteBuf_Close(hSBuf)
}

ParseParams(outVar, nParams){
	Global
	Local plist, pattern
	plist := %outVar%
	if nParams = 0
		Return true
	if nParams = 1
	{
		%outVar%1 := plist
		Return true
	}
	pattern =
	Loop, %nParams%
		pattern .= "\s*\x22(.+?)\x22"
	Return RegExMatch(plist, pattern, %outVar%) != 0
}

ExecCmd(cmd, param1="", param2="", param3="", param4=""){
	Global hFTPConnection, InFile, LastError
	If cmd = ChangeDirectory
	{
		LittleSplashText("Going to`n" param1 "...")
		LastError = Couldn't go to "%param1%"!
		Return FTP_SetCurrentDirectory(hFTPConnection, param1)
	}Else If cmd = UploadScript
	{
		LittleSplashText("Uploading the script to`n" param1 "...")
		; Run the prologue for file uploading
		If(!_CMDHelper_UploadPrologue(hFTPConnection, param1))
			Return false
		; Upload the script.
		Return _CMDHelper_Upload(hFTPConnection, InFile, param1)
	}Else If cmd = UploadFile
	{
		LittleSplashText("Uploading file:`n" param1 "`nto:`n" param2 "...")
		; Run the prologue for file uploading
		If(!_CMDHelper_UploadPrologue(hFTPConnection, param2))
			Return false
		; Upload the script.
		Return _CMDHelper_Upload(hFTPConnection, param1, param2)
	}Else
		Return false
}

_CMDHelper_UploadPrologue(hFTPConnection, path){
	Global LastError
	; First parse it into a series of directories.
	StringSplit, DirArray, path, /
	If DirArray0 != 0
	{
		dirname =
		Loop, % DirArray0 - 1
		{
			dirname .= DirArray%A_Index% "/"
			; The classic cd test
			if(!FTP_GetCurrentDirectory(hFTPConnection, TempDir)){
				LastError = Couldn't get current directory!
				Return false
			}
			if(!FTP_SetCurrentDirectory(hFTPConnection, SubStr(dirname, 1, StrLen(dirname)-1))){
				if(!FTP_CreateDirectory(hFTPConnection, SubStr(dirname, 1, StrLen(dirname)-1))){ ; ... so we create it.
					LastError := "Couldn't create folder " SubStr(dirname, 1, StrLen(dirname)-1) "!"
					Return false
				}
			}else{
				; The test was succesful, but now we have to return to the directory
				if(!FTP_SetCurrentDirectory(hFTPConnection, TempDir)){
					LastError = Couldn't go to "%TempDir%"!
					Return false
				}
			}
		}
	}
	Return true
}

_CMDHelper_Upload(hFTPConnection, from, to){
	Global LastError
	; Check the existance of the file
	if(FTP_GetFileSize(hFTPConnection, to, 2) != -1){
		if(!FTP_DeleteFile(hFTPConnection, to)){
			LastError = Couldn't delete file %to%!
			Return false
		}
	}
	; Upload the file.
	LastError = Couldn't upload "%from%" to "%to%"!
	Return FTP_PutFile(hFTPConnection, from, to, 2)
}

FTP_GetCurrentDirectory(hConnect,ByRef DirName){
	VarSetCapacity(DirName, 256)
	VarSetCapacity(MaxDirN, 4)
	NumPut(256, MaxDirN)
	r := DllCall("wininet\FtpGetCurrentDirectoryA", "uint", hConnect, "str", DirName, "str", MaxDirN)
	If (ErrorLevel or !r)
		Return 0
	If(NumGet(MaxDirN) > 256){
		VarSetCapacity(DirName, NumGet(MaxDirN))
		r := DllCall("wininet\FtpGetCurrentDirectoryA", "uint", hConnect, "str", DirName, "str", MaxDirN)
	}
	If (ErrorLevel or !r)
		Return 0
	Else
		Return 1
}

[linkneutralizer]ftp.ahk (not made by me, download link)

toolbarmessages.ahk
WM_USER := 0x400
TBM_SELECTTOOL := 0x1
TBM_LAUNCHTOOL := 0x2
TBM_CLOSEALL := 0x3

; Scintilla messages
SCI_GETLENGTH := 2006
SCI_SETTEXT := 2181
SCI_GETTEXT := 2182

remotebuffer.ahk (not made by me, link)

I can't share the file crypt.ahk because of what I said before.

BETA RELEASE TESTING PROGRAM

(NEW BUGFIXED BETA - IF YOU PREVIOUSLY DOWNLOADED THE BETA REDOWNLOAD IT)
After the Alpha 1, here comes the beta!
Download link!: https://ahknet.autoh...tkey_2/beta.zip
For those who prefer the PSPad syntax highlighting style and use the zip: Rename the file ahk.style.pspad.properties to ahk.style.properties.
Don't forget to read the readme.txt file!

Here is an installer for lazy people:
https://ahknet.autoh...tainstaller.exe

Compile_AHK II is bundled with the installer version (I hope the author doesn't care ;)).

EDIT: Basic toolbar support added.
EDIT2: Added more pictures of the toolbar.
EDIT3: Added information on autohotkey.net support.
EDIT4: Added source.
EDIT5: Added Alpha 1.
EDIT6: Added PSPad color scheme.
EDIT7: Added new toolbar.
EDIT8: ADDED BETA!
EDIT9: Added installer and fixed some bugs in the beta too.
EDITA: Added webpage.
EDITB: Added counters and release date.

If you remember me notice that I've improved my English.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Added basic toolbar support.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Updated toolbar support.

ttzm
  • Members
  • 24 posts
  • Last active: Jan 25 2009 01:23 PM
  • Joined: 17 Feb 2008
I prefer to use the ahk.properties came with AutoHotkey, and the original edition of SciTE.

I think it's more important to improve the ahk.properties came with AutoHotkey and the AutoHotkey.api made by NotePad++

And finally, wish Chris could get in touch with the author of SciTE, make SciTE as the default Editor of AutoHotkey :)
喜欢看中文的可以来 AutoHotkey 爱好者论坛 : forum.ahkbbs.cn | ahk.5d6d.com

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
I'm now working a bit on autohotkey.net support.
It will consist on a couple of "directives" in your AHK script that will be read by the utility and interpreted, specifying what files to upload, what to do, etc.

I prefer to use the ahk.properties came with AutoHotkey, and the original edition of SciTE.

I think it's more important to improve the ahk.properties came with AutoHotkey and the AutoHotkey.api made by NotePad++

And finally, wish Chris could get in touch with the author of SciTE, make SciTE as the default Editor of AutoHotkey :)


You're missing a couple things:
[*:2jezk92f] The current ahk.properties file that comes with AutoHotkey is a quick edit of the ASM properties (not even using PhiLho's lexer).
[*:2jezk92f] SciTE4AutoHotkey uses a custom version of Scintilla with a lexer for AutoHotkey (thanks PhiLho for the lexer), making syntax highlighting MUCH better.
[*:2jezk92f] SciTE4AutoHotkey is specially designed for the AutoHotkey community (that means it comes with a bunch of tools that make life easier to an AHK scripter).
[*:2jezk92f] Chris told me one year ago that he is willing to make this the default editor for AutoHotkey scripts.
[*:2jezk92f] You don't need the autor of SciTE's permission to distribute a SciTE version as long as you retain the License.txt file. Anyway it's a good thing to show the autor of SciTE that we're using a modified version of SciTE.EDIT: Typo!

TheGood
  • Members
  • 589 posts
  • Last active: Mar 22 2014 03:22 PM
  • Joined: 30 Jul 2007
Will there be any kind of autocompletion/intellisense system integrated in this?

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

Will there be any kind of autocompletion/intellisense system integrated in this?

Yes of course (both)! :p
And it will work properly, not like the older versions of SciTE4AHK.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Added information on autohotkey.net support.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Added Alpha 1 to the main post (!).

Rhys
  • Members
  • 761 posts
  • Last active: Aug 09 2013 04:53 PM
  • Joined: 17 Apr 2007
[tagged] to check out later... looks very interesting so far!

Zach Thibeau
  • Members
  • 57 posts
  • Last active: Nov 24 2010 05:43 PM
  • Joined: 22 Mar 2008
is there going to be a new lexer for ahk? if so could I obtain a copy to use for my notepad2 Mod project? and btw the new scite mod is looking pretty good :p

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

is there going to be a new lexer for ahk? if so could I obtain a copy to use for my notepad2 Mod project? and btw the new scite mod is looking pretty good :p


It's the same lexer as before (PhiLho's lexer), but the Scintilla version that I'm using is based on the newest one, so it would be a good idea to upgrade.
But what I don't know is how Notepad2 handles Scintilla so it may be
uncompatible (please note that I've removed every lexer except the AutoHotkey lexer and the error list lexer.)...

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
Hello and glad to see you back in fincs
Do you have any sort of idea when you plan to have a non beta
did you realise all of the items in the tools menu arent being included automatically in this one i know you did :)
Never lose.
WIN or LEARN.

Zach Thibeau
  • Members
  • 57 posts
  • Last active: Nov 24 2010 05:43 PM
  • Joined: 22 Mar 2008

is there going to be a new lexer for ahk? if so could I obtain a copy to use for my notepad2 Mod project? and btw the new scite mod is looking pretty good :p


It's the same lexer as before (PhiLho's lexer), but the Scintilla version that I'm using is based on the newest one, so it would be a good idea to upgrade.
But what I don't know is how Notepad2 handles Scintilla so it may be
uncompatible (please note that I've removed every lexer except the AutoHotkey lexer and the error list lexer.)...

ohh not it isn't incompatible, in fact it is fully compatible :p I already added it to <!-- m -->http://www.autohotke...ic37652-15.html<!-- m --> along with code folding etc. I was just wondering if there was a new version of the Ahk lexer thats all, my notepad2 build already using the newest scintilla library for sometime now.

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
New toolbar added. Enjoy!