Sign in to follow this  
Followers 0
TJ123

Using @DesktopDir to create file on desktop...

4 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It should be @DesktopDir & "filename.txt"

Edit: And doing it this way, you don't need the $desktop variable.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Attckdog

A true renaissance man

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