Jump to content


Photo

[video] Standard Library


  • Please log in to reply
6 replies to this topic

#1 Frankie

Frankie
  • Members
  • 2930 posts

Posted 09 August 2012 - 10:03 AM

AutoHotkey Standard Library

XBdQTQ4epwY

Keep convenient code available with standard libraries.

Links:
[*:2eqfso29]My current standard library can be downloaded here
[*:2eqfso29]Docs for #Include
[*:2eqfso29]If you have any more ideas for tutorials, share them here.
As a side tip, pressing F1 in SciTE4AutoHotkey shows the docs page for the command/function/directive occupied by the cursor. I use it all the time, but don't think I've mentioned what I was pressing.

Thanks,
Frankie

#2 capbat

capbat
  • Members
  • 159 posts

Posted 16 August 2012 - 12:44 AM

Hi Franki.

About your Lib on GitHub, and for all other's also, the include are the core but I can't see where on GitHub I can find example files or documentation about the libs.

Tks for your work, your helpfulness and your generosity.

Bat

#3 Frankie

Frankie
  • Members
  • 2930 posts

Posted 16 August 2012 - 12:54 PM

If you scroll down to the bottom of the page, there are some examples.

I generated a list of functions and their parameters, also.

lib_CALLBACK.ahk
  - Callback.event()
  - Callback.__new(options = "", paramCount = "", id = "")
  - Callback.__delete()

lib_CONTROL.ahk
  - Control.__Get(aname)
  - Control.__New(hwnd, ClassNN = "")
  - Control.getDescription( aname = "")
  - Control.getPos()
  - Control.getText()
  - Control.getOtherProperty(aname)

lib_CORE.ahk
  - Core.swap(arr)
  - Core.firstValid( a* )
  - Core.in( arr, val )
  - Core.cpu()
  - Core.keys(arr)

lib_EVENTDISPATCHER.ahk
  - EventDispatcher.registerGui(w)
  - EventDispatcher.toggleHotkeys(w, to = "Toggle")
  - EventDispatcher.unregisterGui(w)
  - EventDispatcher.event()

lib_FILE.ahk
  - File.__new(file, flags, encoding = "")
  - File.__call(aname, params*)
  - File.__new()
  - File.__new()

lib_G.ahk
  - g.__Get(aname)
  - g.controlSet( c, subcommand = "", param3 = "" )
  - g.controlGet( c, subcommand = "", param4 = "" )
  - g.close()
  - g.show()
  - g.hide()
  - g.escape()
  - g.size()

lib_JSON.ahk
  - JSONParser.__New(jsParserPath)
  - JSONParser.fromFile( path, reviver="" )
  - JSONParser.parse(jsonString, reviver="" )
  - JSONParser.stringify(val, spacer = " ", precIndent = 0)
  - JSONParser.quote(val)
  - JSONParser.convert(j)
  - JSONParser.__Delete()
  - JSONParser.save( byref value, filename, replacer="", space=4)

lib_LISTBOX.ahk
  - ListBox.__new(hwnd)
  - ListBox.selectAll()
  - ListBox.deselectAll()
  - ListBox.select( i = 1)
  - ListBox.choose( c )
  - ListBox.set( e )
  - ListBox.get()

lib_LOG.ahk
  - Log.write( s, kind = "info", f = "" )
  - Log.warn(s, f = "")
  - Log.info(s, f = "")
  - Log.error(s, f = "")

lib_MATH.ahk
  - Math.xor(a, b)
  - Math.min(x,y = "")
  - Math.max(x,y = "")
  - Math.minObj(x)
  - Math.maxObj(x)
  - Math.between(x,y,z)
  - Math.changeBase(n, b = 10)
  - Math.hex(n)
  - Math.oct(n)
  - Math.fromHex(n)

lib_ODBC.ahk
  - Query.__new(conn, text)
  - Query.__delete()
  - Query.do(q)
  - Query.__new( settings = "" )
  - Query.__delete()
  - Query.connect()
  - Query.loadFromRegistry()
  - Query.loadDsn(dsn)
  - Query.load()
  - Query.loadDsnList()
  - Query.save( dsn, uid, pwd, defaultDsn = 0, defaultOwner = 0)

