Borje Posted August 31, 2018 Posted August 31, 2018 Hi I have problem in the section 2 the filedelete not works , but if I separate the section 2 and run it in a separte script it works what is the problem? expandcollapse popup;#NoTrayIcon #include <File.au3> #include <Date.au3> ;----------------------------------------------------- Section 1 -------------------------------------------------------------------------- $Folder = "C:\windows\temp" $Run = "Test.exe" FileSetAttrib($Folder & "\*", "-R+SH",1) Run($Run) ProcessWaitClose($Run) $test = _FileListToArray($Folder) If IsArray($test) Then For $i = 1 To UBound($test) - 1 $tijd = StringRegExpReplace(FileGetTime($Folder & $test[$i], 1, 1), "(.{4})(.{2})(.{2})(.{2})(.{2})(.{2})", "${1}/${2}/${3} ${4}:${5}:${6}") If _DateDiff('D', $tijd, _NowCalc()) = 0 Then FileDelete($Folder & $test[$i]) DirRemove ($Folder & $test[$i]) EndIf Next EndIf FileSetAttrib($Folder1, "-RSH",1) ;--------------------------------------------------------- Section 2 -------------------------------------------------------------------------------- FileSetAttrib(@TempDir & "\Test.exe", "-R+SH", 1) FileSetAttrib(@TempDir & "\start.exe", "-R+SH", 1) FileSetAttrib(@TempDir & "\Test.exe", "-RSH", 1) FileSetAttrib(@TempDir & "\Start.exe", "-RSH", 1) FileDelete(@TempDir & "\Test.exe") FileDelete(@TempDir & "\start.exe") Exit ;-----------------------------------------------------------------------------------------------------------------------------------------------------------
Borje Posted September 1, 2018 Author Posted September 1, 2018 No one has any tips why it's not possible to have these sections in the same script how would you solve it?
Moderators Melba23 Posted September 1, 2018 Moderators Posted September 1, 2018 Borje, Are you sure that @TempDir is actually returning "C:\windows\temp" as your script assumes? When I look at that macro it returns "C:\Users\Melba23\AppData\Local\Temp"..... M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Borje Posted September 1, 2018 Author Posted September 1, 2018 Hi Melba23I've checked it out, I've tried to separate these two script sections 1 and section 2 and when I run them separately they work separately. but if I have both section 1 and section 2 in the same script, then what's in section 2 does not work. What can it be?
Moderators Melba23 Posted September 1, 2018 Moderators Posted September 1, 2018 Borje, Quote I've checked it out And what was the result? It seems to me that the first section is using "C:\windows\temp" as the path for the files while the second is using @TempDir - which as I showed above is not the same on my machine. Hence my question as to what @TempDir returns on your machine. I suggest that you add some ConsoleWrite statements to check what you are actually passing as filepaths to the various AutoIt commands. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Borje Posted September 1, 2018 Author Posted September 1, 2018 My tempdir returns: c:\documents and settings\lokala inställningar\temp
Moderators Melba23 Posted September 1, 2018 Moderators Posted September 1, 2018 Borje, And where are Start.exe and Test.exe located? Please do as I suggested above - add some Consolewrites to check the actual file paths being passed to the commands. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Borje Posted September 1, 2018 Author Posted September 1, 2018 Ok i add some consol writes and see, the test.exe and Start.exe are in @TempDir root
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