Sign in to follow this  
Followers 0
NeilApp

Using autoit service to create files

4 posts in this topic

Hi guys,

I've made a program that runs as a service, it works fine normally but when i start it as a service it manages to edit files but it doesnt create the two .inis (temp.ini and dates.ini)

$replace = "INSTALL_FAILED"
$with = "INSTALL_PENDING"
$path = "C:\ini\"
$replaced = 0
$rpackagesb = 0
$firstfile = FileFindFirstFile($path & "*.ini")

if $firstfile = -1 Then
    Exit
EndIf

while 1
    $file = FileFindNextFile($firstfile)
    if @error then
        ExitLoop
    EndIf
    $packages = IniReadSectionNames($path & $file)
    for $i1 = 1 to $packages[0]
        $packaged = iniReadSection($path & $file,$packages[$i1])
        if @error Then
        ExitLoop
        EndIf
            for $i2 = 1 to $packaged[0][0]
                
                if $packaged[$i2][1]= $replace Then
                    $dates = IniRead("dates.ini","packagesreplaced",$packaged[$i2][0],"Default")
                    if $dates - @yday > 14 Then
                        IniWrite("Broken packages.ini","package",$packaged[$i2][0],$dates)
                    Else
                        IniWrite($path & $file,$packages[$i1],$packaged[$i2][0],$with)
                        IniWrite("dates.ini","packagesreplaced",$packaged[$i2][0],@YDAY)
                        IniWrite("temp.ini","packagesreplaced",$packaged[$i2][0],@YDAY)
                    EndIf
                EndIf
            Next
    Next
WEnd

FileClose($firstfile)

Any ideas guys?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

AutoIt exe's can't be run as a service.

Lots of posts about this.

Search the forum.

Edit: I read a bit to quick. You're saying you CAN run it as a service? Or is that with a third party program?

And you sure $path isn't needed b4 "dates.ini" & "temp.ini" when you IniWrite them?

Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

There is a lot of threads saying how to run autoit scripts as a service, there is even an entry in the FAQ for how to do it.

My exe does work but it just cant create the files for some reason, thats what im asking about.

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