lib_STRING.ahk
  - String.is(type)
  - String.in( hs )
  - String.split(delimiters, omitchars = "")
  - String.right(n)
  - String.left(n)
  - String.lefttrim(n)
  - String.rightTrim(n)
  - String.slice(start=1, end=0)
  - String.match(regexp, options = "O")
  - String.fill(times = 1)
  - String.join(arr)
  - String.q( left="'", right="" )
  - String.qq()
  - String.qa()
  - String.qb()
  - String.qc()
  - String.toUpper()
  - String.toLower()
  - String.fmt(args*)
  - String.parse(s)

lib_SYNK.ahk
  - SYNK_filecompare(fsource, fdest)
  - SYNK_error(err, errText, byRef e)
  - SYNK_countfilesizes(source)
  - SYNK_dirsynk(source, dest, bak, move = 0, prog = 600, moveExceedings = 0, dateBak = 1, compare = "SYNK_filecompare")
  - SYNK_stub()

lib_TRAYTIP.ahk
  - TrayTip.show( s, t=1000 )
  - TrayTip.clear()

lib_WINDOW.ahk
  - Window.geomToString( o )
  - Window.__New(hwnd)
  - Window.__Get(aname)
  - Window.getControls()
  - Window.getPos()
  - Window.setPos( x = "", y = "", w = "", h = "" )


#4 capbat

capbat
  • Members
  • 159 posts

Posted 16 August 2012 - 05:22 PM

If you scroll down to the bottom of the page, there are some examples.

I generated a list of functions and their parameters, also.


Tks for your answer Frankie. I appreciate your effort in answering a newbee like me and also your effort for documentation.
However I think most of what you are presenting me, assume that I have a certain knowledge of Object Structure which in my case is minimal, and I assume it might be the case of numerous newcomers. What would be appreciated is documentation presented like what AHK documentation does. If you take this example, where we can find all dissected, Tittle, Small Description, Format, Parameter (yellow), Description of Sub Command, Description of Parameters, Example, Error Level, Remarks etc etc.
I understand that this is a lot of work. But for people like me and others I assume, who are not familiar with Object it is not evident to implement. Maybe you would need help in doing so, I would be pleased to assist you, once those Object are clearer to me.

Even a small example in an .AHK file would be helpful.
At this time I can't even try your example I get the following error:

C:\Program Files (x86)\AutoHotkey\Etude\Library Brigand\Lib Study.ahk (1) : ==> #Include file "lib\lib_CORE.ahk" cannot be opened.

After trying part of your example:
#include lib\lib_CORE.ahk
#include lib\\lib_G.ahk


t:= {}

// Math examples ___________________________

o := [ 1, 3, 6, 64, -3 ]

// Min, Max
t.insert( Math.max(o) ", " Math.min(o) )

// First Valid
t.insert( Core.firstValid( 0, "", "abba", 5 ) )

// Hex functions
t.insert( Math.hex(133) )
t.insert( Math.fromHex(85) )

// Xor
fruits := { "Pear" : 5, "Orange" : 10 }
if ( Math.xor( fruits["Pear"], fruits["Strawberry"] ) ) {
    t.insert( "There are Pears but no Strawberries" )
}
I have installed the libraries in: C:\Program Files (x86)\AutoHotkey\Lib\
And in:C:\Users\Serge\Documents\AutoHotkey\Lib\

After viewing your video above witch was appreciated. It still does not worked I even tried to put the lib it in the same directory as the .AHK file while removing the backslash ie:
#include lib\lib_CORE.ahk
#include lib\\lib_G.ahk
Changed to:
#include lib_CORE.ahk
#include lib_G.ahk

To no avail.
Hope you make sense of all this. Tks again for all your time and help.

Bat

#5 Frankie

Frankie
  • Members
  • 2930 posts

Posted 17 August 2012 - 02:58 AM

Replace
#include lib\lib_CORE.ahk
with
#include <lib_CORE>

...and I'll look into doing some docs. Thanks :-)

#6 Frankie

Frankie
  • Members
  • 2930 posts

Posted 17 August 2012 - 06:51 AM

I've started making some docs. I'll work on this some more when I get a chance. I've only done one so far.

docs/core/firstValid.html

Let me know if the basic layout needs any changes. They'll all use it.

Thanks

#7 capbat

capbat
  • Members
  • 159 posts

Posted 17 August 2012 - 01:55 PM

Excellent, very good, exactly what is required.
If I look at the timestamp of both your above message, and if it reflects the time of writting the documentation I have to admit that it is really timeconsuming.
So, again if yo need help, I would be happy to help you out writting some of it after they have been explain to me.

Tks again Frankie

Bat