Jump to content

path is not valid anywhere anymore after use of fileopendialog


dirty
 Share

Recommended Posts

So i have a script reading path from INI file.

ImagePath=.\Project Pictures\Core PeelPacks\7.5 Laser bridge.JPG

When i start the script, picture is drawn in GUI and is executable by shellexzecute

The input field for the image path also shows .\Project Pictures\Core PeelPacks\7.5 Laser bridge.JPG

and 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 :graduated:

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

  • Moderators

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. :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 :graduated:

Link to comment
Share on other sites

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

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

_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 by dirty
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...