Computer Science Canada

Accessing the Startup Folder

Author:  Prince Pwn [ Tue Sep 30, 2008 6:27 am ]
Post subject:  Accessing the Startup Folder

Can Turing access the startup folder in Windows XP? I'm getting an error, maybe there's something wrong with my code but it shows up as read only:

Turing:

type data :
    record
        size, attribute, fileTime, stream : int
        pathName : string
    end record

var file : data
file.pathName := "C:/Documents and Settings/" + Sys.GetUserName + "/Start Menu/Programs/Startup"

File.Status (file.pathName, file.size, file.attribute, file.fileTime)
if Error.Last = eNoError then
    put "      Name: ", File.FullPath (file.pathName)
    put "   Created: ", Time.SecDate (file.fileTime)
    put "      Size: ", file.size, " bytes"
    put "Attributes: " ..
    if (file.attribute and ootAttrDir) not= 0 then
        put "Directory " ..
    else
        put "" ..
    end if
    if (file.attribute and ootAttrRead) not= 0 then
        put "Readable " ..
    else
        put "" ..
    end if
    if (file.attribute and ootAttrWrite) not= 0 then
        put "Writable " ..
    else
        put "" ..
    end if
    if (file.attribute and ootAttrExecute) not= 0 then
        put "Executable", skip
    else
        put skip
    end if
else
    put "Unable to get file information"
    put "Error: ", Error.LastMsg, skip
end if


open : file.stream, file.pathName, put, mod
%put :
close : file.stream

Author:  Clayton [ Tue Sep 30, 2008 9:11 am ]
Post subject:  RE:Accessing the Startup Folder

Maybe because it is read-only? What kind of account the user is on could greatly limit the amount of poking around you are able to do.

Author:  S_Grimm [ Tue Sep 30, 2008 10:15 am ]
Post subject:  RE:Accessing the Startup Folder

unless your going through DOS or LINUX, windows directory is read only. ie YOU CAN NOT CHANGE IT!

Author:  Insectoid [ Tue Sep 30, 2008 1:18 pm ]
Post subject:  RE:Accessing the Startup Folder

go to the file and select 'properties' and uncheck 'read-only'. This works for most files, dunno about the directory.

Author:  Prince Pwn [ Tue Sep 30, 2008 3:00 pm ]
Post subject:  RE:Accessing the Startup Folder

Thanks for the suggestions, but it was a mistake in the coding. I forgot to add the filename to the path,

Turing:

file.path + '/' + file.name


: