Sign in to follow this  
Followers 0
aggg63

Can't start a service script

7 posts in this topic

Hello.

I write this little script as example

while 1
    if mod(@MIN,5)=0 and @SEC=0 then Mensaje('Control','Servicio copiar','%','2','')
    sleep(1000)
wend

func Mensaje($Remite,$Mensaje,$Tipo,$Tiempo,$Accion)
    ; tipo [ ''=notificacion(defecto) | '%'=mensaje | '!'=error ]
    ; tiempo [ '0'=defecto | '-1'=indefinido | 's'=segundos ]
    run('d:\www\Sendlog32.exe ' & $tipo & '#from:' & $Remite & '#delay:' & $Tiempo & _
        '#right:open:' & $Accion & '#msg:' & $Mensaje)
endfunc

I installed it as service with InnoSetup but doesn't start ;) . The script works very well as exe.

Please, can somebody help me to start this as service? Thanks a lot.

Share this post


Link to post
Share on other sites



It works perfectly :-).

Share this post


Link to post
Share on other sites

you want it every 5 minutes right?

try this:

$iTimer = TimerInit()
While 1
    If TimerDiff($iTimer) > 5 * 60 * 1000 Then ; Every 5 minutes
        Mensaje('Control', 'Servicio copiar', '%', '2', '')
        $iTimer = TimerInit()
    EndIf
    Sleep(250)
WEnd

Func Mensaje($Remite, $Mensaje, $Tipo, $Tiempo, $Accion)
    ; tipo [ ''=notificacion(defecto) | '%'=mensaje | '!'=error ]
    ; tiempo [ '0'=defecto | '-1'=indefinido | 's'=segundos ]
    Run('d:\www\Sendlog32.exe ' & $Tipo & '#from:' & $Remite & '#delay:' & $Tiempo & _
            '#right:open:' & $Accion & '#msg:' & $Mensaje)
EndFunc   ;==>Mensaje

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Thanks, but this is not the problem. The script run every 5 minuts in exe mode. The sendlog32 is an program to send messages to Miranda plugin NotifyAnything. I want an script as service. This is only a test to try to write a service more complex. I use InnoSetup to install the service and all seems correct. It appears in Service Manager but doesn't start :-(.

Share this post


Link to post
Share on other sites

The script works very well as exe.

Ok i confess, I cant Read ;)

but i would recommend you the proposed timer solutions...

a autoit exe cant be run as service directly.

you need 'srvany.exe' or so...

check out Q4 in the faq


CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map

Share this post


Link to post
Share on other sites

Ok i confess, I cant Read :lmao:

but i would recommend you the proposed timer solutions...

a autoit exe cant be run as service directly.

you need 'srvany.exe' or so...

check out Q4 in the faq

Well, I get my script running as service ;) Thanks for the help.

But the FAQ have a mistake, the line

_CreateService("", $servicename, "My AutoIt Script", "C:\Path_to_srvany.exe", "LocalSystem", "", 0x110)

must be

_CreateService("", $servicename, "My AutoIt Script", "C:\Path_to_srvany.exe", "LocalSystem", "", 0x10,0x2)

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  
Followers 0