The_Seeker Posted December 13, 2019 Share Posted December 13, 2019 I have a bunch of computers receiving an error that can be fixed by following the instructions here. This is my first script and it is not working can someone please tell me what I am doing wrong? #RequireAdmin #include <MsgBoxConstants.au3> Func ESENTFix() Local $sFilePath = @SystemDir & "\config\systemprofile\AppData\Local\TileDataLayer\Database" ; If the directory exists the don't continue. If FileExists($sFilePath) Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred. The directory already exists.") Return False EndIf ShellExecute(@SystemDir) ; Create the directory. DirCreate($sFilePath) ; Display a message of the directory creation. MsgBox($MB_SYSTEMMODAL, "", "The directory has been created.") EndFunc ;--> ESENTFix Basically I used the help file for DirCreate and tried to change the contents to match what I am trying to do. I do not get an error message and nothing is created. It was suggested to add the #RequireAdmin to the start in a chat room but it didn't help and I am not sure I need it or not. I have compiled it two or three times and still doesn't work as x86 or x64. Thank you Link to comment Share on other sites More sharing options...
argumentum Posted December 13, 2019 Share Posted December 13, 2019 ..use @WindowsDir & "\System32". Try that. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
The_Seeker Posted December 13, 2019 Author Share Posted December 13, 2019 #RequireAdmin #include <MsgBoxConstants.au3> ESSENTFix() Func ESENTFix() Local $sFilePath = @WindowsDir & "\System32\config\systemprofile\AppData\Local\TileDataLayer\Database" ; If the directory exists the don't continue. If FileExists($sFilePath) Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred. The directory already exists.") Return False EndIf ; Create the directory. DirCreate($sFilePath) ; Display a message of the directory creation. MsgBox($MB_SYSTEMMODAL, "", "The directory has been created.") EndFunc ;--> ESENTFix Changed to the above it says the folders were created but as the picture above they are not made. Also thank you for the help. argumentum 1 Link to comment Share on other sites More sharing options...
Musashi Posted December 13, 2019 Share Posted December 13, 2019 (edited) 1 hour ago, The_Seeker said: This is my first script and it is not working... Is this really your complete script? Regardless of errors within, you don't even start the function. Right now, the script doesn't do anything at all . EDIT : Okay, I was a few seconds late. The function is now called. Edited December 14, 2019 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Musashi Posted December 14, 2019 Share Posted December 14, 2019 9 minutes ago, The_Seeker said: Changed to the above it says the folders were created ... You have to check the return value of DirCreate, e.g. : Local $iResult $iResult = DirCreate($sFilePath) ; Display a message of the directory creation. MsgBox($MB_SYSTEMMODAL, "Create directory : ", "Result = " & $iResult) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
The_Seeker Posted December 14, 2019 Author Share Posted December 14, 2019 Would it be possible for you to show me where to put that in the script or what it is replacing? Link to comment Share on other sites More sharing options...
Musashi Posted December 14, 2019 Share Posted December 14, 2019 (edited) 9 hours ago, The_Seeker said: Would it be possible for you to show me where to put that in the script or what it is replacing? Here is a script with additional DEBUG info (can be removed later). As basis I used the last version posted by you. This may not solve your problem, but you will at least get feedback from the script. System folders can be awkward anyway. expandcollapse popup#include <MsgBoxConstants.au3> #RequireAdmin If _ESENTFix() Then ConsoleWrite("> @@DEBUG >>> _ESENTFix = True" & @CRLF) Else ConsoleWrite("! @@DEBUG >>> _ESENTFix = False" & @CRLF) EndIf Func _ESENTFix() Local $sFilePath = @WindowsDir & "\System32\config\systemprofile\AppData\Local\TileDataLayer\Database" Local $iRet ConsoleWrite("> @@DEBUG >>> $sFilePath = " & $sFilePath & @CRLF) ; If the directory exists then don't continue : If FileExists($sFilePath) Then ConsoleWrite("! @@DEBUG >>> FileExists = ERROR : The directory already exists" & @CRLF) MsgBox($MB_SYSTEMMODAL, "FileExists :", "ERROR : The directory already exists") Return False Else ConsoleWrite("+ @@DEBUG >>> FileExists = OK : The directory does not exists" & @CRLF) EndIf ; Create the directory. ==> Return Values : 1=Success ; 0=Failure) $iRet = DirCreate($sFilePath) ; Display a message of the directory creation. If $iRet Then ConsoleWrite("+ @@DEBUG >>> DirCreate = OK : The directory has been created" & @CRLF) MsgBox($MB_SYSTEMMODAL, "DirCreate :", "OK : The directory has been created") Else ConsoleWrite("+ @@DEBUG >>> DirCreate = ERROR : Creating the directory" & @CRLF) MsgBox($MB_SYSTEMMODAL, "DirCreate :", "ERROR : Creating the directory") Return False EndIf Return True EndFunc ;--> _ESENTFix Edited December 14, 2019 by Musashi typo "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
Nine Posted December 14, 2019 Share Posted December 14, 2019 Playing with system32 is always tricky especially on x64 computers running 32bits applications. Make sure you understand folder redirection and then set the appropriate value to : #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection (False) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
The_Seeker Posted December 17, 2019 Author Share Posted December 17, 2019 Thank you Musashi I will test on Wednesday at work at let you know what the above script does. Thank you Nine I will read this article you linked and try to understand. I appreciate everyone's help. Link to comment Share on other sites More sharing options...
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