Jump to content

Create Windows Services


 Share

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.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Hi

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

html:

<B><font size=3>Observações Gerais</font></B> Coloque tudo que ache pertinente ! Será copiado em todos os blocos<BR>
<TEXTAREA ROWS="4" COLS="80" NAME="----- OBSERVAÇÕES GERAIS"></TEXTAREA>
<input TYPE=HIDDEN NAME="ckblk" VALUE="of">

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

</P></FORM>
</FONT></BODY>
</HTML>

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

;**** PROGRAMA PRINCIPAL
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)
    EndIf
    Sleep($tempoEntreLeituras)              ;tempo entre as varridas, em milisegundos
WEnd
Exit

Regards

Jose

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...