TJ123 Posted July 19, 2012 Share Posted July 19, 2012 I want to create a script that will create a file on the users desktop, regardless of the username/path to the desktop, so that it will work on any windows machine. I found @DesktopDir in the documentation and it does return the path to the desktop. However I am having some problems with figuring out how to use @DesktopDir to write a file to the desktop. I tried a few things, such as: FileOpen (@DesktopDir"NEW_FILE.txt", 2) or $desktop = @DesktopDir FileOpen(""$desktop"/NEW_FILE.txt", 2) These did not work for me. Any advice as to how I can have my script create a file on the desktop of any windows machine would be greatly appreciated! Thanks for any advice or suggestions. TJ. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 19, 2012 Moderators Share Posted July 19, 2012 (edited) It should be @DesktopDir & "filename.txt" Edit: And doing it this way, you don't need the $desktop variable. Edited July 19, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted July 19, 2012 Share Posted July 19, 2012 Get used to using consolewrite or msgbox for troubleshooting your scripts. And read the help files such as: contents > language reference > operators. Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
Attckdog Posted July 20, 2012 Share Posted July 20, 2012 (edited) Get used to using consolewrite or msgbox for troubleshooting your scripts. And read the help files such as: contents > language reference > operators. This, I use it often when dealing with weird returns or returns I'm new to. in this instance a good way to find out the actual problem test the return value of @desktopdir so something like Consolewrite(@desktopDir &@crlf) also make sure you run it from inside SciTe Edited July 20, 2012 by Attckdog A true renaissance man 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