Writing to SCITE output panel

Post your working scripts, libraries and tools for AHK v1.1 and older
isurface
Posts: 14
Joined: 20 Oct 2013, 04:07

Writing to SCITE output panel

02 Nov 2013, 02:26

hi, I writed a simple function to output information to SCITE panel, it's useful for debug.

Examples

Code: Select all

; repeat three times, "#" means the head, "@`n" means the tail
print("ABC", 3, "@`n", "#") 
; output: #ABCABCABC@

; Only repeat two times
print("ABC", 2)
; output: ABCABC

print("ABC", "###`n")
; output: ABC###

print("ABC", "`n", "!!!!")
; output: !!!!ABC

print(2 + 1, 5)
; output: 33333
Function:

Code: Select all


print(anyvar, params*)
{
	outputStr := ""	; output strings
	times := 1		; The number of "str" to repeat in outputStr
	tailStr := ""	; Appeared in the end of outputStr
	headStr := ""	; The begining of outputStr
	
	for index, var in params
	{
		if (index >= 4), return	; Ignore the remaining paraments
			
		vType := _type(var)
		if (vType = "Integer")  ; suppose all inputs are vaild, "Integer" will appear no more than once
		{
			times := var
		}
		else if (vType = "String") 
		{
			if (tailStr = "")	; tail comes first
			{
				tailStr := var
			}
			else
			{
				headStr := var
			}
		}
	}
	outputStr := headStr
	Loop % times
	{
		outputStr .= anyvar
	}
	outputStr .= tailStr
	
	; write to ouput panel of SCITE
	FileAppend , % outputStr, *
	
	return outputStr
}

_type(n)
{
	; V2 supports type function
	if (SubStr(A_AhkVersion, 1, 1) = 2)
	{
		return type(n)
	}
	
	; V1
	ret := (RegExMatch(n, "^[+]?[0-9]+$") > 0) or (RegExMatch(n, "i)^0x[0-9a-f]+$") > 0) ; An integer
	if (ret)
	{
		return "Integer"
	}
	return "String"
}

User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Writing to SCITE output panel

17 Dec 2015, 19:45

I tried using this but it reported an error on line 47 under the _type(n) function. Below as the actual line.

Code: Select all

return type(n)
Any suggestions?
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 159 guests