Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


[SOLVED] current folder & HTA files

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,33011
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> [SOLVED] current folder & HTA files
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 [SOLVED] current folder & HTA files - 4/4/2006 1:58:08 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
Hello,

I'm not sure if I can ask a question inhere about HTA files but I'm taking my chance anyway... 

Is there a way to retrieve the location from HTA file?

All my attempts returned c:\windows\system32 which is were mshta is run from I guess instead of the location of the hta file,
any way to  retrieve that with code instead of

1. calling the script with a parameter
2. put the hta path in an .ini file
3. use a fileselectbox and write the location in an ini to skip the pass at next run

< Message edited by sorex -- 4/9/2006 4:04:42 AM >
 
 
Post #: 1
 
 RE: current folder & HTA files - 4/4/2006 2:02:43 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
I'm not sure, but give WScript.ScriptFullName

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to sorex)
 
 
Post #: 2
 
 RE: current folder & HTA files - 4/4/2006 2:03:43 AM   
  ginolard


Posts: 1068
Score: 21
Joined: 8/10/2005
Status: offline
    Set objShell = CreateObject("WScript.Shell")
   myCur = objShell.CurrentDirectory

Also, that should give you the current directory

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to sorex)
 
 
Post #: 3
 
 RE: current folder & HTA files - 4/4/2006 2:10:21 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
There you go. Ginolard's will work. Mine won't. I always forget and try to use WScript directly in HTAs.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to ginolard)
 
 
Post #: 4
 
 RE: current folder & HTA files - 4/4/2006 2:13:41 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
damn you guys are fast!


"I'm not sure, but give WScript.ScriptFullName"

nope, no wscript. stuff support in HTA files

"Set objShell = CreateObject("WScript.Shell")
myCur = objShell.CurrentDirectory "

returns \windows\system32

aswell

(in reply to ginolard)
 
 
Post #: 5
 
 RE: current folder & HTA files - 4/4/2006 2:14:58 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
That is wierd...just tested Ginolad's and it worked fine for me.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to sorex)
 
 
Post #: 6
 
 RE: current folder & HTA files - 4/4/2006 2:17:57 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
maybe it's that irritating

"Do you want to run or save this file?       open save cancel"

pop-up that's messing up things?

it also says "file download" in it's title bar while the script is on my c: drive

(in reply to ebgreen)
 
 
Post #: 7
 
 RE: current folder & HTA files - 4/4/2006 2:22:46 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
Ebgreen: did you try that out as a vbs or hta file? it works as vbs but not as hta

(in reply to sorex)
 
 
Post #: 8
 
 RE: current folder & HTA files - 4/4/2006 2:28:35 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
 
this is what I used... copy/paste & save as test.hta or something and give it another try and lemme know if it still works on your side or not



      

(in reply to sorex)
 
 
Post #: 9
 
 RE: current folder & HTA files - 4/4/2006 2:36:51 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Copy and pasted it...worked fine for me. Must be a security/permissions issue.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to sorex)
 
 
Post #: 10
 
 RE: current folder & HTA files - 4/4/2006 2:44:55 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
Hmm, that's odd, because the script is loading/saving data without any problem, I just need to use the full path to the scriptfolder since it always jumps to system32 instead of the path the script is in.

(in reply to ebgreen)
 
 
Post #: 11
 
 RE: current folder & HTA files - 4/4/2006 4:32:02 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Whereever I place the .hta, it gives me a msgbox with it's current location.

_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to sorex)
 
 
Post #: 12
 
 RE: current folder & HTA files - 4/4/2006 4:42:28 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
quote:

ORIGINAL: sorex

maybe it's that irritating

"Do you want to run or save this file?       open save cancel"

pop-up that's messing up things?

it also says "file download" in it's title bar while the script is on my c: drive


Sorex,

This happens when you click a link to request the HTA file, then Windows tries to open it from IExplore and want's it to be downloaded. You must run the HTA manually in order for it to bypass the security (like EBGreen says)

Snipah

PS. your script Xample worked fine for me...(Windows XP SP2)

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to sorex)
 
 
Post #: 13
 
 RE: current folder & HTA files - 4/4/2006 6:18:01 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
well, I either press enter on the file in Total Commander or type filename.hta in a dosbox, the result is the same here.

any other ideas?

(in reply to Snipah)
 
 
Post #: 14
 
 RE: current folder & HTA files - 4/4/2006 6:26:03 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Assuming you are using the latest WMI version....there is nothing left to do but checking your File Types in Tools -> Folder Options -> Filetypes and see what is running when firing an HTA file....

Let us know..

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to sorex)
 
 
Post #: 15
 
 RE: current folder & HTA files - 4/4/2006 10:45:53 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
Internet Explorer

under advanced the "[x] Confirm open after download" was on but dissabling that doesn't solve the problem.

it seems that's I'm not the only one who has/had that problem


http://www.annoyances.org/exec/forum/winxp/t1106616376
http://www.codecomments.com/archive299-2005-2-386657.html
http://www.derkeiler.com/Newsgroups/microsoft.public.security/2004-09/1432.html

unfortuanatly most requests stay unanswered

(in reply to Snipah)
 
 
Post #: 16
 
 RE: current folder & HTA files - 4/4/2006 11:37:09 AM   
  Cybex


Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
When both are run from "C:\Documents and Settings\Cybex\My Documents\AdminScriptEditor"...

When I run it as HTA I get "C:\Documents and Settings\Cybex"
When I run it as VBS I get "C:\Documents and Settings\Cybex\My Documents\AdminScriptEditor"


Cybex

Are you running these from inside an editor?  I noticed that the HTA works fine when I close ASE and run it by double clicking the HTA file.  But from within ASE I get the shortened return.  Try closing any editor and just run it normally.

< Message edited by Cybex -- 4/4/2006 11:42:28 AM >


_____________________________

Common sense is not so common.

(in reply to sorex)
 
 
Post #: 17
 
 RE: current folder & HTA files - 4/5/2006 6:52:10 AM   
  sorex

 

Posts: 77
Score: 0
Joined: 3/9/2006
Status: offline
 
nope, I just run it from a dosbox or from Total Commander, not straight from an editor.

(in reply to Cybex)
 
 
Post #: 18
 
 RE: current folder & HTA files - 4/5/2006 6:56:47 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
What is Total Commander?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to sorex)
 
 
Post #: 19
 
 RE: current folder & HTA files - 4/6/2006 2:02:24 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Is this HTA located on your machine, or are you running this from a server or remote machine?
HTA's are designed to run locally and I only receive that message, you are describing, if I do not run it locally.

(in reply to sorex)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> [SOLVED] current folder & HTA files Page: [1] 2   next >   >>
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts