MarkMarkMark Posted July 16, 2009 Posted July 16, 2009 Hello guys, Have been for ever since i programmed something in AutoIT. For my work i have to make the following: A script that works under the guest account. The guest can do almost anything with the computer like messing with my documents, making shortcuts on the desktop and adding pictures to my pictures. They can also fill the recycle bin. So far, i got this script, but it actually deletes the map 'Desktop' What i'm trying to do is make a script that just empties that map instead of deleting it. Is there also a way in autoit that users cannot change the startpage of firefox and iexplore Is there also a way that users cannot change the wallpaper? I dont expect you guys to give me the whole code, but can you get me started? #Include <File.au3> $map = 'C:\Documents and Settings\Klant2\Bureaublad\' _DirRemoveContents($map) _Prullenbak Func _DirRemoveContents($folder) Local $list_of_contents, $status $list_of_contents = _FileListToArray($folder) If IsArray($list_of_contents) Then If StringRight($folder, 1) <> "\" Then $folder = $folder & "\" If @error = 1 Then Return 1 For $a = 1 To $list_of_contents[0] FileSetAttrib($folder & "\" & $list_of_contents[$a], "-RASH") If StringInStr(FileGetAttrib($folder & $list_of_contents[$a]), "D") Then $status = DirRemove($folder & $list_of_contents[$a], 1) Else $status = FileDelete($folder & $list_of_contents[$a]) EndIf Next Else Return 2 EndIf EndFunc Func _Prullenbak() FileRecycleEmpty() If @error = 1 Then Return 1 Endfunc Thanks!
Arterie Posted July 16, 2009 Posted July 16, 2009 This should find all files in the desktopdir and announce them in a MsgBox.. see FileFindNextFile in your HelpDir ; Shows the filenames of all files in the current directory $search = FileFindFirstFile(@DesktopDir & "\*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) ; Maybe a FileDelete at this point WEnd ; Close the search handle FileClose($search)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now