Jump to content

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

Sparrow: AHK WebServer w/ AHK in HTML support (sources incl)


  • Please log in to reply
106 replies to this topic
LiquidGravity
  • Guests
  • Last active:
  • Joined: --
I haven't looked through the code yet but it looks like a great start. I could see this really getting some attention from the geek world. I am happy to see that an add-on module system is on the to do list. I would keep security a priority as well. That will be important for any public use.

There are two problems I have had. Once when playing with the form test page AutoHotkey errored and the server went down. Sorry I forgot to grab any info on it. Secondly you need to at least take credit in big bold letters on one of the pages with it.

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
in 1st half of next week i'll introduce version 0.2.0 which will not only contain a headerinjection, but also the buffer fix. this should also allow file uploads up to the size of given physical memory if needed :)

the spontanous server went down phenomena is due to an for now unrecoverable winsock error. this will be fixed when core spawns worker processes for better server load. since ther will be more listeners who can react upon multiple queries.

also in soon future i will introduce the security features called "birdcage"

i also started to outline the plugin structure whose 1st attempts will be presented hopefully in 0.2.0, but the fixes mentioned above have more priority.

also the documentation will be updated and more examples added (such as directory listings as a module) or tidyHTML (if i ever get that dll version to work) but one step after the other.

i'd love to see a chroot environment for sparrow, but unfortunately this will not be as easy as it sounds, since ahk interpreter will have to be prevented to access any files not in a given directory which will involve some deep system hooks which might affect the system performance.

Secondly you need to at least take credit in big bold letters on one of the pages with it.


what exactly do u mean with that?

greets
dR

edit if anybody got some nice screenshots from some sparrow pages apart from standard out of the box screens, feel free to post these here. BoBo²'s FSB will automatically create a Screenshot and a smaller 'postable' version which is just perfect for thread postings. it also generates a bigger version, of course, and fills the clipboard with ready to use bbcode tags. if one wants to one might aswell use the version i posted below, which directly uploads to one's autohotkey account using httpQuery

All scripts, unless otherwise noted, are hereby released under CC-BY

LiquidGravity
  • Guests
  • Last active:
  • Joined: --
I am excited about this project. I believe I will try my hand at making a hkml project a little later this weekend. I'll upload the code and pics if I do.


Secondly you need to at least take credit in big bold letters on one of the pages with it.

what exactly do u mean with that?


You don't have your name anywhere in the hkml pages. An author should at least give himself some credit.

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
at the bottom of the page :)

Have fun!
dR / Sep 26 2008


greets
dR

All scripts, unless otherwise noted, are hereby released under CC-BY

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
Here we have an example HKML File of how to work with $_GET Variables, check for their existance and use them to generate dynamic content with AHK.
This example will be part of 0.2.0 distribution

