Search the Community
Showing results for tags 'FilePath'.
-
Hey Community, cause im too new in the Auto it world i will try it with the your help. hopefully. I woud like to know how i can handle my Problem. ---- I have a Excel Data with 362 random numbers. For Example: 1166642335374 1172899897343 ..... this numbers are a part of the filepath ...example D:\Projekte\1166_64233_5374 as u can see its the first number of the Excel data. After the first 4 numbers it shoud make a "_" than another 5 "_" This is my first question. How can i handle this to make it Shell execute. -------- Second question: If i am in the path. For Example: D:\Projekte\1166_64233_5374 the code shoud search for specific PDF Files. They are named like: 0050569E364B1ED79B900F73E62660EC.pdf the first 15 letters are always the same 0050569E364B1ED when he found this data he has to copy it on a Folder on the Desktop. (There can also be 2 or 3 pdfs in one Folder with this letters) ---- Please give me some help :-)
-
Hello Guys, Planning to build a little script to get the path of a file. Wondering if there is any change I can drop a file in a box and read its path. Or click on it and read it. Or any easy way of getting the file path - the specific file that i want from a specific folder. Planning to store the path in a variable and use it after. I can't find anywhere an example of how to read and store the path of a file in a folder. Appreciate.
-
Hello , I want to know the advantage of using a file handle in functions like FileRead or FileWrite... Maybe a file handle has better speed... Thanks in Advance, TD P.S I am going to sleep after posting this
-
So here is a current SciTE tool I'm working on, I need a little help finishing it up. I need to have the main gui read the _res.profile that's associated with the script in the focused tab in SciTE... I need it to enter the selected file path at the insertoin cursor in SciTE... anyone wanna throw in on this one? #region;;;;;;;;;;;;;;;SciTE Resource Manager;;;;;;;;;;;;;;;;;;; ;;;;;created by Wombat with help from Melba23, guinness, and Edano;;;;;; #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <SendMessage.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) #NoTrayIcon #region ;;;GUI starts here;;;; $hGUI_Main = GUICreate("Resource Manager", 448, 603, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "MainGUIClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") $List1 = GUICtrlCreateList("", 0, 0, 446, 565) $Options = GUICtrlCreateButton("SHOW OPTIONS", 5, 568, 305, 33) GUICtrlSetOnEvent(-1, "OptionsClick") $Options = GUICtrlCreateButton("REFRESH", 350, 568, 65, 33) GUICtrlSetOnEvent(-1, "RefreshClick") $cDrop_Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_On_Drop") Global $aDrop_List Global $List1Data GUISetState(@SW_SHOW) #endregion ;;;;;GUI ends here;;;;;6 #region ;;;These register a user defined function for a known Windows Message ID;;;; GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") GUIRegisterMsg(0x233, "On_WM_DROPFILES");<--- This is how the GUI registers the dropped files #endregion ;;;;;;; #region ;;;This is the startup action that populates the ResourceManager's listbox;;; Global $List1Data Global $WinTitle = WinGetTitle('[CLASS:SciTEWindow]') Local $sFilePath = StringRegExpReplace($WinTitle, '^(\V+)(?:\h[-*]\V+)$', '\1') _FileReadToArray($sFilePath & "_res.txt", $List1Data) $ListDef = _ArrayToString($List1Data) GUICtrlSetData($List1, $ListDef) #endregion ;;;;;;;;;;;; While 1 Sleep(10) WEnd #region ;;;;Functions start here;;;;;; Func MainGUIClose();<---- This exits the script and stops the process Exit EndFunc Func RefreshClick();<----This refreshs the Resource Manager's ListBox GUICtrlSetData($List1, "") Local $sFilePath = StringRegExpReplace($WinTitle, '^(\V+)(?:\h[-*]\V+)$', '\1') _FileReadToArray($sFilePath & "_res.txt", $List1Data) $ListDef = _ArrayToString($List1Data) GUICtrlSetData($List1, $ListDef) EndFunc Func OptionsClick();<---- This calls up another gui which edits the contents of the resource file $hGUI = GUICreate("RM Options", 375, 376, 300, 124, Default, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "OptionsClose") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore") Global $List2 = GUICtrlCreateList("", 0, -1, 283, 381, $LBS_EXTENDEDSEL) Global $bDeleteSel = GUICtrlCreateButton("Delete Selection", 285, 40, 89, 33) GUICtrlSetOnEvent(-1, "DelSel") Global $bClearAll = GUICtrlCreateButton("Clear All", 299, 88, 73, 33) GUICtrlSetOnEvent(-1, "ClearAll") Global $bGenerate = GUICtrlCreateButton("Generate", 315, 320, 57, 41) GUICtrlSetOnEvent(-1, "GenerateProf") Global $Label1 = GUICtrlCreateLabel("Edit Resource List", 285, 8, 90, 17) Global $Label2 = GUICtrlCreateLabel("Generate", 320, 264, 48, 17) Global $Label3 = GUICtrlCreateLabel("Resource Profile", 295, 288, 82, 17) Global $cDrop_Dummy = GUICtrlCreateDummy() GUICtrlSetOnEvent(-1, "_On_Drop") Global $aDrop_List GUISetState(@SW_SHOW) EndFunc Func _On_Drop() ;<---- This populates the Options Window's ListBox with the items draged&dropped onto it For $i = 1 To $aDrop_List[0] GUICtrlSetData($List2, $aDrop_List[$i]) Next EndFunc ;==>_On_Drop Func On_WM_DROPFILES($hWnd, $iMsg, $wParam, $lParam);<---- This is how the GUI registers the dropped files ; Credit to ProgAndy for DLL calls #forceref $hWnd, $iMsg, $lParam Local $iSize, $pFileName ; Get number of files dropped Local $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 0) ; Reset array to correct size Global $aDrop_List[$aRet[0] + 1] = [$aRet[0]] ; And add item names For $i = 0 To $aRet[0] - 1 $aRet = DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0) $iSize = $aRet[0] + 1 $pFileName = DllStructCreate("wchar[" & $iSize & "]") DllCall("shell32.dll", "int", "DragQueryFileW", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $iSize) $aDrop_List[$i + 1] = DllStructGetData($pFileName, 1) $pFileName = 0 Next ; Send the count to trigger the drop function in the main loop GUICtrlSendToDummy($cDrop_Dummy, $aDrop_List[0]) EndFunc ;==>On_WM_DROPFILES Func DelSel();<---- This deletes the item selected in the Options Window ListBox Local $a_SelectedItems = _GUICtrlListBox_GetSelItems($List2) For $i = $a_SelectedItems[0] To 1 Step -1 _GUICtrlListBox_DeleteString($List2, $a_SelectedItems[$i]) Next EndFunc Func ClearAll();<---- This clears the contents of the ListBox in the Options Window GUICtrlSetData($List2, "") EndFunc Func GenerateProf();<---- This creates the resource profile $FileCount = _GUICtrlListBox_GetCount($List2) $FileList[$FileCount + 1] For $i = 0 To $FileCount $FileList[$i] = _GUICtrlListBox_GetText($List2, $i) Next _ArrayDelete($FileList, $i) _FileWriteFromArray($sFilePath & "_res.txt", $FileList) EndFunc Func OptionsClose();<----This closes the Options Window leaving the MainGUI open !if Exit is used here it will close both windows! GUIDelete("RM Options") EndFunc Func Form1Minimize() EndFunc Func Form1Restore() EndFunc Func _SciTE_InsertText($sString);<---- This inserts the item double-clicked in the ListBox in the Resource Manager's window $sString = StringReplace($sString, '\', '\\') _SciTE_ReplaceMarcos($sString) Return _SciTE_Send_Command(0, _SciTE_WinGetDirector(), 'insert:' & $sString) EndFunc ;==>_SciTE_InsertText Func _SciTE_ReplaceMarcos(ByRef $sString) $sString = StringReplace($sString, @TAB, '\t') $sString = StringReplace($sString, @CR, '\r') $sString = StringReplace($sString, @LF, '\n') EndFunc ;==>_SciTE_ReplaceMarcos Func _SciTE_WinGetDirector() Return WinGetHandle('DirectorExtension') EndFunc ;==>_SciTE_WinGetDirector Func _SciTE_Send_Command($hHandle, $hSciTE, $sString) Local $ilParam, $tData If StringStripWS($sString, 8) = "" Then Return SetError(2, 0, 0) ; String is blank. EndIf $sString = ":" & Dec(StringTrimLeft($hHandle, 2)) & ":" & $sString $tData = DllStructCreate("char[" & StringLen($sString) + 1 & "]") ; wchar DllStructSetData($tData, 1, $sString) $ilParam = DllStructCreate("ptr;dword;ptr") ; ulong_ptr;dword;ptr DllStructSetData($ilParam, 1, 1) ; $ilParam, 1, 1 DllStructSetData($ilParam, 2, DllStructGetSize($tData)) DllStructSetData($ilParam, 3, DllStructGetPtr($tData)) _SendMessage($hSciTE, $WM_COPYDATA, $hHandle, DllStructGetPtr($ilParam)) Return Number(Not @error) EndFunc ;==>_SciTE_Send_Command Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam);<---- This reads the item that is double-clicked in the ListBox in the Resource Manager's window #forceref $hWnd, $iMsg, $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $iCode Case $LBN_DBLCLK Switch $iIDFrom Case $List1 $QMark= Chr(34) $sData = GUICtrlRead($List1) ; Use the native function _SciTE_InsertText($QMark & $sData & $QMark) EndSwitch EndSwitch EndFunc #endregion ;;;;;Functions End Here;;;;; #endregion CODE updated per release thread in Example Scripts, to keep it consistent...
- 26 replies
-
- Scite Add-on
- SciTE Tools
-
(and 5 more)
Tagged with: