[Request]: Official Library & Wrapper

Propose new features and changes
User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 07:50

I think it would be good to have a web-based application for viewing and searching the libraries.
For downloading and updating the local clone of the library it might make sense to have a command line tool.
(This command line tool could do other stuff - like switching AHK versions or cloning specific libraries to the current project folder)

A lot of the other things depends on how many libraries we want to offer.
I think we could create a good library service that can provide all kinds of libraries - from wrappers that use ControlSend to control spotify in the background to game engines.
Also I believe that author should not play a strong role in the categorization at all. One library might be maintained by multiple people during its lifetime.
It woulöd be awkward to remove all references to an old author - like a prefix to all functions for example.
To be honest I'd rather not work on libraries like that. Nonetheless the author should be mentioned on the site.
Most other package managers care a lot about the name of the library.

For the categorisation on the web interface we should act according to the rule "the more info the better".
One idea would be a tag system where the tags that are added to a library ask the user for specific information.
e.g. if you add a tag 'coding paradigm' it will ask you for 'oop', 'procedural' or 'mixed'.

That would also allow us to track what AHK version the library requires. For that we would have to add a 'requires'-tag which asks for minimum AHK-Versions.
I don't think that AHK Basic should be of any concern when making any considerations. Our main focus should be AHK v1.1 and AHK v2.
But if we work correctly then there should be no issues with introducing other AHK Versions/Forks into our system.

It would be good if we set some convention as a standard and check if the added library fulfills these requirements - if they dont then they wont be added.

Rather than example code it would be better to allow all users to create a wiki - where they explain each function /class & method.
Maybe it would bve even better to establish a standard for documenting using comments in the AHK source and forcing each library to have those.
Recommends AHK Studio
guest3456
Posts: 2464
Joined: 09 Oct 2013, 10:31

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 09:18

tomoe_uehara wrote:Before jumping into a conclusion, let's do some brainstorm first about how it will looks like.
  • Where the code will be hosted? (Git based / Cloud Storage / other)
  • Do we need a redundant mirror / backup storage?
  • How can people contribute to the lib? (Add new code / modify / bugfix / delete obsolete code)
  • Who will do the code review?
  • Do we need some sort of Version Control? (ie. be able to download old codes)
  • Which AHK version/flavour will we use for the lib?
  • How will we name each file on the lib, will we use standardized file naming convention?
  • How will we present the lib to the user? (Git client / AHK GUI / Web based / other)
  • How do we categorize the lib? (By name / function / author / other)
  • How about file searching capability, will it slows down if lots of libs has been added in the future?
  • Do we need to include example code(s) on each libs?
  • What about license, lots of codes were written by users whom don't exist anymore, can we add their codes into the lib?
Any ideas are welcome ;)
all reasons to keep libraries separate and in their own git repos and maintained by their own individual authors

legit question:
just exactly what problem are you all attempting to solve with this?

i think you're creating a solution for a problem that doesn't exist, or isn't clearly defined. if someone needs a lib, is it that hard for them to find? a few extra clicks to download a .zip from github or the forums? is it worth the hassle to create a package manager system for this language? exactly which ahk libraries are all that important?

i'm going to throw a -1 vote for including any lib with the installer. the users in this thread are all power users who want/need these unofficial libraries which are created by others. normal users will have no need and will just complicate things

User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 09:28

The forum is an inadequate solution for maintaining and sharing libraries. The good libraries are hidden under a mountain of trash and its hard to find them.

Also you are wrong on the fact that normal users don't benefit from this.
If you can easily take the library that controls you specific program and combine it with a few hotkeys of your own then you are a 100 times faster than just using Send and Click anbd finding a way to make it work for your program yourself.
Also as we mentioned it isn't going to be a lib but a tool to get libs.
Some users would benefit from a library for doing better ImageSearch.
Recommends AHK Studio
guest3456
Posts: 2464
Joined: 09 Oct 2013, 10:31

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 17:17

nnnik wrote: If you can easily take the library that controls you specific program and combine it with a few hotkeys of your own then you are a 100 times faster than just using Send and Click anbd finding a way to make it work for your program yourself.
what program/lib are you talking about in this example?

User avatar
Frosti
Posts: 142
Joined: 27 Oct 2017, 14:30
GitHub: Ixiko

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 17:45

I add my vote to the opinion of nnnik. At now I collected more than 1200 libraries. There are few libraries with a good description. I ever ask myself why people puplish very good scripts without any description. Why not collect what exists and discuss if its a treasure or not. Do we need more AI before we use the full power of human swarm intelligence? We have one of the freshest human minds here in this forum - I love feiyues idea's - why risk the lost of imformation?
User avatar
tomoe_uehara
Posts: 209
Joined: 05 Oct 2013, 12:37
Contact:

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 19:21

guest3456 wrote:just exactly what problem are you all attempting to solve with this?

i think you're creating a solution for a problem that doesn't exist, or isn't clearly defined. if someone needs a lib, is it that hard for them to find? a few extra clicks to download a .zip from github or the forums? is it worth the hassle to create a package manager system for this language? exactly which ahk libraries are all that important?
Example case: Sumon created a wrapper for Twitter API, he uploaded his code, and then VxE also made similar lib called HttpRequest which can be downloaded from link1 or link2
And guess what, all resources are not available anymore...
Those codes are lost until:
1. The original author reupload their code (fix the broken link).
2. Someone who happen to have their code, reuploaded the code to forum again.
3. Someone create a whole new code.

If you have joined the community while autohotkey.net was still exist, you can imagine how many files are lost, it means countless of manhours are wasted.
People are salvaging whatever they can find.
I know this issue was from several years ago, but if you were there, it was catastrophic :crazy:

Another example, [Func] SHA-256 with HMAC is buried on page 66 of 70 (at current date), older scripts are always forgotten, of course it still can be located by using the Search button ;)
guest3456 wrote:i think you're creating a solution for a problem that doesn't exist, or isn't clearly defined.
Yes you are absolutely right, creating a library collection is "creating a solution for a problem that doesn't exist".
If majority of users are fine with what we have now, it's fine too, we don't need to collect useful files and put them together into a collection, because all resources are available on the web, until another disaster strikes.
But I hope it won't happen again though... :D
guest3456
Posts: 2464
Joined: 09 Oct 2013, 10:31

Re: [Request]: Official Library & Wrapper

21 Sep 2018, 21:54

