mustilem23 Posted 9 hours ago Posted 9 hours ago Hello, I am very new and inexperienced in autoit coding, I am trying to progress with the information I received from you. I have a few issues that I am stuck on in a scenario. I want to delete all the pdf, excel or word files in C:\Users\mdogru\Desktop\IFS OUTPUT because I will save different files in this folder later in the scenario . My scenario in the design phase expandcollapse popup#include <AutoItConstants.au3> Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Opt('TrayIconDebug', 1) Opt("WinTitleMatchMode", 2) _WinWaitActivate("Satis Teklifi ","") Local $sText = WinGetTitle("[ACTIVE]") $sText=StringMid($sText,17,9) ;Sorgulama ekranı getiriliyor. sleep(1000) MouseClick($MOUSE_CLICK_LEFT,181 , 120, 2) sleep(1000) ;1 veri kopyalanıyor ,1. copy to the subject okkkkk... Send("^C") sleep(500) MouseClick($MOUSE_CLICK_LEFT,1122 , 247, 1) sleep(500) MouseClick($MOUSE_CLICK_RIGHT,1122 , 247, 1) sleep(500) send("{TAB 5}") sleep(50) Send("{ENTER}") sleep(500) _WinWaitActivate("Hızlı Rapor Sorgusu: 015 - SSH Teklif - IFS Applications","") sleep(500) send("{TAB 5}") Send("{ENTER}") ;teklif pdf ı görselı sleep(500) _WinWaitActivate("015 - SSH Teklif ","") sleep(500) MouseClick($MOUSE_CLICK_LEFT,67 , 98, 1) sleep(500) _WinWaitActivate("Export Report","") sleep(500) send("{TAB 6}") sleep(500) Send("^+{ENTER}") sleep(50) ;bu bölgede kaldik Send("C:\Users\mdogru\Desktop\IFS ÇIKTILARI") sleep(50) Send("^+{ENTER}") sleep(50) send("^+{TAB 7}") Send("^V") sleep(50) Send("{SPACE 2}") sleep(50) Send("DURMAZLAR_TEKLIF") sleep(50) send("{TAB}") sleep(50) Send("^{RIGHT}") Send("^{DOWN}") Send("{ENTER}") sleep(50) send("{TAB 2}") sleep(50) Send("^+{ENTER}") sleep(2500) _WinWaitActivate("Export Report","") Send("{ENTER}") ;cıktıyı bilgisayarda ki klasore ekleyen bölge son ;BURADA KALDIK MouseClick($MOUSE_CLICK_LEFT,677 , 419, 1) sleep(500) Send("{ENTER}") sleep(1000) MouseClick($MOUSE_CLICK_LEFT,25 , 44, 1) sleep(50) _WinWaitActivate("Satis Teklifi -","") sleep(50) MouseClick($MOUSE_CLICK_LEFT,181 , 120, 2) sleep(2000) ;1 veri kopyalanıyor ,1. copy to the subject okkkkk... Send("^C") sleep(500) _WinWaitActivate("Durma SSH ve diğer ","") ;TİCKET EKRANINDA KONU İÇİNE BASIYOR sleep(500) MouseClick($MOUSE_CLICK_LEFT,297, 160, 1) sleep(500) send("{TAB 18}") sleep(500) Send("^V") sleep(500) Send("{ENTER}") ;SSSSS sleep(1500) MouseClick($MOUSE_CLICK_LEFT,423, 627, 1) sleep(2000) _WinWaitActivate("Aç","") sleep(1500) MouseClick($MOUSE_CLICK_LEFT,313 , 49, 1) sleep(1500) Send("C:\Users\mdogru\Desktop\IFS ÇIKTILARI") sleep(1500) Send("{ENTER}") sleep(1000) MouseClick($MOUSE_CLICK_LEFT,527 , 299, 1) sleep(1500) Send("^a") sleep(1000) Send("{ENTER}") sleep(500) MouseClick($MOUSE_CLICK_LEFT,483 , 172, 1) sleep(500) MouseClick($MOUSE_CLICK_LEFT,483 , 172, 2) sleep(500) MouseClick($MOUSE_CLICK_LEFT,483 , 172, 1) sleep(500) sleep(500) Send("^V") Send("{SPACE 2}") sleep(500) Send("{ENTER}") sleep(500) MouseClick($MOUSE_CLICK_LEFT,423, 627, 1) sleep(500) ;SON EKLEME sleep(2000) _WinWaitActivate("Aç","") sleep(1500) MouseClick($MOUSE_CLICK_LEFT,313 , 49, 1) sleep(1500) Send("C:\Users\mdogru\Desktop\IFS ÇIKTILARI") sleep(500) Send("{ENTER}") sleep(500) MouseClick($MOUSE_CLICK_LEFT,527 , 299, 1) sleep(1500) Send("^a") sleep(500) Send("{DELETE}") sleep(50) Send("{ENTER}") sleep(50) Send("{ESC}")
Andreik Posted 8 hours ago Posted 8 hours ago Check in help file FileDelete(). You can use wildcards in the path like <DirPath>\*.pdf in order to delete all pdf files from a directory (replace <DirPath> with the full path to your actually directory).
mustilem23 Posted 7 hours ago Author Posted 7 hours ago Thank you, I have looked through the help file extensively and finally added my folder path to the scenario below, but the files are still there. Can you please help me? #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> Example() Func Example() ; Create a constant variable in Local scope of the filepath that will be read/written to. Local Const $sFilePath = _WinAPI_GetTempFileName(@TempDir) ; Create a temporary file to read data from. If Not FileWrite($sFilePath, "This is an example of using FileDelete.") Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") Return False EndIf ; Display the contents of the file passing the filepath to FileRead instead of a handle returned by FileOpen. MsgBox($MB_SYSTEMMODAL, "", "Contents of the file:" & @CRLF & FileRead($sFilePath)) ; Delete the temporary file. ;Local $iDelete = FileDelete($sFilePath[$i] & "C:\Users\mdogru\Desktop\IFS ÇIKTILARI\*pdf*") Local $iDelete ="C:\Users\mdogru\Desktop\IFS ÇIKTILARI\*.pdf*" ;Local $masterEdlFile = "G:\Session_Master\Show\Session_Data\Type2.edl" FileDelete($_sSrcPath2[$i] & "C:\Users\mdogru\Desktop\IFS ÇIKTILARI\*.pdf*") ; Display a message of whether the file was deleted. If $iDelete Then MsgBox($MB_SYSTEMMODAL, "", "The file was successfuly deleted.") Else MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst deleting the file.") EndIf EndFunc ;==>Example
Andreik Posted 6 hours ago Posted 6 hours ago 40 minutes ago, mustilem23 said: FileDelete($_sSrcPath2[$i] & "C:\Users\mdogru\Desktop\IFS ÇIKTILARI\*.pdf*") What is $_sSrcPath2? The following path already looks fine.
mustilem23 Posted 5 hours ago Author Posted 5 hours ago I think I added it while trying it out. It doesn't matter to me. How can I edit my path according to this scenario? I think I made a very small mistake. Can you help me please?
Andreik Posted 45 minutes ago Posted 45 minutes ago 4 hours ago, mustilem23 said: I think I added it while trying it out. It doesn't matter to me. It matters for the script. If it's anything else than empty string or some sort of spaces then most likely you pass to FileDelete() an invalid path.
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