232showtime Posted July 9, 2016 Share Posted July 9, 2016 Hi just want to ask why am I getting the return success value of destination path "C:\yahoo\1" ? #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Example() Func Example() Local $sFileSaveDialog = FileSaveDialog("Choose a filename.", "", "All Files(*.*)", $FD_PATHMUSTEXIST + $FD_MULTISELECT) $SaveDir = FileCopy($sFileSaveDialog, "", $FC_OVERWRITE) $GetPath = _WinAPI_GetFullPathName($sFileSaveDialog) ; Display the current working directory. MsgBox($MB_SYSTEMMODAL, "", "The current working directory: " & @CRLF & $GetPath) $sChangeDir = FileChangeDir("C:\yahoo") ;--> Path I want to get "C:\yahoo" $GetPath1 = _WinAPI_GetFullPathName($sChangeDir) If $sChangeDir = 0 Then MsgBox($MB_SYSTEMMODAL, "", "Error") Exit Else MsgBox($MB_SYSTEMMODAL, "", "Succes" & @CRLF & $GetPath1) ;--> Path I got "C:\yahoo\1" EndIf EndFunc ;==>Example I ran the example in helpfile and its working fine, is this a bug??? ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
mikell Posted July 9, 2016 Share Posted July 9, 2016 (edited) Please try $GetPath1 = _WinAPI_GetFullPathName(@WorkingDir) Edit In this case though, the winapi thing is redundant. Why not directly check @workingdir ? Edited July 9, 2016 by mikell 232showtime 1 Link to comment Share on other sites More sharing options...
232showtime Posted July 9, 2016 Author Share Posted July 9, 2016 (edited) OMG, Im a total noob... never thought of that... thank you... Edited July 9, 2016 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
mikell Posted July 9, 2016 Share Posted July 9, 2016 The help file is your best friend - you shouldn't lose touch with it Link to comment Share on other sites More sharing options...
232showtime Posted July 9, 2016 Author Share Posted July 9, 2016 @mikell sorry bout this but sometimes I get confused with so many codes , I always check help file, google, and auto it wiki... Quote Edit In this case though, the winapi thing is redundant. Why not directly check @workingdir ? I tried like this and I got Value of 1, instead of string path... #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Example() Func Example() Local $sFileSaveDialog = FileSaveDialog("Choose a filename.", "", "All Files(*.*)", $FD_PATHMUSTEXIST + $FD_MULTISELECT) $SaveDir = FileCopy($sFileSaveDialog, "C:\yahoo", $FC_OVERWRITE) $GetPath = _WinAPI_GetFullPathName($sFileSaveDialog) ; Display the current working directory. MsgBox($MB_SYSTEMMODAL, "", "The current working directory: " & @CRLF & $GetPath) $sChangeDir = FileChangeDir(@WorkingDir) ;--> Path I want to get "C:\yahoo" ;~ $GetPath1 = _WinAPI_GetFullPathName(@WorkingDir) ;~ If $sChangeDir = 0 Then ;~ MsgBox($MB_SYSTEMMODAL, "", "Error") ;~ Exit ;~ Else MsgBox($MB_SYSTEMMODAL, "", "Succes" & @CRLF & $sChangeDir) ;--> Path I got "1" ;~ EndIf EndFunc ;==>Example ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 9, 2016 Moderators Share Posted July 9, 2016 232showtime, Does this make it clearer? #include <MsgBoxConstants.au3> #include <FileConstants.au3> Example() Func Example() Local $sFileSaveDialog = FileSaveDialog("Choose a filename.", "", "All Files(*.*)", $FD_PATHMUSTEXIST + $FD_MULTISELECT) ;$GetPath = _WinAPI_GetFullPathName($sFileSaveDialog) ; Why do you do this, you already get the full path returned from the function call ; Display the current working directory. MsgBox($MB_SYSTEMMODAL, "", "The current working directory: " & @CRLF & $sFileSaveDialog) ; Now change the working folder $iRet = FileChangeDir("M:\Program") If $iRet = 0 Then MsgBox($MB_SYSTEMMODAL, "", "Error") Exit Else MsgBox($MB_SYSTEMMODAL, "", "Succes" & @CRLF & @WorkingDir) EndIf EndFunc ;==>Example M23 232showtime 1 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 Link to comment Share on other sites More sharing options...
232showtime Posted July 9, 2016 Author Share Posted July 9, 2016 @Melba23 first time user of $sFileSaveDialog, no idea that it will return the full path returned from function call basicallyI wanted to get the filepath of the files that I copied using FileCopy. I did so many workaround and I landed on my 1st post of script. its clear now . by the way is there any other way to get the file path of the file that I copied using filecopy??? Local $sFileSaveDialog = FileSaveDialog("Choose a filename.", "", "All Files(*.*)", $FD_PATHMUSTEXIST + $FD_MULTISELECT) $SaveDir = FileCopy($sFileSaveDialog, "C:\yahoo", $FC_OVERWRITE); ---------------------in this line I Want to Get "C:\yahoo" instead of the current working dir... in my case Save Dialog box working dir is C:\Users\user\Pictures.. so im getting the path of C:\Users\user\Pictures instead of "C:\yahoo" $GetPath = _WinAPI_GetFullPathName($SaveDir) ;--> I want t see what will happen here ; Display the current working directory. MsgBox($MB_SYSTEMMODAL, "", "The current working directory: " & @CRLF & $GetPath) many thanks @Melba23 & @mikell ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
mikell Posted July 9, 2016 Share Posted July 9, 2016 Hmm it seems that you are confusing several things. Please try this : #include <FileConstants.au3> #Include <Array.au3> #include <StringConstants.au3> Local $sFileOpenDialog = FileOpenDialog("Choose a filename.", "", "All Files(*.*)", $FD_PATHMUSTEXIST + $FD_MULTISELECT) If not @error Then MsgBox(0,"FileOpenDialog return", $sFileOpenDialog) $aSave = StringSplit($sFileOpenDialog, "|") _ArrayDisplay($aSave, "FileOpenDialog array") $destDir = "C:\yahoo\" ;<<< don't forget the backslash ! For $i = 2 to $aSave[0] FileCopy($aSave[1] & "\" & $aSave[$i], $destDir, $FC_CREATEPATH + $FC_OVERWRITE) Next EndIf ShellExecute($destDir ) 232showtime 1 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