gripper Posted August 22, 2013 Share Posted August 22, 2013 Hi Forum Members, I am having issues with @ScriptDir when it comes to saving a file on my PC. What is going on is I have a script that was in a file folder on my desktop "Autoit TestTest Space". After the script completes it is supposed to save the results in a .txt file within the script folder. It worked fine. Now I moved that AutoIt script to a new folder for production purposes and that directory is "c:ProductionScriptsAutoitNetworkEval1" The file that is supposed to be saved is Network_health.txt When I move that script to this new location it runs fine until it needs to save the file but, it wants to save to the old location which then errors because that file is already present in the old directory.. I am using @ScriptDir in order to have it save the file within the scripts working directory but it violates this and keeps trying to save to the old test directory. Here is the block of script that is causing the issue with the windows SaveAs dialog box. I tried two diffent approaches to force this but each has the same end result. I am hoping you guys could provide me some ideals to force the location to be correct. This script is running on a Windows 7 PC. .This script will run in different directories so it is important that the output file goes to the correct location which will always be in the same folder as the script. Thanks ControlSetText($SaveAs, "", "[CLASS:Edit; INSTANCE:1]", $Filename) ControlClick($SaveAs, "", "[CLASS:Button; INSTANCE:1]") _WaitUntilFileExist($Filename) #cs ;***Not working properly*** ControlClick($SaveAs, "", "[CLASS:Button; INSTANCE:1]") _WaitUntilFileExist(@ScriptDir & "\network_health.txt") FileMove(@ScriptDir & "\network_health.txt", $Filename, 1) #ce Link to comment Share on other sites More sharing options...
BrewManNH Posted August 22, 2013 Share Posted August 22, 2013 That's not enough code to figure out what's going wrong. Also, when using ControlSetText, what is this text being sent to? 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...
abberration Posted August 22, 2013 Share Posted August 22, 2013 Perhaps FileChangeDir may help you. Easy MP3 | Software Installer | Password Manager 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