dirty Posted October 20, 2011 Share Posted October 20, 2011 So i have a script reading path from INI file.ImagePath=.\Project Pictures\Core PeelPacks\7.5 Laser bridge.JPGWhen i start the script, picture is drawn in GUI and is executable by shellexzecuteThe input field for the image path also shows .\Project Pictures\Core PeelPacks\7.5 Laser bridge.JPGand this is exactly what shellexecute executes. It does it by guictrlread ($inputfieldofanimage) But when i start any function on the same scriutp that has anything to do with fileopendialog,.\Project Pictures\Core PeelPacks\7.5 Laser bridge.JPG is no longer valid.And without changing input field in gui, shellexecute can no longer find this file I dont understand why. Is something changes in the script behavior when fileopendialog() is used ? Thanks in advance Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 20, 2011 Moderators Share Posted October 20, 2011 dirty, If you read the Help file page for FileOpenDialog, you will see that: "@WorkingDir is changed on successful return" So try changing it back to the original using FileChangeDir once you have used the dialog. 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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 20, 2011 Share Posted October 20, 2011 Or specify the full path instead of a relative one. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
dirty Posted October 21, 2011 Author Share Posted October 21, 2011 i need to use relative path only. this is one limitation i want to implement so that users wont have to worru about having to fix path in each generated ini file.Just trying to keep the script as simple as i can with less then 2000 lines (thats too much for me) Wow i didnt know that FileChangeDir existed. So how do i use this to reset the default path to relative using FileChangeDir ?Not sure what parameters to give to it Link to comment Share on other sites More sharing options...
dirty Posted October 21, 2011 Author Share Posted October 21, 2011 i was also trying to isolate the relative directory subfolders. $AdminDefaultPicturesPath = ".\Default Pictures Folder" $EditMainImage = FileOpenDialog("Open Picture file", $AdminDefaultPicturesPath, "Picture files (*.JPG;*.JPEG;*.BMP) | All (*.*)") Dim $zDrive,$zPath,$zFile,$zExt _PathSplit ($EditMainImage,$zDrive,$zPath,$zFile,$zExt) When i do GUICtrlSetData($MainImagePath, $AdminDefaultPicturesPath & $zPath & $zFile & $zExt) i get in trouble because $zPath gives not just the selected folder from relative location, but provides whole path without Drive and filename. For example Current working directory is F:\Autoit projects\CS Surgical Inventory management\Source\Project Pictures $EditMainImage returns F:\Autoit projects\CS Surgical Inventory management\Source\Project Pictures\Subfolder\File.jpg Splitting path using $AdminDefaultPicturesPath & $zPath, i get .\Default Pictures Folder\Autoit projects\CS Surgical Inventory management\Source\Project Pictures\Subfolder\File.jpg but i need .\Default Pictures Folder\Subfolder\File.jpg how do i achieve this goal ? Thanks for replies and thanks in advance Link to comment Share on other sites More sharing options...
rover Posted October 21, 2011 Share Posted October 21, 2011 _WinAPI_GetOpenFileName() with the OFN_NOCHANGEDIR parameter, and _PathGetRelative() I see fascists... Link to comment Share on other sites More sharing options...
GEOSoft Posted October 21, 2011 Share Posted October 21, 2011 Post the result of @WorkingDir before you call FileOpenDialog() and the result of @WorkingDir after you call FileOpenDialog. It looks to me like this is easily managed without splitting the path at all and I think I have simple code to do it but I want to check to be sure. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
dirty Posted October 21, 2011 Author Share Posted October 21, 2011 (edited) _WinAPI_GetOpenFileName() with the OFN_NOCHANGEDIR parameter, and _PathGetRelative() Can you give me an example ?Am not sure how to use your references.Keep in mind that i should be able to go deeper into suborders bu not above working folder. Edited October 21, 2011 by dirty 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