tomoe_uehara wrote:
guest3456 wrote:just exactly what problem are you all attempting to solve with this?
Example case: Sumon created a wrapper for Twitter API, he uploaded his code, and then VxE also made similar lib called HttpRequest which can be downloaded from link1 or link2
And guess what, all resources are not available anymore...
ok so now you've defined the problem. that is, insufficient backups, or unreliable hosting, or just losing access to the code over time.

are you sure your proposal solves this problem? suppose what you envision existed back then. we would now only have access to VxE's httpRequest if he had submitted it to your central official library repository, and someone accepted it. so you create this library tomorrow. what are you going to do, add every single snipped from the Scripts&Functions forum so that nothing is ever lost?

for reference, here is my copy of HttpRequest that i saved years ago, in case you need it:

Code: Select all


; ##################################################################################################
; ###                                       HTTPRequest                                          ###
; ##################################################################################################

HTTPRequest( url, byref in_POST_out_DATA="", byref inout_HEADERS="", proxy_info="" ) { ; -----------
; Function by [VxE] (6-20-2011). Special thanks to derRaphael for inspiring this function.
; Submits one request to the specified URL and returns the number of bytes in the response.
; 'in_POST_out_DATA' must be a variable, which may contain data to be send as POST data. If the
; request completes successfully, 'in_POST_out_DATA' receives the response data. 'inout_HEADERS'
; must be a variable, and may contain headers to use for the request. If the request completes
; successfully, 'inout_HEADERS' receives the response headers; otherwise it receives an error summary.
; NOTE: proxy_info should be blank if you don't wish to use a proxy, otherwise it should be the
; address of the proxy you wish to use. Anything to the right of the first newline character is
; considered to be part of the proxy bypass list. E.g: proxy_info := "www.proxy.com`nwww.google.com"
; would tell HTTPRequest to use the proxy 'www.proxy.com', but not for urls with 'www.google.com'.
; NOTE: If the function encounters an error, an error message will be put into 'inout_HEADERS' and
; the function will return '0'. Since it is possible for a successful request to elicit a response
; with zero bytes, you should consult the response headers to determine if an error occured. On the
; other hand, if you are requesting data, a zero-byte response would indicate an error anyways.
; IMPORTANT: each header in 'inout_HEADERS' must conform to the following format:
; "<header name>: <header text>", and multiple headers MUST be separated by a linefeed.
; THE FOLLOWING HEADERS ARE HANDLED SPECIALLY:
; Content-Length  -> the header is added automatically IF AND ONLY IF the post data is not empty.
;                    Use the Content-Length header to override data length  auto-detection.
; Content-MD5     -> the value is computed automatically IF AND ONLY IF the VALUE is left blank.
; User-Agent      -> the header is set automatically if it isn't specified or if the value is blank.
;                    NOTE: The automatic user-agent contains the script file's name and OS version.
;                    If this is not desirable, please specify your own user-agent.
; Referrer        -> is uncorrected to 'Referer' because that's the actual official header name.
; +Flag           -> the value must either be an exact power of 2 or the NAME of one of the internet
;                    flags specified below. Use this to set custom flags for a request.
;                    E.g: "+Flag: INTERNET_FLAG_FORMS_SUBMIT", OR "+Flag: 0x40"
; >>              -> indicates the beginning of a file path to which to write the downloaded data.
;                    After the data has been written to the indicated file, the file is read into
;                    'in_POST_out_DATA' (this function still returns the number of bytes downloaded,
;                    which may not be the actual length of the data). This will overwrite the file
;                    if it already exists. This is functionally similar to URLDownloadToFile.
; IMPORTANT: for users of unicode versions of AHK: if you want to submit text as POST data (either
; a query string or XML feed or other text) AND your target url does not accept UTF-16 (wide-char)
; text, HTTPRequest can automatically convert the POST text to UTF-8, but ONLY IF you supply a
; Content-Type header with the attribute 'charset=UTF-8'. E.g: Content-Type: text/xml charset=UTF-8

     Static URL_Components, WorA := "", ModuleName := "WinINet.dll"
		, Scheme, Host, User, Pass, UrlPath, ExtraInfo, URL_Components
		, INTERNET_OPEN_TYPE_DIRECT := 1, INTERNET_OPEN_TYPE_PROXY := 3, hModule := 0
		, INTERNET_FLAG_DONT_CACHE                     := 0x04000000
		, INTERNET_FLAG_NO_CACHE_WRITE                 := 0x20000000
		, INTERNET_FLAG_FORMS_SUBMIT                   := 0x00000040
		, INTERNET_FLAG_FROM_CACHE                     := 0x01000000
		, INTERNET_FLAG_FWD_BACK                       := 0x00000020
		, INTERNET_FLAG_HYPERLINK                      := 0x00000400
		, INTERNET_FLAG_IGNORE_CERT_CN_INVALID         := 0x00001000
		, INTERNET_FLAG_IGNORE_CERT_DATE_INVALID       := 0x00002000
		, INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP        := 0x00008000
		, INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS       := 0x00004000
		, INTERNET_FLAG_KEEP_CONNECTION                := 0x00400000
		, INTERNET_FLAG_MAKE_PERSISTENT                := 0x02000000
		, INTERNET_FLAG_MUST_CACHE_REQUEST             := 0x00000010
		, INTERNET_FLAG_NEED_FILE                      := 0x00000010
		, INTERNET_FLAG_NO_AUTH                        := 0x00040000
		, INTERNET_FLAG_NO_AUTO_REDIRECT               := 0x00200000
		, INTERNET_FLAG_NO_CACHE_WRITE                 := 0x04000000
		, INTERNET_FLAG_NO_COOKIES                     := 0x00080000
		, INTERNET_FLAG_NO_UI                          := 0x00000200
		, INTERNET_FLAG_OFFLINE                        := 0x01000000
		, INTERNET_FLAG_FROM_CACHE                     := 0x08000000
		, INTERNET_FLAG_PRAGMA_NOCACHE                 := 0x00000100
		, INTERNET_FLAG_RAW_DATA                       := 0x40000000
		, INTERNET_FLAG_READ_PREFETCH                  := 0x00100000
		, INTERNET_FLAG_RELOAD                         := 0x80000000
		, INTERNET_FLAG_RESTRICTED_ZONE                := 0x00020000
		, INTERNET_FLAG_RESYNCHRONIZE                  := 0x00000800
		, INTERNET_FLAG_SECURE                         := 0x00800000
		, iFlagList := "
		( LTRIM JOIN
			,INTERNET_FLAG_DONT_CACHE,INTERNET_FLAG_NO_CACHE_WRITE,INTERNET_FLAG_FORMS_SUBMIT
			,INTERNET_FLAG_FROM_CACHE,INTERNET_FLAG_FWD_BACK,INTERNET_FLAG_HYPERLINK
			,INTERNET_FLAG_IGNORE_CERT_CN_INVALID,INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
			,INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP,INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS
			,INTERNET_FLAG_KEEP_CONNECTION,INTERNET_FLAG_MUST_CACHE_REQUEST
			,INTERNET_FLAG_NEED_FILE,INTERNET_FLAG_NO_AUTH,INTERNET_FLAG_NO_AUTO_REDIRECT
			,INTERNET_FLAG_NO_CACHE_WRITE,INTERNET_FLAG_NO_COOKIES,INTERNET_FLAG_NO_UI
			,INTERNET_FLAG_OFFLINE,INTERNET_FLAG_FROM_CACHE,INTERNET_FLAG_PRAGMA_NOCACHE
			,INTERNET_FLAG_RAW_DATA,INTERNET_FLAG_READ_PREFETCH,INTERNET_FLAG_RELOAD
			,INTERNET_FLAG_RESTRICTED_ZONE,INTERNET_FLAG_RESYNCHRONIZE,INTERNET_FLAG_SECURE,
		)"

	If ( WorA = "" ) ; Initialize Static Varaibles
	{
		WorA := A_IsUnicode ? "W" : "A" ; Either 'A' (ansi) or 'W' (wide-chars).
	; Filling the URL_Components structure with the addresses of static variables only needs to
	; happen once per script instance. For unicode, the string capacities are doubled.
	; URL_COMPONENTS structure > http://msdn.microsoft.com/en-us/library/aa385420%28v=VS.85%29.aspx
		VarSetCapacity( URL_Components, 60, 0 )
		NumPut( 60, URL_Components, 0, "Int" )
		VarSetCapacity( Scheme, 16 << !! A_IsUnicode, 0 )
		NumPut( &Scheme, URL_Components, 4, "UInt" )
		VarSetCapacity( Host, 2048 << !! A_IsUnicode, 0 )
		NumPut( &Host, URL_Components, 16, "UInt" )
		VarSetCapacity( User, 2048 << !! A_IsUnicode, 0 )
		NumPut( &User, URL_Components, 28, "UInt" )
		VarSetCapacity( Pass, 2048 << !! A_IsUnicode, 0 )
		NumPut( &Pass, URL_Components, 36, "UInt" )
		VarSetCapacity( UrlPath, 4096 << !! A_IsUnicode, 0 )
		NumPut( &UrlPath, URL_Components, 44, "UInt" )
		VarSetCapacity( ExtraInfo, 4096 << !! A_IsUnicode, 0 )
		NumPut( &ExtraInfo, URL_Components, 52, "UInt" )
	}

	inout_HEADERS := "`r`n" inout_HEADERS "`r`n" ; Padding... yes it's important.

	; Determine the length of the POST data and auto-add the content-type if needed
	If RegexMatch( inout_HEADERS, "i)\v\h*Content-Length:\h*\K(?:0x[\da-f]+|\d+)", Content_Length )
	{
		Content_Length := RegexReplace( Content_Length + 0.0, ".*\K\..*" ) ; coerce to decimal
		; Give a default content-type header if there IS POST data but no content-type header.
		If !RegexMatch( inout_HEADERS, "i)\v\h*Content-Type:\h*\K\w+", Content_Type )
		{
			StringGetPos, pos, in_POST_out_DATA, <?xml
			If !( ErrorLevel ) && ( pos < 5 )
				Content_Type := "text/xml"
			Else Content_Type := "application/x-www-form-urlencoded"
			inout_HEADERS .= "Content-Type: " Content_Type "`r`n"
		}
	}
	Else ; the POST is either blank or contains text so we can determine the length automatically.
	{
		StringLen, Content_Length, in_POST_out_DATA
		If ( 0 < ( Content_Length := RegexReplace( Content_Length + 0.0, ".*\K\..*" ) ) )
		{
			inout_HEADERS .= "Content-Length: " Content_Length "`r`n"
			; Give a default content-type header if there IS POST data but no content-type header.
			If !RegexMatch( inout_HEADERS, "i)\v\h*Content-Type:\h*\K\V+", Content_Type )
			{
				StringGetPos, pos, in_POST_out_DATA, <?xml
				If !( ErrorLevel ) && ( pos < 5 )
					Content_Type := "text/xml"
				Else Content_Type := "application/x-www-form-urlencoded"
				inout_HEADERS .= "Content-Type: " Content_Type "`r`n"
			}
		}
	}

	; If the user wants to POST text in UTF-8, but they are using a unicode-version of AHK,
	; convert the POST data to UTF-8 and recalculate the length
	If ( A_IsUnicode && InStr( Content_Type, "charset=UTF-8" ) )
	{
		buffers := in_POST_out_DATA
		; WideCharToMultiByte > http://msdn.microsoft.com/en-us/library/dd374130%28v=vs.85%29.aspx
		VarSetCapacity( in_POST_out_DATA, size := DllCall( "WideCharToMultiByte"
			, "UInt", 65001, "UInt", 0, "UInt", &buffers, "UInt", Content_Length
			, "UInt", 0, "UInt", 0, "UInt", 0, "UInt", 0 ), 0 )
		DllCall( "WideCharToMultiByte"
			, "UInt", 65001, "UInt", 0, "UInt", &buffers, "UInt", Content_Length
			, "UInt", &in_POST_out_DATA, "UInt", size, "UInt", 0, "UInt", 0 )
		size := RegexReplace( size + 0.0, ".*\K\..*" )
		StringReplace, inout_HEADERS, inout_HEADERS, % "Content-Length: " Content_Length "`r`n", % "Content-Length: " size "`r`n"
		Content_Length := size
	}

	; Determine the accept type
	If !RegexMatch( inout_HEADERS, "i)\v\h*Accept:\h*\K\V+", Accept_Types )
		Accept_Types := "text/xml, text/* q=0.2, */* q=0.1"

	; Get the agent, if it's specified. Otherwise, add an auto-generated agent that has enough
	; info to satisfy any API that requires an informative agent.
	If !RegexMatch( inout_HEADERS, "i)\v\h*User-Agent:\h*\K\V+", Agent )
		inout_HEADERS .= "User-Agent: " ( Agent := RegexReplace( A_ScriptName, ".*\K\..*" )
				. "/1.0 (Language=AutoHotkey/" A_AhkVersion "; Platform=" A_OSVersion ")" ) "`r`n"

	; See if the user wants to output to a file.
	If RegexMatch( inout_HEADERS, "i)\v\h*>>?\h*\K(?:\w:)?[^`t`r`n:*?""<>|]+", output_file )
	{
		SplitPath, output_file,, folder
		IfNotExist, % folder
			output_file := ""
	}

	; Check the referer url
	RegexMatch( inout_HEADERS, "i)\v\h*Referr?er:\h+\K\V+", Referer_URL )

	; Check the content-MD5 header
	If RegexMatch( inout_HEADERS, "i)\v\h*Content-MD5:\h*\K\w*", pos ) && 40 != StrLen( pos )
		inout_HEADERS := RegexReplace( inout_HEADERS, "i)\v\h*Content-MD5:\K\h+\V*"
					, " " HTTPRequest_MD5( in_POST_out_DATA, Content_Length ) )

	; Typical flags for normal HTTP requests.
	Flags := 0
	Flags |= INTERNET_FLAG_KEEP_CONNECTION
	Flags |= INTERNET_FLAG_RELOAD
	Flags |= INTERNET_FLAG_NO_CACHE_WRITE

	; Properly format the headers. For each line in the headers, check to make sure it's formatted
	; like a header (Name: Value) and if it is, then append it to the the actual headers followed
	; by CRLF. Also, check the headers for additional flags the user may want to use.
	Loop, Parse, inout_HEADERS, `n, % "`t`r "
		If ( A_Index = 1 )
			inout_HEADERS := ""
		Else If RegexMatch( A_LoopField, "^(?<name>[^\h:]+):\h*\K.+", header )
				If ( headername != "+Flag" && headername != "-Flag" )
					inout_HEADERS .= headername ": " header "`r`n"
			Else IfInString, iFlagList, % "," header ","
					Flags := Asc( A_LoopField ) = 45 ? ~%header% & Flags : %header% | Flags
				Else If ( header = 1 << Ln( header ) / Ln( 2 ) )
					Flags := Asc( A_LoopField ) = 45 ? ~header & Flags : header | Flags

	; Load WinINet.dll. Because the 'hModule' is static, we can tell if the function interrupted
	; itself. If the function is interrupting itself, it shouldn't unload WinINet before ending.
	If !( interrupted := 0 != hModule )
	&& !( hModule := DllCall( "LoadLibrary" WorA, "UInt", &ModuleName ) )
	{
		inout_HEADERS := "There was a problem loading WinINet.dll. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		Return 0
	}

	; Put the sizes into the URL_Components structure (the sizes are the same for unicode and ansi
	; because the sizes are actually a character count, not a byte count).
	NumPut( 16, URL_Components, 8, "Int" )
	NumPut( 2048, URL_Components, 20, "Int" )
	NumPut( 2048, URL_Components, 32, "Int" )
	NumPut( 2048, URL_Components, 40, "Int" )
	NumPut( 4096, URL_Components, 48, "Int" )
	NumPut( 4096, URL_Components, 56, "Int" )

	; InternetCrackUrl > http://msdn.microsoft.com/en-us/library/aa384376%28VS.85%29.aspx
	If !DllCall( "WinINet\InternetCrackUrl" WorA, "UInt", &URL, "Int", StrLen( URL ), "UInt", 0, "UInt", &URL_Components )
	{
		inout_HEADERS := "There was a problem with the provided URL (InternetCrackUrl). ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}
	; The port should always be 80... but if it's zero, then something went terribly wrong
	If !( Port := NumGet( URL_Components, 24, "UShort" ) )
	{
		inout_HEADERS := "There was a problem with the provided URL. The connection port could not be determined."
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; Update the internal lengths of the strings that were just cracked
	VarSetCapacity( Scheme, -1 )
	VarSetCapacity( Host, -1 )
	VarSetCapacity( User, -1 )
	VarSetCapacity( Pass, -1 )
	VarSetCapacity( UrlPath, -1 )
	VarSetCapacity( ExtraInfo, -1 )
	Query := UrlPath ExtraInfo

	If ( Scheme = "https" ) ; Apply these flags to HTTPS requests
		Flags |= INTERNET_FLAG_IGNORE_CERT_CN_INVALID | INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_DATE_INVALID
	Else If ( Scheme != "http" )
	{
	; Schemes other than HTTP and HTTPS are not supported by this function.
		inout_HEADERS := "HTTPRequest does not support '" Scheme "' type connections."
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; Handle the proxy specifications (if any)
	Loop, Parse, proxy_info, `n, % "`t`r "
		If ( A_Index = 1 )
			proxy_url := A_LoopField, proxy_info := ""
		Else proxy_info .= A_LoopField "`r`n"
	StringTrimRight, proxy_info, proxy_info, 2
	bUseProxy := 0 != InStr( proxy, "." ) ; don't bother verifying the proxy url
		
	; Tweak the accept type string to look like a list
	Loop, Parse, Accept_Types, `,
		Loop, Parse, A_LoopField, % Chr( 59 + !( pos := A_Index ) ), % "`t`n`r "
			If ( A_Index = 1 )
				If ( pos = 1 )
					Accept_Types := A_LoopField
				Else Accept_Types .= "`n" A_LoopField
	VarSetCapacity( int_array, pos + 1 << 2, 0 )

	; Build an array of pointers to the valid accept type strings and insert nulls into the
	; accept types string to make it look like a collection of null-terminated strings.
	pos := 0
	Loop, Parse, Accept_Types, `n
	{
		NumPut( &Accept_Types + pos, int_array, A_Index - 1 << 2, "UInt" )
		pos += StrLen( A_LoopField ) << !!A_IsUnicode
		NumPut( 0, Accept_Types, pos, A_IsUnicode ? "UShort" : "UChar" )
		pos += 1 << !!A_IsUnicode
	}

	; Get an internet handle. InternetOpen > http://msdn.microsoft.com/en-us/library/aa385096(v=VS.85).aspx
	hInternet := DllCall( "WinINet\InternetOpen" WorA
		, "UInt", &Agent
		, "UInt", bUseProxy ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_DIRECT
		, "UInt", bUseProxy ? &proxy_url : 0
		, "UInt", bUseProxy && proxy_info = "" ? 0 : &proxy_info
		, "UInt", 0 )

	If !( hInternet )
	{
		inout_HEADERS := "There was a problem opening an internet handle. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; Open a connection. InternetConnect > http://msdn.microsoft.com/en-us/library/aa384363%28v=VS.85%29.aspx
	hConnection := DllCall( "WinINet\InternetConnect" WorA, "UInt", hInternet
		, "UInt", &Host
		, "UInt", Port
		, "UInt", &User
		, "UInt", &Pass
		, "UInt", 3 ; INTERNET_SERVICE_HTTP = 3
		, "UInt", Flags
		, "UInt", 0 )

	If !( hConnection )
	{
		inout_HEADERS := "There was a problem opening a connection to the host. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hInternet )
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; Open a request. HttpOpenRequest > http://msdn.microsoft.com/en-us/library/aa384233%28v=VS.85%29.aspx
	hRequest := DllCall( "WinINet\HttpOpenRequest" WorA, "UInt", hConnection
		, "Str", Content_Length = 0 ? "GET" : "POST"
		, "UInt", &Query
		, "Str", "HTTP/1.1"
		, "UInt", &Referer_URL
		, "UInt", &int_array
		, "UInt", Flags )

	If !( hRequest )
	{
		inout_HEADERS := "There was a problem opening the request. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hConnection )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hInternet )
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; apply the headers to the request ( to allow header errors to be detected and reported )
	pos := DllCall( "WinINet\HttpAddRequestHeaders" WorA, "UInt", hRequest
		, "Str", inout_HEADERS
		, "UInt", StrLen( inout_HEADERS )
		, "UInt", 0x20000000 ) ; HTTP_ADDREQ_FLAG_ADD = 0x20000000
	If !( pos )
	{
		inout_HEADERS := "There was a applying one or more headers to the request. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError "`nHeaders:`n" inout_HEADERS
		StringReplace, inout_HEADERS, inout_HEADERS, `r`n, `n, A
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hRequest )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hConnection )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hInternet )
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; Send the request. HttpSendRequest > http://msdn.microsoft.com/en-us/library/aa384247%28v=VS.85%29.aspx
	pos := DllCall( "WinINet\HttpSendRequest" WorA, "UInt", hRequest
		, "UInt", 0
		, "UInt", 0
		, "UInt", &in_POST_out_DATA
		, "UInt", Content_Length )

	If !( pos )
	{
		inout_HEADERS := "There was a problem sending the request. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hRequest )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hConnection )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hInternet )
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	VarSetCapacity( int_array, 4, 0 ) ; recycle this variable (use it as an INT)
	; Query the request for ready data. Actualy, it waits for data to become ready.
	; InternetQueryDataAvailable > http://msdn.microsoft.com/en-us/library/aa385100%28v=VS.85%29.aspx
	DllCall( "WinINet\InternetQueryDataAvailable", "UInt", hRequest, "UInt", &int_array, "UInt", 0, "UInt", 0 )

	VarSetCapacity( inout_HEADERS, 4096, 0 ) ; use 4K as first-try for response header length.
	NumPut( 4096, int_array )
	Loop 2 ; Get the response headers separated by CRLF. The first line has the HTTP response code
	{
		; HttpQueryInfo > http://msdn.microsoft.com/en-us/library/aa384238%28v=VS.85%29.aspx
		If ( pos := DllCall( "WinINet\HttpQueryInfo" WorA, "UInt", hRequest
			, "UInt", 22 ; HTTP_QUERY_RAW_HEADERS_CRLF = 22
			, "UInt", &inout_HEADERS
			, "UInt", &int_array
			, "UInt", 0 ) )
				Break

		If ( A_LastError = 122 ) ; ERROR_INSUFFICIENT_BUFFER = 122
			VarSetCapacity( inout_HEADERS, NumGet( int_array ) + 2, 0 )
	}

	If !( pos )
	{
		inout_HEADERS := "There was a problem reading the response headers. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hRequest )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hConnection )
		hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hInternet )
		If !( interrupted )
			hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
		Return 0
	}

	; Update response header outputvar length and remove carriage returns
	VarSetCapacity( inout_HEADERS, -1 )
	StringReplace, inout_HEADERS, inout_HEADERS, `r`n, `n, A
	; Get the content type (well use it to see if we should treat the response as a string)
	StringGetPos, pos, inout_HEADERS, % "`nContent-Type: "
	pos += 16
	StringMid, Accept_Types, inout_HEADERS, pos, InStr( inout_HEADERS "`n", "`n", 0, pos ) - pos
	If ( bTextdata := InStr( Accept_Types, "text/" ) = 1 )
		Codepage := InStr( Accept_Types, "charset=ISO-8859-1" ) ? 28591 : 65001

	; Download the response data
	Size := 0
	If ( output_file != "" )
	{
		; The user wants to save the info as a file, so delete the file if it exists.
		IfExist, % output_file
			FileDelete, % output_file

		; Use binary-mode file write. CreateFile > http://msdn.microsoft.com/en-us/library/aa363858%28v=vs.85%29.aspx
		If !( hFile := DllCall( "CreateFile" WorA, "Str", output_file
					, "Uint", 0x40000000 ; GENERIC_WRITE = 0x40000000
      				, "Uint", 0, "UInt", 0, "UInt", 4 ; OPEN_ALWAYS = 4
					, "Uint", 0, "UInt", 0 ) )
			inout_HEADERS .= "`nHTTPRequest Error: Could not create/open the file for writing. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		Else
		{
			; Read from the internet response and write to the file
			Loop
			{
				VarSetCapacity( buffers, 4096, 0 ) ; Use a 4K buffer
				; InternetReadFile > http://msdn.microsoft.com/en-us/library/aa385103%28v=VS.85%29.aspx
				pos := DllCall( "WinINet\InternetReadFile", "UInt", hRequest
					, "UInt", &buffers
					, "UInt", 4096
					, "UInt", &int_array )
				If !( pos && NumGet( int_array ) )
				{
					; CloseHandle > http://msdn.microsoft.com/en-us/library/ms724211%28v=vs.85%29.aspx
					DllCall( "CloseHandle", "Uint", hFile )
					If !( pos )
						inout_HEADERS .= "`nHTTPRequest Warning: InternetReadFile Failed. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
					Else FileRead, in_POST_out_DATA, % output_file
					Break
				}
				Sleep -1
				Size += buffersize := NumGet( int_array )
				; WriteFile > http://msdn.microsoft.com/en-us/library/aa365747%28v=vs.85%29.aspx
				If !DllCall( "WriteFile", "UInt", hFile, "UInt", &buffers, "Int", buffersize, "UInt", &int_array, "UInt", 0 )
				{
					DllCall( "CloseHandle", "Uint", hFile )
					FileDelete, % output_file
					inout_HEADERS .= "`nHTTPRequest Error: There was a problem writing to the file. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
					Break
				}
				Sleep -1
			}
			buffers := ""
		}
	}
	Else
	{
		; Read the response and store it into a pseudo-array of buffers
		Loop
		{
			buffers := A_Index
			VarSetCapacity( HTTPRequest_Buffer_%A_Index% := "", 4096, 0 )
			; InternetReadFile > http://msdn.microsoft.com/en-us/library/aa385103%28v=VS.85%29.aspx
			pos := DllCall( "WinINet\InternetReadFile", "UInt", hRequest
				, "UInt", &HTTPRequest_Buffer_%A_Index%
				, "UInt", 4096
				, "UInt", &int_array )
			If !( pos && NumGet( int_array ) )
				Break
			Size += HTTPRequest_BufferSize_%A_Index% := NumGet( int_array )
			Sleep -1
		}
		If !( pos )
			inout_HEADERS .= "`nHTTPRequest Warning: InternetReadFile Failed. ErrorLevel = " ErrorLevel ", A_LastError = " A_LastError
		VarSetCapacity( in_POST_out_DATA, Size + 1 << !!A_IsUnicode, 0 ) ; always put an ending null, even for non-text data
		Size := 0
		Loop % buffers - 1 ; Then copy the buffered data into the output parameter.
		{
			If ( A_IsUnicode ) && bTextdata ; convert ANSI or UTF-8 into Wide-Char (UTF-16)
				; MultiByteToWideChar > http://msdn.microsoft.com/en-us/library/dd319072%28v=vs.85%29.aspx
				Size += DllCall( "MultiByteToWideChar"
						, "UInt", CodePage, "UInt", 0
						, "UInt", &HTTPRequest_Buffer_%A_Index%
						, "UInt", HTTPRequest_BufferSize_%A_Index%
						, "UInt", &in_POST_out_DATA + Size
						, "UInt", HTTPRequest_BufferSize_%A_Index% << 1 ) << 1
			Else ; the script isn't unicode, so just copy byte for byte
			{
				; MoveMemory > http://msdn.microsoft.com/en-us/library/aa366788%28v=vs.85%29.aspx
				DllCall( "RtlMoveMemory"
						, "UInt", &in_POST_out_DATA + Size
						, "UInt", &HTTPRequest_Buffer_%A_Index%
						, "UInt", HTTPRequest_BufferSize_%A_Index% )
				Size += HTTPRequest_BufferSize_%A_Index%
			}
			HTTPRequest_Buffer_%A_Index% := ""
		}
	
		; If the content-type is text, update the output data length
		If ( bTextdata )
			VarSetCapacity( in_POST_out_DATA, -1 )
		; Scrapped idea: if content-type = text/xml, insert newlines and tabs to make it pretty
	} ; End Else

	; InternetCloseHandle > http://msdn.microsoft.com/en-us/library/aa384350%28v=VS.85%29.aspx
	hRequest := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hRequest )
	hConnection := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hConnection )
	hInternet := 0 & DllCall( "WinINet\InternetCloseHandle", "UInt", hInternet )
	If !( interrupted )
		hModule := 0 & DllCall( "FreeLibrary", "UInt", hModule )
	Return Size
} ; HTTPRequest( url, byref in_POST_out_DATA="", byref inout_HEADERS="", proxy_info="" ) -----------

