Jump to content

Using autoit service to create files


Recommended Posts

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?

Link to comment
Share on other sites

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)

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