Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default to desktop 1

Status
Not open for further replies.

finitesimian

Programmer
Feb 11, 2006
29
0
0
US
This should be easy. I just couldn't find a reference for the syntax anywhere...


How do you "default" something to the user's desktop in Attachmate?
I've created a script that scrapes several screens, then pastes the data to a .txt file on the desktop........but I can't share my script with anybody because the path is listed as MY desktop (I'd have to custom tailor the script for everyone I gave it to).

Heres an example
Code:
rc% = Shell("Notepad.exe C:\Documents and Settings\FINITE_SIMIAN\Desktop\scrape.txt",1)

I need it to say this:
Code:
rc% = Shell("Notepad.exe C:\Documents and Settings\CURRENT_USER_WHOEVER_THEY_ARE\Desktop\scrape.txt",1)
 
While it certainly may not be the best method, this is one technique that will work:

Code:
rc% = Shell("cmd.exe /c Notepad.exe C:\Documents and Settings\%username%\Desktop\scrape.txt",1)
 
Code:
Function Get_Desktop_Path() As String
   Dim obj_ws_shell As Object

   Set obj_ws_shell = CreateObject("WScript.Shell")
   Get_Desktop_Path = obj_ws_shell.SpecialFolders("Desktop")
End Function

Sub Main()
   MsgBox Get_Desktop_Path
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top