[color=#606060]<html>
<head><title>HKML Multiple Language</title></head>
<body>[/color]
[color=#800000]<?ahk[/color]
; Sparrow Example for usage of $_GET variable and multiLingual text

; Here we have three translated blocks of text and one is available in English and German only
; Hier haben wir drei übersetzte Textblöcke, von denen einer nur auf English und Deutsch verfügbar ist.

; Block 1
head_b1[deDE] := "Hallo Welt"
head_b1[enUS] := "Hello world"
head_b1[frFR] := "Bonjour tout le monde!"
text_b1[deDE] := "Ich bin ein Beispiel für Text in deutscher Sprache."
text_b1[enUS] := "I am an example for text in English."
text_b1[frFR] := "Je suis un exemple pour le texte en français."

; Block 2
head_b2[deDE] := "Beispiel"
head_b2[enUS] := "Example"
head_b2[frFR] := "Exemple"
text_b2[deDE] := "Text für Freunde der AHK Syntax in HTML."
text_b2[enUS] := "Text for friends of the AHK-syntax in HTML."
text_b2[frFR] := "Texte pour les amis de la AHK-syntaxe HTML."

; Block 3
head_b3[deDE] := "FailOver Beispiel"
head_b3[enUS] := "FailOver example"
text_b3[deDE] := "Diesen Text gibt es nicht auf Französich."
text_b3[enUS] := "This Text is not available in French."

; ******************************************************************************************
; Evaluate the possible Languages / Auswerten der möglichen Sprachen

; Possible Language / Mögliche Sprachen
AvailLng := "deDE,Deutsch|enUS,English|frFR,Français"

; Define Standard / Standard definieren
if (!(IsSet($_GET[lng])) || !(RegExMatch(AvailLng,$_GET[lng]))) {
    $_GET[lng] := "enUS"
}

; prepare list / Liste vorbereiten
TmpLng := RegExReplace(AvailLng "|", ",[^\|]+") ; remove Descriptor / Beschreibung entfernen
lngLst := RegExReplace(TmpLng, $_GET[lng] "\|") ; remove TargetLang / Zielprache entfernen
lngLst := SubStr(LngLst,1,-1) ; remove trailing |-Symbol / angehängtes |-Symbol entfernen

; setup LangChooser links / SprachwahlLinks vorbereiten
Loop,Parse,lngLst,|
{
	RegExMatch(AvailLng,"(?P<LNG>" A_LoopField "),(?P<Desc>[^\|]+)",Chooser)
	echo("<a href=""" $_SERVER[REQUEST] "?lng=" ChooserLNG """>" ChooserDesc "</a> ")
}
echo("<br>")

if (!IsSet($_GET[failOver]))
	FailOverLanguage := "enUS"
else
	FailOverLanguage := $_GET[failOver]

; Print out our page / Ausgabe unserer Seite
Loop,3 {
	head_b%A_index% := head_b%A_index%[%$_GET[lng]%]
	if (StrLen(head_b%A_index%)=0)
		head_b%A_index% := head_b%A_index%[%FailOverLanguage%]
	
	text_b%A_index% := text_b%A_index%[%$_GET[lng]%]
	if (StrLen(text_b%A_index%)=0)
		text_b%A_index% := text_b%A_index%[%FailOverLanguage%]

	echo("<h2>" head_b%A_index% "</h2>")
	echo("<p style=""margin-left:2em;"">" text_b%A_index% "</p>")
}

[color=#800000]?>[/color]
[color=#606060]</body>
</html>[/color]

greets
dR

All scripts, unless otherwise noted, are hereby released under CC-BY

°digit°
  • Members
  • 2 posts
  • Last active: Oct 27 2008 09:58 AM
  • Joined: 30 Sep 2008
Hi @all
(in "the MotherForum" as they call it in the german one)
... I'm still from there and now hoping my english isn't to brackish otherwise please try to have fun with it! :wink:
At that I'm a newcomer in AHk and thus a little shy. Nevertheless ...

The reason to overbear my timidity and to do (my first) poste here is this loveley lil "Sparrow" developed by derRaphael.
In addition to my quirks above I realy like the spanish language (and try to learn it) so I took that Script ^^ of dR to add (something like) español to it.
My questions:
[*:2vdydla3]are those phrases more or less OK (comments / improvements are desired) for to make it "well-dressed" for spanish eyes?
[*:2vdydla3]is this modified script runing also on your system?
I've had tested it only on: |> OS: XP sp3, Browser: Iron (= googleChrome without ears)(and because of dR asked for some screenshots) Well, for to get an impression:
Posted Image
<html>
<head><title>HKML Multiple Language 4</title></head>
<body>
<?ahk
; Sparrow Example for usage of $_GET variable and multiLingual text

; Here we have three translated blocks of text and one is available in English and German only
; Hier haben wir drei übersetzte Textblöcke, von denen einer nur auf English und Deutsch verfügbar ist.

; Block 1
head_b1[deDE] := "Hallo Welt"
head_b1[enUS] := "Hello world"
head_b1[frFR] := "Bonjour tout le monde!"
head_b1[esES] := [color=red]"¡Hola mundo!"[/color]
text_b1[deDE] := "Ich bin ein Beispiel für Text in deutscher Sprache."
text_b1[enUS] := "I am an example for text in English."
text_b1[frFR] := "Je suis un exemple pour le texte en français."
text_b1[esES] := [color=red]"Soy un ejemplo para un texto en español."[/color]

; Block 2
head_b2[deDE] := "Beispiel"
head_b2[enUS] := "Example"
head_b2[frFR] := "Exemple"
head_b2[esES] := [color=red]"Ejemplo"[/color]
text_b2[deDE] := "Text für Freunde der AHK Syntax in HTML."
text_b2[enUS] := "Text for friends of the AHK-syntax in HTML."
text_b2[frFR] := "Texte pour les amis de la AHK-syntaxe HTML."
text_b2[esES] := [color=red]"Texto para los amigos de la sintaxis de AHK en HTML."[/color]

; Block 3
head_b3[deDE] := "FailOver Beispiel"
head_b3[enUS] := "FailOver example"
text_b3[deDE] := "Diesen Text gibt es nicht auf Französich oder Spanisch."
text_b3[enUS] := "This Text is not available in French or Spanish."

; ******************************************************************************************
; Evaluate the possible Languages / Auswerten der möglichen Sprachen

; Possible Language / Mögliche Sprachen
AvailLng := "deDE,Deutsch|enUS,English|frFR,Français|esES,Español"

; Define Standard / Standard definieren
if (!(IsSet($_GET[lng])) || !(RegExMatch(AvailLng,$_GET[lng]))) {
$_GET[lng] := "enUS"
}

; prepare list / Liste vorbereiten
TmpLng := RegExReplace(AvailLng "|", ",[^\|]+") ; remove Descriptor / Beschreibung entfernen
lngLst := RegExReplace(TmpLng, $_GET[lng] "\|") ; remove TargetLang / Zielprache entfernen
lngLst := SubStr(LngLst,1,-1) ; remove trailing |-Symbol / angehängtes |-Symbol entfernen

; setup LangChooser links / SprachwahlLinks vorbereiten
Loop,Parse,lngLst,|
{
   RegExMatch(AvailLng,"(?P<LNG>" A_LoopField "),(?P<Desc>[^\|]+)",Chooser)
   echo("<a href=""" $_SERVER[REQUEST] "?lng=" ChooserLNG """>" ChooserDesc "</a> ")
}
echo("<br>")

if (!IsSet($_GET[failOver]))
   FailOverLanguage := "enUS"
else
   FailOverLanguage := $_GET[failOver]

; Print out our page / Ausgabe unserer Seite
Loop,3 {
   head_b%A_index% := head_b%A_index%[%$_GET[lng]%]
   if (StrLen(head_b%A_index%)=0)
      head_b%A_index% := head_b%A_index%[%FailOverLanguage%]

   text_b%A_index% := text_b%A_index%[%$_GET[lng]%]
   if (StrLen(text_b%A_index%)=0)
      text_b%A_index% := text_b%A_index%[%FailOverLanguage%]

   echo("<h2>" head_b%A_index% "</h2>")
   echo("<p style=""margin-left:2em;"">" text_b%A_index% "</p>")
}

?>
</body>
</html>
If u want to u can also view a translation of the documentation into an improved :arrow: german version for the actual 0.1.3 Sparrow

°digit°_____ò;Ó?__|:: thx for your attention and have a nice day!
.::Posted Image::. just an AHk greenhorn ...

Jex(is not logged in)
  • Guests
  • Last active:
  • Joined: --
Yay, sparrow is awesome.

there are a few things that i noticed while playing around with it.

firstly:
<?ahk msgbox?>
this, when run, gives an error.

^that is probably my fault...i think.

secondly:
(more of a request)
Could sparrow close all launched scripts when it closes, or when the page that script was loaded on is closed?

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
jex, u're playing with an alpha version of a slightly complex software :)
so please excuse if a few bugs remain ...

btw ... msgbox is being captured and treated as error, since all standard errors come up as such / or directly via StdErrOut

the control of premature scriptendings is partly implemented but not fully yet. i will have an eye on that for future releases.

next release of sparrow will include the buffer fix for headers (uploads) with more than 4K and a rewrite on multipart datas (this caused a real bad error in my testversion).

also i will introduce at least one new function: header() which will allow to inject header data from the script.

next development focus will be on getting closer to RFC1945 and RFC2616 compliance: that is http header data 0.9/1.0 and 1.1 (besides script control and error capturing)

greets
dR

All scripts, unless otherwise noted, are hereby released under CC-BY

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Allow me to add:
; Block 1
head_b1[deDE] := "Hallo Welt"
head_b1[enUS] := "Hello world"
head_b1[frFR] := "Bonjour tout le monde!"
head_b1[esES] := "¡Hola mundo!"
[color=red]head_b1[nlNL] := "Hallo wereld!"
head_b1[fyNL] := "Hallo wrâld!"[/color]
text_b1[deDE] := "Ich bin ein Beispiel für Text in deutscher Sprache."
text_b1[enUS] := "I am an example for text in English."
text_b1[frFR] := "Je suis un exemple pour le texte en français."
text_b1[esES] := "Soy un ejemplo para un texto en español."
[color=red]text_b1[nlNL] := "Ik ben een voorbeeld van een tekst in het Nederlands."
text_b1[fyNL] := "Ik bin in foarbyld fan in tekst yn it Frysk."[/color]

; Block 2
head_b2[deDE] := "Beispiel"
head_b2[enUS] := "Example"
head_b2[frFR] := "Exemple"
head_b2[esES] := "Ejemplo"
[color=red]head_b2[nlNL] := "Voorbeeld"
head_b2[fyNL] := "Foarbyld"[/color]
text_b2[deDE] := "Text für Freunde der AHK Syntax in HTML."
text_b2[enUS] := "Text for friends of the AHK-syntax in HTML."
text_b2[frFR] := "Texte pour les amis de la AHK-syntaxe HTML."
text_b2[esES] := "Texto para los amigos de la sintaxis de AHK en HTML."
[color=red]text_b2[nlNL] := "Tekst voor de vrienden van de AHK syntax in HTML."
text_b2[fyNL] := "Tekst foar de freonen fan de AHK syntax yn HTML."[/color]

; Block 3
head_b3[deDE] := "FailOver Beispiel"
head_b3[enUS] := "FailOver example"
text_b3[deDE] := "Diesen Text gibt es nicht auf Französich, Spanisch, [color=red]Niederländisch oder Friesisch.[/color]"
text_b3[enUS] := "This Text is not available in French, Spanish, [color=red]Dutch or Frisian.[/color]"

; ******************************************************************************************
; Evaluate the possible Languages / Auswerten der möglichen Sprachen

; Possible Language / Mögliche Sprachen
AvailLng := "deDE,Deutsch|enUS,English|frFR,Français|esES,Español[color=red]|nlNL,Nederlands|fyNL,Frysk[/color]"
:wink:

derRaphael
  • Members
  • 872 posts
  • Last active: Mar 19 2013 04:42 PM
  • Joined: 23 Nov 2007
cool! this is definitly something im gonna keep as an example :) ty

All scripts, unless otherwise noted, are hereby released under CC-BY

°digit°
  • Members
  • 2 posts
  • Last active: Oct 27 2008 09:58 AM
  • Joined: 30 Sep 2008

Allow me to add:[...]

:shock: Ooops, what did I kicked off here? :D
°digit°_____ò;Ó?__|:: delighted for myself (not for dR :wink: )
[Edit]: tooo slowley in posting ... as always
[Edit2]: @n-l-i-d who seems not to be able to be a "i-l-i-d": there's a lot of work by now coming towards to dR... and I'm to await to the next release. so ...:wink: but realy realy nice!
.::Posted Image::. just an AHk greenhorn ...

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Here's more: :wink:
head_b1[afZA] := "Hallo wêreld!"

text_b1[afZA] := "Ek is 'n voorbeeld van teks in Afrikaans."

head_b2[afZA] := "Voorbeeld"

text_b2[afZA] := "Teks vir vriende van die AHK-syntax in HTML."

text_b3[deDE] := "Diesen Text gibt es nicht auf Französich, Spanisch, Niederländisch, Friesisch oder Afrikanisch."
text_b3[enUS] := "This Text is not available in French, Spanish, Dutch, Frisian or Afrikaans."

"deDE,Deutsch|enUS,English|frFR,Français|esES,Español|nlNL,Nederlands|fyNL,Frysk|afZA,Afrikaans"
:p

Jex
  • Members
  • 101 posts
  • Last active: Oct 14 2010 04:22 PM
  • Joined: 01 Aug 2008
I am looking forward to the next update with much anticipation.

And I expect there to be a lot of bugs, but it runs so smoothly. :D

(Not trying to be rude)The only thing I want from it so far is ending the scripts, anything else will go above and beyond my expectations. :D

YAY!!!

Slanter
  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008
Found an error when using this on Win2k SP4.

When I go to <!-- m -->http://localhost:81/form.hkml<!-- m --> and click on the "Submit Query" button below "Standard (multipart/form-data)", Sparrow crashes about half the time. I get the windows popup that says

AutoHotkey.exe has generated an error and will be closed by Windows. You will need to restart the program.

An error log is being created.


Other than that, this looks like a great program! Can't wait to start playing :D
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.

twhyman
  • Members
  • 348 posts
  • Last active: Sep 17 2014 01:55 AM
  • Joined: 07 Dec 2005

Found an error when using this on Win2k SP4.

When I go to <!-- m -->http://localhost:81/form.hkml<!-- m --> and click on the "Submit Query" button below "Standard (multipart/form-data)", Sparrow crashes about half the time. I get the windows popup that says

AutoHotkey.exe has generated an error and will be closed by Windows. You will need to restart the program.

An error log is being created.


Other than that, this looks like a great program! Can't wait to start playing :D


i am on vista x64 and it crashes here too.

Sparrow is great :D


I would like to see some web-service like examples if you have some

And how can we compile it to an exe so we can do All in 1 web service script?
I tried compiling the core ahk but it does not work as a single exe, also tried to include the rest of the ahk file in the main folder but with no success.

Thanks
Twhyman
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.