?
Solved

GetTempPath API in Javascript

Posted on 2004-11-05
7
Medium Priority
?
1,055 Views
Last Modified: 2012-08-14
How can find a temp folder where the current user has the access right?
My application will generate template html files in a temp folder under the application path (usually, administrator user installed it in "C:\Program Files\BillcchApp"), but some of users don't have the access right on the application folder. How can I find the path that current user has the access right....

Thanks
0
Comment
Question by:billcch
  • 4
  • 2
7 Comments
 
LVL 25

Accepted Solution

by:
devic earned 800 total points
ID: 12509228
>>>My application will generate template html files...
did your write this app?
If yes, why not GetTempPath from this app?
0
 
LVL 63

Assisted Solution

by:Zvonko
Zvonko earned 1200 total points
ID: 12510343
Here an example:

<script>
function getTempDir(){
  var wShell = new ActiveXObject("WScript.Shell")
  var wEnv = wShell.Environment("Process");
  var tPath = wEnv("TEMP")
  if(tPath==""){
    tPath = wEnv("TMP")
  }
  return tPath;
}

alert(getTempDir());
</script>

0
 
LVL 25

Expert Comment

by:devic
ID: 12510475
"Automation server can't create object"

for this reason I didn't write example, but the same thing easy to do in app.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 63

Expert Comment

by:Zvonko
ID: 12510485
Where do you read it is a web page? It only creates web pages.
0
 
LVL 25

Expert Comment

by:devic
ID: 12510567
I didn't read it, but I did understand it so :)
and your example for some reason has <script> ;)
0
 
LVL 25

Expert Comment

by:devic
ID: 12510834
ok, If some hta is billcch's application, then Zvonko's example is ok.
but if we speak about scripts that are not on the webpage, then I prefer .vbs

----------------test.vbs-------------------------------

Set WSHShell = CreateObject("WScript.Shell")  
Set Environ = WSHShell.Environment  

For Each i In Environ
      Environs = Environs & i & vbCrlf
Next

MsgBox "HERE ALL ENVIRONS" & vbCrlf & Environs

-----------------------------------------------------------
0
 

Author Comment

by:billcch
ID: 12669841
Thanks guy,
sorry I went to business trip, and did not have chance back to ee to thanks you guys.
Thanks again!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question