Jump to content
Sign in to follow this  

Create Windows Services

Recommended Posts

@Blois, you were already told that interactive operations from a Windows service is deprecated. so instead of MsgBox(), use a non-interactive indicator for that piece of code being executed - for example, FileWrite() a timestamp and PID, so you know which process wrote what and when.

Share this post

Link to post
Share on other sites


Many years ago (2009) I created an au3 service to handle html forms.

In resume, the html form sent the data and there was an au3 service in windows that received that data and do something.

I do not remember of any problem like the ones you mention above. Follow parts of the code so you can take a look...,.  ( I do not remember many things, but I hope the code can help you), I just remember it was very easy, reliable (worked for many years, etc.)


<B><font size=3>Observações Gerais</font></B> Coloque tudo que ache pertinente ! Será copiado em todos os blocos<BR>
<input TYPE=HIDDEN NAME="ckblk" VALUE="of">

<input type="button" onClick="formSubmit()" value="Enviar">
<input TYPE="RESET" VALUE="Cancelar" NAME="Cancelar">


au3 service

Global $parametros, $posHexa, $caracConvertido, $valorHexa, $listaParams, $posIniBloco,$posFimbloco, $temp="", $paramsTratados
Global $elimina_campos_vazios= False, $colocarColchetes= False
Global $ListaArqsRT, $arqRT,$nomArqRT, $RT="", $tempoEntreLeituras=2000 
Global $oMyRet[2], $oMyError, $emailTO="", $emailSUBJ=""

$ListaArqsRT= "reqTrb-*.txt"
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

while True ;======= loop eterno =======> fica verificando se tem um arquivo de RT, se tiver, lê, trata e apaga-o 
    $arqRT= FileFindFirstFile($ListaArqsRT)
    if $arqRT <> -1 Then                    ;existe 1 arquivo, trata-o
        $nomArqRT= FileFindNextFile($arqRT) ;pega nome do arquivo com a RT dada no form html
        $RT= FileReadLine($nomArqRT)        ;lê o arquivo RT numa string só, pois tem 1 só linha c/ todos os parametros
        FileDelete($nomArqRT)               ;apaga o arquivo de RT lido
        FileClose($arqRT)                   ;fecha stream de arquivos
        trataRT($RT)                        ;trata a string lida, gerando o email com os parametros passados na RT
        EnviaEmail($emailTO, $emailSUBJ,$paramsTratados)
    Sleep($tempoEntreLeituras)              ;tempo entre as varridas, em milisegundos



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...