HTTPRequest_MD5( byref data, length=-1 ) { ; -------------------------------------------------------
; Computes the MD5 hash of a data blob of length 'length'. If 'length' is less than zero, this
; function assumes that 'data' is a null-terminated string and determines the length automatically.
	; static variables and constants r[0~63], encoded here as bytes with an offset of 64
	; ( that means the real value is the byte value minus 64, e.g: r[0] = 7, so 7 + 64 = 71 = 'G' )
	Static S, k, p:=0, r := "GLQVGLQVGLQVGLQVEINTEINTEINTEINTDKPWDKPWDKPWDKPWFJOUFJOUFJOUFJOU"

	VarSetCapacity( S, 64, 0 ) ; Initialize the block buffer S and constants p and k[0~63]
	IfEqual, p, 0, Loop % VarSetCapacity( k, 256 + !( p := &S ) ) >> 2 & 64
		NumPut( Floor(Abs(Sin(A_Index)) * 2**32 ), k, A_Index - 1 << 2, "UInt" )

	; autodetect message length if it's not specified (or is not positive)
	IfLess, length, 1, StringLen, length, data

	; initialize running accumulators and terminator (the terminator is appended to the message)
	ha := 0x67452301, hb := 0xEFCDAB89, hc := 0x98BADCFE, hd := 0x10325476

	; Begin rolling the message. This loop does 1 iteration for each 64 byte block such that the
	; last block has fewer than 55 bytes in it ( to leave room for the terminator and data length )
	Loop % length + 72 >> 6
	{
		If ( f := length - 64 > ( e := A_Index - 1 << 6 ) ? 64 : length > e ? length - e : 0 )
			DllCall( "RtlMoveMemory", "UInt", p, "UInt", &data + e, "Int", f ) ; copy the block
		If ( f != 64 && e <= length ) ; append the terminator to the message
			NumPut( 128, S, f, "UChar" )
		IfLess, f, 56, Loop 8 ; if this is the real last block, insert the data length in BITS
			NumPut( ( length << 3 >> ( A_Index - 1 << 3 ) ) & 255, S, 55 + A_Index, "UChar" )
		
		a := ha, b := hb, c := hc, d := hd ; copy running accumulators to intermediate variables

		Loop 64 ; begin rolling the block. These operations have been condensed and obfuscated.
		{ ; For i from 0 to 63 {
			e := NumGet( r, ( 2 - !A_IsUnicode ) * i := A_Index - 1, "UChar" ) & 31
			f := 0 = ( j := i >> 4 ) ? (b&c)|(~b&d) : j=1 ? (d&b)|(~d&c) : j=2 ? b^c^d : c^(~d|b)
			g := (( i * ( 3817 >> j * 3 & 7 ) + ( 328 >> j * 3 & 7 ) & 15 ) << 2 ) + p
			w := (*(g+3) << 24 | *(g+2) << 16 | *(g+1) << 8 | *g) + a + f + NumGet(k,i<<2,"UInt")
			a := d, d := c, c := b, b += w << e | (( w & 0xFFFFFFFF ) >> ( 32 - e ))
		}
		; add the intermediate variables to the running accumlators (making sure to mod by 2**32)
		ha := ha+a&0xFFFFFFFF, hb := hb+b&0xFFFFFFFF, hc := hc+c&0xFFFFFFFF, hd := hd+d&0xFFFFFFFF
		VarSetCapacity( S, 64, 0 ) ; Clear the block ( set bits to zero )
	}
	Loop 32 ; convert the running accumulators into 32 hex digits
		i := Chr( 96 + ( A_Index + 7 >> 3 ) ), S .= SubStr( "123456789abcdef0"
		, h%i% >> ( ( A_Index - 1 + ( A_Index & 1 ) - !( A_Index & 1 ) & 7 ) << 2 ) & 15, 1 )
	Return S ; return the hex digits
} ; HTTPRequest_MD5( byref data, length=-1 ) -------------------------------------------------------


User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 00:48

Official package managers solve several problems.
They offer a standard way for sharing your library and make it accessible to everyone with a single command.
They force people to explain their code and document its use properly. They make it easier to use the libraries that are provided by forcing the people that submit them, to use a common standard. They keep projects alive by allowing people to take over another person's work after they left the forums. They make it easier to share your own scripts, that rely on libraries - since you can easily tell people which command has to be used to get them.

Did any of you use a package manager so far? Because if not I would ask you to withdraw from this conversation due to a lack of experience - you're not being productive.
Recommends AHK Studio
User avatar
Frosti
Posts: 142
Joined: 27 Oct 2017, 14:30
GitHub: Ixiko

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 04:55

Before I came across Autohotkey, I made an effort in Python. There I appreciated the implemented package manager very much. My experience level reached 3/100 ( :shh: ). Now I am collecting what I can find. Nearly 4GB unsorted Autohotkey code with less documentation and up to 6x the same files and countless times the same libraries in partly different versions and also with unmarked changes. Sometimes I use FileMerge to sort files out. With a collection of more than 25,000 files a life task and therefore meaningless. So I know my vote counts less, but I hope it counts for nnik.
guest3456
Posts: 2464
Joined: 09 Oct 2013, 10:31

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 08:09

nnnik wrote:Official package managers solve several problems.

Did any of you use a package manager so far? Because if not I would ask you to withdraw from this conversation due to a lack of experience - you're not being productive.
maybe you think i'm being facetious by asking you to actually list out what the problems we face, and define the problems. i'm not being facetious. i'm being real and practical. this is actually how all real software is developed. and creating a package manager is in fact creating a piece of software.

tomoe, the author, defined the problem he is facing - backup and losing code. i'm not sure a pkg manager is the best for that.

you list your problems below:
nnnik wrote: 1. They offer a standard way for sharing your library and make it accessible to everyone with a single command.
2. They force people to explain their code and document its use properly.
3. They make it easier to use the libraries that are provided by forcing the people that submit them, to use a common standard.
4. They keep projects alive by allowing people to take over another person's work after they left the forums.
5. They make it easier to share your own scripts, that rely on libraries - since you can easily tell people which command has to be used to get them.
1. and 5. right now, people pretty much share their libraries on the Scripts forum, or on github. libs are accessible with a few extra clicks to download compared to a single composer/npm/ahklibmanager command
2. if people are too lazy to do this already, they will still be lazy in the future. they either won't submit their library to the package manager, or they will get rejected from being a part of it. either way, their lib doesn't become part of the pkgman, and users still have to go to the forums or github
3. yes. but is it so hard to use libs right now?
4. i dont see how hosting a lib makes it any easier to re-purpose a lib than it already is. both you and i have taking over tic's work and upgraded the GDIP lib for ahk-v2 by simply grabbing an old copy and upgrading it. putting it on github makes it even easier to take over other people's work

package managers in other languages serve to distribute mature libraries, of all different versions, making it easy for other devs to get up and running fast by just executing a script to snatch all the dependencies. so i can create a project that relies on GDIP lib and specifiy v0.1.1, and you can create a project that relies on GDIP v0.1.2, etc and we can all easily grab those without having to hunt them down. its a time saver. these languages are building business class, production code (i sell an app written in AHK so i could say i have a small business around AHK). but for the majority of AHKers, people are just writing a few hotkeys or windows automation. so, exactly which libraries are so important? i asked you to give the example program and lib you were talking about and you ignored the question. because there probably isn't any. is the GDIP lib the most popular AHK lib? who's going to be using this pkg manager?

i'm not trying to dissuade you guys from doing this. if you want to, go for it. build off the existing attempts that were previously linked that never took off. i'm just trying to get you to clarify exactly why you're doing it and maybe save yourself some wasted time. why didn't those previous managers never work?
Last edited by guest3456 on 22 Sep 2018, 08:12, edited 1 time in total.

guest3456
Posts: 2464
Joined: 09 Oct 2013, 10:31

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 08:11

Frosti wrote:Before I came across Autohotkey, I made an effort in Python. There I appreciated the implemented package manager very much. My experience level reached 3/100 ( :shh: ). Now I am collecting what I can find. Nearly 4GB unsorted Autohotkey code with less documentation and up to 6x the same files and countless times the same libraries in partly different versions and also with unmarked changes. Sometimes I use FileMerge to sort files out. With a collection of more than 25,000 files a life task and therefore meaningless. So I know my vote counts less, but I hope it counts for nnik.
so lets put such a big life long task onto the maintainers of the package manager to sort all the 25,000 libraries out. who volunteers? :D

User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 09:00

1. and 5. right now, people pretty much share their libraries on the Scripts forum, or on github. libs are accessible with a few extra clicks to download compared to a single composer/npm/ahklibmanager command
And a lot of research resulting in the query for this library. How am I supposed to know that I look for GDIp when I want to create a Canvas?
The functionality of this forums leave much to be desired - to the point where I rather use Google than the forums search functionality itself.
This is far from optimal.
2. if people are too lazy to do this already, they will still be lazy in the future. they either won't submit their library to the package manager, or they will get rejected from being a part of it. either way, their lib doesn't become part of the pkgman, and users still have to go to the forums or github
Yeah and thats actually what I want. Someone will submit a better library that is well documented and functions completely.
Then peopole will stop using the old library - since its more work not to get it from the package manager and well it shares the advantages of the package manager.
3. yes. but is it so hard to use libs right now?
Many of the libs are hard to get or to download. Thats due to them having dependencies. You only need like a library that saves a picture in a specific format.
But that requires gdip and _struct and _struct then still requires sizeof.
4. i dont see how hosting a lib makes it any easier to re-purpose a lib than it already is. both you and i have taking over tic's work and upgraded the GDIP lib for ahk-v2 by simply grabbing an old copy and upgrading it. putting it on github makes it even easier to take over other people's work
And most people still use tics old library. Despite the effort made to create a new library and push this new version.
Especially GDIp is not a story of success in this case.
why didn't those previous managers never work?
For starters they were not bundled with AHK. They were not pushed by this website either.
maybe you think i'm being facetious by asking you to actually list out what the problems we face, and define the problems. i'm not being facetious. i'm being real and practical. this is actually how all real software is developed. and creating a package manager is in fact creating a piece of software.
Ah I see thats good to know. When we create a package manager, I think, it would make the most sense to follow the standards other package-managers follow.
We don't need to establish a new groundwork or completely start from scratch like you attempt to do it in your post.
If we just tweak the standards a little rather than completely starting from scratch. So my approach would be looking at several other package managers and see what makes them good to use or useful.
i asked you to give the example program and lib you were talking about and you ignored the question. because there probably isn't any.
Do you just want me to throw out a random name of a program just to dispell your point? Thats thats pointless but I'll do it anyways.
Controlling spotify in the background.
Recommends AHK Studio
elmo
Posts: 78
Joined: 09 Oct 2013, 09:08

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 09:51

Using software written in AHK:

1 - The experts in the AHK community have been curating their personal libraries since day one
2 - These experts have already applied their knowledge to include only useful and properly operating code blocks
3 - AHK program for each expert to securely replicate their own personal library to a corresponding cloud object storage folder
4 - AHK program for curator using hashes and other algorithms to derive a "probable best" representative for each code block from these folders
5 - AHK program for curator / experts to review and tag the resulting collection with meta data on each code block cloud object
6 - AHK program for community to list the repository, search the meta data, and download selected code blocks with dependencies
7 - Over time, the original experts' updates + other experts' libraries + functions + solutions are cycled in

I would suggest that a dozen (or so) of the AHK community's luminaries replicate their libraries to derive the initial repository.
Last edited by elmo on 24 Sep 2018, 13:38, edited 7 times in total.
User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 10:37

So I know my vote counts less, but I hope it counts for nnik.
Thank you - but its not that important what I want, but what the community wants.
I just think it would be best if we didn't reinvent the wheel for once and just adapted what others already thought about.
If I get the feeling that I'm working against the will and expectations of the AutoHotkey community then I will withdraw.
At this point its hard to tell what everybody wants and if it really the best path to do what the majority wants.
Recommends AHK Studio
guest3456
Posts: 2464
Joined: 09 Oct 2013, 10:31

Re: [Request]: Official Library & Wrapper

22 Sep 2018, 23:10

nnnik wrote: I just think it would be best if we didn't reinvent the wheel for once and just adapted what others already thought about.
yeah, this thread that was linked earlier has good discussion:
https://autohotkey.com/boards/viewtopic.php?f=6&t=1241
nnnik wrote: If I get the feeling that I'm working against the will and expectations of the AutoHotkey community then I will withdraw.
At this point its hard to tell what everybody wants and if it really the best path to do what the majority wants.
i think the majority in this thread are in favor, and perhaps i am drowning that out. so i will withdraw. and i am not really against this either, even though i dont see the immediate need.

User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

23 Sep 2018, 02:58

A nice link :) - though I'd rather like to copy a successful program.
I also feel that the majority of users is not against this.
Now the question is how the program we create looks like.

