Jump to content

Using @DesktopDir to create file on desktop...


Recommended Posts

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

  • Moderators

It should be @DesktopDir & "filename.txt"

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

Edited 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

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...