corgano Posted November 13, 2013 Share Posted November 13, 2013 While working on a script I noticed that @scriptdir does not have a tailing when used normally, but does when placed in the root of a drive. A simple script to demonstrate this problem ConsoleWrite(@scriptdir&"\test.txt"&@CRLF) FileWrite(@ScriptDir&"\test.txt", "Hello world!") Exit When in a subfolder, the path is as expected (C:somefolder becoming C:somefoldertest.txt). There is no trailing . But when placed in the root of a drive, the path becomes C:, resulting in file path of C:test.txt. While some programs and functions will succeed with this, this path is invalid and causes issues with other programs. I have to do something like stringreplace( @scriptdir&"test.txt", "", "") to clean up an issue that shouldn't be happening Is this behavior intentional? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Developers Jos Posted November 13, 2013 Developers Share Posted November 13, 2013 Quote from the new Beta HelpFile: @ScriptDir Directory containing the running script. Only includes a trailing backslash when the script is located in the root of a drive. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
corgano Posted November 13, 2013 Author Share Posted November 13, 2013 Derp. Do you know why? I find it annoying more than anything 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Developers Jos Posted November 13, 2013 Developers Share Posted November 13, 2013 This is pretty standard behaviour. try running this VBScript and you see that does the exact same thing: Set oShell = CreateObject("WScript.Shell") Set ofso = CreateObject("Scripting.FileSystemObject") WScript.Echo " current dir:" & oShell.CurrentDirectory oShell.CurrentDirectory = ".." WScript.Echo " current dir:" & oShell.CurrentDirectory oShell.CurrentDirectory = "\" WScript.Echo " Root dir:" & oShell.CurrentDirectory The output I get: current dir:D:\Development\AutoIt3\programs\test\dir met spaces current dir:D:\Development\AutoIt3\programs\test Root dir:D:\ Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
BrewManNH Posted November 13, 2013 Share Posted November 13, 2013 The reason the root directory of a drive has the backslash is because in Windows if you use D: without a backslash it assumes you mean whatever the current working directory on D: is rather than the root directory. Also, there's no Windows command that won't work with a doubled backslash like that. I'm going to assume it's something you're scripting that's having the issue. 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 GudeHow 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 Link to comment Share on other sites More sharing options...
corgano Posted November 13, 2013 Author Share Posted November 13, 2013 Thanks for the info! Turns out it's an acrobat/JS thing. I was changing it to save to a temp file and move it using autoit and it works. At least I learned somthing 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e 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