AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sparrow: AHK WebServer w/ AHK in HTML support (sources incl)
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
LiquidGravity
Guest





PostPosted: Fri Sep 26, 2008 12:39 pm    Post subject: Reply with quote

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.
Back to top
derRaphael



Joined: 23 Nov 2007
Posts: 841
Location: ~/.

PostPosted: Fri Sep 26, 2008 1:28 pm    Post subject: Reply with quote

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 Smile

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.

Quote:
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
Back to top
View user's profile Send private message
LiquidGravity
Guest





PostPosted: Fri Sep 26, 2008 2:33 pm    Post subject: Reply with quote

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.


Quote:
Quote:
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.
Back to top
derRaphael



Joined: 23 Nov 2007
Posts: 841
Location: ~/.

PostPosted: Fri Sep 26, 2008 2:45 pm    Post subject: Reply with quote

at the bottom of the page Smile
http://SparrowServer:81/index.hkml wrote:
Have fun!
dR / Sep 26 2008


greets
dR
_________________

    All scripts, unless otherwise noted, are hereby released under CC-BY
Back to top
View user's profile Send private message
derRaphael



Joined: 23 Nov 2007
Posts: 841
Location: ~/.

PostPosted: Mon Sep 29, 2008 7:15 am    Post subject: Reply with quote

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

Code:
<html>
<head><title>HKML Multiple Language</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!"
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>")
}

?>
</body>
</html>


greets
dR
_________________

    All scripts, unless otherwise noted, are hereby released under CC-BY
Back to top
View user's profile Send private message
°digit°



Joined: 30 Sep 2008
Posts: 2
Location: Made in Germany

PostPosted: Wed Oct 01, 2008 11:33 am    Post subject: Reply with quote

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:
  1. are those phrases more or less OK (comments / improvements are desired) for to make it "well-dressed" for spanish eyes?
  2. 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:

Code:
<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] := "¡Hola mundo!"
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."

; Block 2
head_b2[deDE] := "Beispiel"
head_b2[enUS] := "Example"
head_b2[frFR] := "Exemple"
head_b2[esES] := "Ejemplo"
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."

; 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!
_________________
.::::. just an AHk greenhorn ...
Back to top
View user's profile Send private message
Jex(is not logged in)
Guest





PostPosted: Wed Oct 01, 2008 3:36 pm    Post subject: Reply with quote

Yay, sparrow is awesome.

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

firstly:
Code:
<?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?
Back to top
derRaphael



Joined: 23 Nov 2007
Posts: 841
Location: ~/.

PostPosted: Wed Oct 01, 2008 4:10 pm    Post subject: Reply with quote

jex, u're playing with an alpha version of a slightly complex software Smile
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
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Wed Oct 01, 2008 8:41 pm    Post subject: Reply with quote

Allow me to add:
Code:
; Block 1
head_b1[deDE] := "Hallo Welt"
head_b1[enUS] := "Hello world"
head_b1[frFR] := "Bonjour tout le monde!"
head_b1[esES] := "¡Hola mundo!"
head_b1[nlNL] := "Hallo wereld!"
head_b1[fyNL] := "Hallo wrâld!"

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."
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."


; Block 2
head_b2[deDE] := "Beispiel"
head_b2[enUS] := "Example"
head_b2[frFR] := "Exemple"
head_b2[esES] := "Ejemplo"
head_b2[nlNL] := "Voorbeeld"
head_b2[fyNL] := "Foarbyld"

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."
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."


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

; ******************************************************************************************
; 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|nlNL,Nederlands|fyNL,Frysk"

Wink
Back to top
derRaphael



Joined: 23 Nov 2007
Posts: 841
Location: ~/.

PostPosted: Wed Oct 01, 2008 9:30 pm    Post subject: Reply with quote

cool! this is definitly something im gonna keep as an example :) ty
_________________

    All scripts, unless otherwise noted, are hereby released under CC-BY
Back to top
View user's profile Send private message
°digit°



Joined: 30 Sep 2008
Posts: 2
Location: Made in Germany

PostPosted: Wed Oct 01, 2008 9:31 pm    Post subject: Reply with quote

n-l-i-d wrote:
Allow me to add:[...]
Shocked Ooops, what did I kicked off here? Very Happy
°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!
_________________
.::::. just an AHk greenhorn ...


Last edited by °digit° on Wed Oct 01, 2008 11:08 pm; edited 3 times in total
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Wed Oct 01, 2008 10:07 pm    Post subject: Reply with quote

Here's more: Wink
Code:
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"

Razz
Back to top
Jex



Joined: 01 Aug 2008
Posts: 101

PostPosted: Fri Oct 03, 2008 12:04 am    Post subject: Reply with quote

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. Very Happy

(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. Very Happy

YAY!!!
_________________
Woot.

Please read forum etiquette
Back to top
View user's profile Send private message
Slanter



Joined: 28 May 2008
Posts: 739
Location: Minnesota, USA

PostPosted: Wed Oct 22, 2008 3:08 am    Post subject: Reply with quote

Found an error when using this on Win2k SP4.

When I go to http://localhost:81/form.hkml 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
Program Error wrote:
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 Very Happy
_________________
Unless otherwise stated, all code is untested

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message Visit poster's website
twhyman



Joined: 07 Dec 2005
Posts: 339

PostPosted: Wed Oct 22, 2008 7:19 am    Post subject: Reply with quote

Slanter wrote:
Found an error when using this on Win2k SP4.

When I go to http://localhost:81/form.hkml 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
Program Error wrote:
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 Very Happy


i am on vista x64 and it crashes here too.

Sparrow is great Very Happy


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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 2 of 7

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group