For that we should probably have a look at a few other package managers and how they handle things.
It would be great if someone could gather information about a specific library manager they have worked before:
Heres a list of package managers that have been mentioned before. Another thing we need is splitting that into feature requests. While collecting the feature requests we can also collect the feature requests that are unique to AHK.
We probably also need a place to collect the documents and a github repository.

What about hosting? Can someone estimate the traffic? tank would you host that on this server or should we get another one?

Finally it would be nice if someone could have a look at the existing programs and look for one that we could use as a basis for our package manager.
Recommends AHK Studio
Qriist
Posts: 13
Joined: 11 Sep 2016, 04:02

Re: [Request]: Official Library & Wrapper

24 Sep 2018, 17:44

Any package maintainer that is pushed forward should have an intuitive CLI, not unlike apt-get.

The tag system is a great idea because you can easily require that submissions include a secondary file in .ini format. I would suggest that .ini is NOT used for the extension, rather, use .tag. Some libraries may want to use .ini as a persistent settings file. The author should also have the ability to submit other required files, such as a DLL.
Example files:
stab.ahk
stab.tag
tidbit.ahk
tidbit.tag

Example .tag (.ini)
[stab]
Version=1
AHK Version=1.1
Depend=tidbit.ahk

So the maintainer reads the .tag, sees it needs a file, checks for local copies of it, if not found it checks the dependencies of THAT file and downloads those, and so on. The .tag file should never be downloaded to disk by the maintainer. It should be UrlDownloadToVar() and something like Rini.ahk should be used to fiddle with the ini in memory.

