[Help] Full paths / short paths |
Author: |
Message: |
alexp2_ad
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://img.photobucket.com/albums/v219/alexp2_ad/cremeegg.gif)
Who love the chocolate?
Posts: 691 Reputation: 26
36 / / –
Joined: May 2004
Status: Away
|
O.P. [Help] Full paths / short paths
Is there any way I can convert a short path into a long one in JScript? I have a function that returns:
C:\PROGRA~1\MOZILL~1\FIREFOX.EXE
But I need the full proper path, I've search and searched, but I'm outta ideas.
Anybody?
|
|
07-05-2006 04:55 PM |
|
![](images/pixel.gif) |
matty
Scripting Guru
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
Posts: 8336 Reputation: 109
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Dec 2002
Status: Away
|
RE: [Help] Full paths / short paths
you will want to use GetFullPathNameW api if i remember correctly
This post was edited on 07-05-2006 at 05:11 PM by matty.
|
|
07-05-2006 05:10 PM |
|
![](images/pixel.gif) |
alexp2_ad
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://img.photobucket.com/albums/v219/alexp2_ad/cremeegg.gif)
Who love the chocolate?
Posts: 691 Reputation: 26
36 / / –
Joined: May 2004
Status: Away
|
O.P. RE: RE: [Help] Full paths / short paths
quote: Originally posted by Matty
you will want to use GetFullPathNameW api if i remember correctly
I was trying that, but it seems to require I pass it some StringBuilder type which doesn't seem to exist in JScript or something. If you could show me an example, that'd be very useful. ![:)](images/smilies/msn_happy.gif)
|
|
07-05-2006 05:13 PM |
|
![](images/pixel.gif) |
matty
Scripting Guru
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
Posts: 8336 Reputation: 109
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Dec 2002
Status: Away
|
RE: [Help] Full paths / short paths
Again I am at work can't test it
code: function ConvertPath(sString){
var MAX_PATH = 260;
var sBuffer = Interop.Allocate(2*(MAX_PATH)+2);
Interop.Call('kernel32', 'GetFullPathNameW', sString, MAX_PATH, sBuffer, '');
return sBuffer.ReadString(0);
}
|
|
07-05-2006 05:22 PM |
|
![](images/pixel.gif) |
alexp2_ad
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://img.photobucket.com/albums/v219/alexp2_ad/cremeegg.gif)
Who love the chocolate?
Posts: 691 Reputation: 26
36 / / –
Joined: May 2004
Status: Away
|
O.P. RE: [Help] Full paths / short paths
Weird, that actually returned a string, unlike all my efforts, but it was the same string I put in.
|
|
07-05-2006 05:28 PM |
|
![](images/pixel.gif) |
matty
Scripting Guru
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
Posts: 8336 Reputation: 109
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Dec 2002
Status: Away
|
RE: [Help] Full paths / short paths
quote: Originally posted by alexp2_ad
Weird, that actually returned a string, unlike all my efforts, but it was the same string I put in.
Did you use GetFullPathNameW or GetFullPathNameA?
|
|
07-05-2006 05:31 PM |
|
![](images/pixel.gif) |
alexp2_ad
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://img.photobucket.com/albums/v219/alexp2_ad/cremeegg.gif)
Who love the chocolate?
Posts: 691 Reputation: 26
36 / / –
Joined: May 2004
Status: Away
|
O.P. RE: [Help] Full paths / short paths
Used GetFullPathNameW as you said. Just tried GetFullPathNameA and it returned a bunch of chinese characters. ![:S](images/smilies/msn_confused.gif)
|
|
07-05-2006 05:34 PM |
|
![](images/pixel.gif) |
matty
Scripting Guru
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
Posts: 8336 Reputation: 109
39 / / ![Canada Flag](images/flags/ca.png)
Joined: Dec 2002
Status: Away
|
RE: [Help] Full paths / short paths
quote: Originally posted by alexp2_ad
Used GetFullPathNameW as you said. Just tried GetFullPathNameA and it returned a bunch of chinese characters. ![:S](images/smilies/msn_confused.gif)
Ya because Javascript uses WChars so any API that has the ability of using Ascii or WChars you need to use the WChar so it is processed properly.
quote: Originally posted by Matty
quote: Originally posted by alexp2_ad
Weird, that actually returned a string, unlike all my efforts, but it was the same string I put in.
You might now have created your databloc properly to hold the amount of data.
This post was edited on 07-05-2006 at 05:40 PM by matty.
|
|
07-05-2006 05:39 PM |
|
![](images/pixel.gif) |
Eljay
Elite Member
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](avatar.php?uid=32264-5599)
:O
Posts: 2949 Reputation: 77
– / / –
Joined: May 2004
|
RE: [Help] Full paths / short paths
wrong function matty
code: function ConvertPath(sString){
var MAX_PATH = 260;
var sBuffer = Interop.Allocate(2*(MAX_PATH)+2);
Interop.Call('kernel32', 'GetLongPathNameW', sString, sBuffer, MAX_PATH);
return sBuffer.ReadString(0);
}
|
|
07-05-2006 05:42 PM |
|
![](images/pixel.gif) |
alexp2_ad
Scripting Contest Winner
![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif) ![*](images/star.gif)
![Avatar](http://img.photobucket.com/albums/v219/alexp2_ad/cremeegg.gif)
Who love the chocolate?
Posts: 691 Reputation: 26
36 / / –
Joined: May 2004
Status: Away
|
O.P. RE: [Help] Full paths / short paths
Yay, working!
Thanks both of you. ![(y)](images/smilies/msn_up.gif)
|
|
07-05-2006 05:45 PM |
|
![](images/pixel.gif) |
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|