Sign in to follow this  
Followers 0
emendelson

FileOpenDialog "init dir" always C:\TEMP?

22 posts in this topic

Is this a known problem, or something unique to my system?

I have a C:TEMP folder on my system. If I use FileOpenDialog, and specify "init dir" as anything at all ("C:", @DesktopDir, etc.), the "init dir' is ignored, and the dialog always opens on C:TEMP.

If I change the name of C:TEMP to anything else (C:TMP, for example), then FileOpenDialog works correctly.

Does anyone have any idea of why this might be happening?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

Can you post the code?

Edit: I guess your script is in the C:TEMP dir.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

Can you post the code?

Edit: I guess your script is in the C:TEMP dir.

 

Actually the code is in D:AutoItScripts, and this is enough to show the effect.

$pclfile = FileOpenDialog("Select a PCL, PXL, or PRN file to convert to PDF", @HomeDrive & "\", "All (*.*)", 3)

But I just realized that the problem occurs only when I run the script either from inside the editor or when I right-click on the script and choose Run Script. If I build the script as an executable and run the executable, then the problem does NOT occur.

Again, this only occurs when C:TEMP exists, even when C:TEMP is completely empty. The script is not in C:TEMP, and the problem occurs when C:TEMP is empty.

This is under Windows XP SP3, by the way.

Edited by emendelson

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

And what's the value of @HomeDrive/@WorkingDir (test them when it fails ofc) ?

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

And what's the value of @HomeDrive/@WorkingDir (test them when it fails ofc) ?

I added :

MsgBox(0,"", @HomeDrive)

MsgBox(0,"", @WorkingDir)

The result is:

@HomeDrive is C:

@WorkingDir is D:AutoitScripts

When run from the editor, and C:TEMP exists, the initial directory in the open file dialog is C:TEMP.

When I rename C:TEMP to C:TMP, and run the script from the editor, the initial directory in the open file dialog is (correctly) @HomeDrive & "" - in other words, C:.

I'm afraid I don't understand "test them when it fails ofc". Could you spell out what you're saying? Apologies for being so dense, and thanks for trying to help sort this out.

Edited by emendelson

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I said test those macros only for the cases when the init dir is wrong.

I suggest you to wait for someone else to pop-in or submit a trac here.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I said test those macros only for the cases when the init dir is wrong.

I suggest you to wait for someone else to pop-in or submit a trac here.

 

I finally got around to something I should have tested earlier: I have a dual-boot machine, and so I booted to Windows 7 32-bit (on drive I:), with AutoIt installed in Windows 7 also, and the problem did not occur at all - even though I have an I:TEMP and a C:TEMP. So it has something to do with my XP environment, though I can't imagine what.

C:TEMP isn't in any environmental variable. So it's very strange. Thanks again for trying to help sort this out.

Edited by emendelson

Share this post


Link to post
Share on other sites

I tested this, and found that if I run this on any of the beta versions starting from at least 3.3.9.8, if you use FileOpenDialog in SciTE, navigate to a folder, and open a file from that folder. If you run it again from SciTE it will open the FileOpenDialog from that folder, and disregards the "init dir" parameter. It does not do this in 3.3.8.1.

I don't know what version you're using but that's how I duplicated the problem. Also, running this on Windows 7 x64.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Strange that the working dir is still the same when it occurs.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hi,

I cannot reproduce BrewManNH's symptoms on Vista x32 v3.3.9.14 - I get the requested "init dir" regardless of whether I open a file from within SciTE or not. @WorkingDir get changed as expected but the next FileOpenDialog opens as requested: :)

ConsoleWrite(@HomeDrive & @CRLF) ; Shows C:

ConsoleWrite(@WorkingDir & @CRLF) ; Shows M:\Program\Au3 Scripts

$sFile = FileOpenDialog("test", @HomeDrive & "\", "All (*.*)", 3) ; Opens in C:

; Navigate to M:\Program\Au3 Scripts and select a file

ConsoleWrite(@WorkingDir & @CRLF) ; Set to M:\Program\Au3 Scripts if a file is selected else unchanged
ShellExecute($sFile) ; Open file in SciTE

$sFile = FileOpenDialog("test", "D:\", "All (*.*)", 3) ; Opens in D: as requested
M23 Edited by Melba23
Added Autoit version

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

I just tried this on a second computer, also running Win7 x64, and I get the same results using 3.3.9.12. I don't know if this matters, although it shouldn't matter, but I'm running a portable version of AutoIt and not installing it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

BrewManNH,

I am using v3.3.9.14 - have you tried with that? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

I just downloaded 3.3.9.15 and ran this script with it.

$pclfile = FileOpenDialog("Select a PCL, PXL, or PRN file to convert to PDF", @HomeDrive & "\", "All (*.*)", 3)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') :  @HomeDrive & "\" = ' &  @HomeDrive & "\" & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
And, when I run it the first time, it opens at the root of the C drive, I then navigate from there to the C:Users folder, open a file from there and then hit ok. The script ends. I run the script a second time from Scite, and it opens at C:Users instead of C:. the @HomeDrive & "" string always says C: regardless of where the FileOpenDialog actually opens at. Everytime I run the script from SciTE I get the same thing to happen. Even if I close SciTE and rerun it, the same thing happens.

I'm wondering if there's something going on with SciTE rather than AutoIt.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

BrewManNH,

Cannot reproduce those symptoms - that script always opens FileOpen Dialog in C: for me. ;)

Versions: AutoIt v3.3.9.15, SciTE v3.3.2.0, AutoIt3Wrapper v.2.1.2.24, Vista x32.

You say this happens on a 64 bit system - do both the 32 and 64 bit AutoIt interpreters show the same behaviour? :huh:

All,

Can we get feedback from others please - particularly those who can test on both32 and 64 bit systems. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

I tested using both the current beta and stable on Windows 7 x64 with using AutoIt.exe and AutoIt_x64.exe and I too can confirm what BrewManNH said. if you don't select any file then it doesn't occur. I believe it could be a Windows "thing"?!


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Run the script elevated(as administrator).

Just noticed you were on XP. Nvm this.

Problem seems to be:

You have your script on one drive(D:) and you want to change dir.

Should be 3. solutions

1. You need a drive parameter in order to change the drive (cd /D C:temp)

2. Run as administrator - running as administrator puts you in the C-drive (C:windowssystem32) iirc

3. Put your script in the C-drive.

Hope it helps. This is all "should work" in my windows-head.

Edited by Joeit

Share this post


Link to post
Share on other sites

This question may seem lame and unrelated, but why in the world you all add backslash to the folder path? Maybe that's the reason you get strange results.

But surely it isn't, right?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

This question may seem lame and unrelated, but why in the world you all add backslash to the folder path? Maybe that's the reason you get strange results.

But surely it isn't, right?

Makes no difference. You can use as many backslashes you want after the driveletter only. It's just aesthetics in a commandprompt.

C:temp

C:temp

C:temp

all the same, the backslash is used to separate path/folder-names, not drives. Makes sense?

As for strange results using the backslash.. It should not make a difference, as you're using the cmdprompt from windows itself.

Edited by Joeit

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

^^ I didn't say that. I asked "why in the world you all add backslash to the folder path"?

Do you see the difference now?

Lose the backslash and try then. It may not make the difference but still, do try.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Okay this is weird. I've tried Brewman's script on an installed version of AutoIt and it worked fine. Then I tried it on a portable version of AutoIt and it exhibited the weird 'remember last directory' behavior.  I looked to see what the current directory was in the executable, and sure enough it was the directory that FileOpenDialog() had used on previous runs.

But then!  I went and ate, showered, shaved, got a bowl of cereal, read 20 newspapers, made 20 bowel movements (maybe at the same time ;) ), and came back and tried the code again.  But now everything was working perfectly fine!  So that's a head-scratcher.. I'm wondering if some sort of Windows caching thing was going on or whatnot..  I dunno.  I'll have to try it again after hitting the bathroom a few more times.

Share this post


Link to post
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
Sign in to follow this  
Followers 0