I know .ini is frowned upon in general but it is useful as an easy tagging system. I feel others such as JSON/XML/SQL would be too annoying for the average submitter, with more overhead than required.




I think that github is a good primary resource for the package maintainer data for myriad reasons. Free as in beer, virtually unlimited storage, a decent (if initially confusing) http api, the ability to fork, multiple repositories, a ticketing system, a wiki system, robust user permissions system, and probably more. If possible, there should be a public upload repository where anyone can publish to, that then gets approved by staff. The one thing I would probably want to include is an off-site backup. This is where I come in.

I have unlimited private storage. I am used to scraping websites and processing/mirroring them in this way and that. I can selectively make a folder (including subfolders) public for read-only access. While donations are nice, I already pay for this and won't actively seek reimbursement. Once the scraping script is in place it'll be invisible to me anyways.

If desired, I can also propagate to other sites, as long as that site has a useful API.
User avatar
kczx3
Posts: 691
Joined: 06 Oct 2015, 21:39

Re: [Request]: Official Library & Wrapper

24 Sep 2018, 19:51

I’d still rather JSON format. It’s easy to use in my opinion and just the package manager program requires a dependency to manipulate JSON data
Qriist
Posts: 13
Joined: 11 Sep 2016, 04:02

Re: [Request]: Official Library & Wrapper

24 Sep 2018, 20:02

Working with the JSON format is reasonably easy to do, yes. I still argue that those submitting the tags would have an easier time when using .ini. JSON is useful for organizing a large collection of related material. Ini is more useful for a handful of settings.
User avatar
nnnik
Posts: 3526
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: [Request]: Official Library & Wrapper

25 Sep 2018, 01:02

I would not force anyone to write their dependencies in a settings file manually. That's what the web interface is for.
Recommends AHK Studio

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 9 guests