Jump to content

Macro @HomeDrive return null from network drive


Recommended Posts

Hello.

Doesn't work this simple script :D

$File=@HomeDrive & '\INFO.TXT'
msgbox(0,'File',$File)

I run this script from a network drive. The file INFO.TXT is created in the directory in network drive. The macro @HomeDrive return nothing. I tried FileChangeDir(@HomeDrive) with the same result. I think the macro should return the correct path to home drive whatever the script is running.

Thanks for the help.

Edited by aggg63
Link to comment
Share on other sites

Hi,

i don't get it. But you know the difference between msgbox(0,@HomePath,@homedrive ) ???

@homedrive returns normally only c:

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I run this script from a network drive. The file INFO.TXT is created in the directory in network drive. The macro @HomeDrive return nothing. I tried FileChangeDir(@HomeDrive) with the same result. I think the macro should return the correct path to home drive whatever the script is running.

Try this:

MsgBox(0, "", @HomeDrive)

What does it say where the text usually is?

Link to comment
Share on other sites

th.meger

This is the problem:

@homedrive returns normally only c:

In my script return nothing :D

Manadar

I'm sorry for the mistake. I corrected the script.

I want to use @HomeDrive, no always home drive is C:

Link to comment
Share on other sites

Try this:

MsgBox(0, "", @HomeDrive)

What does it say where the text usually is?

I get nothing, the answer is a text blank. Normally it shoul be "C:", this is my home drive.

Remenber, I run the script from a network drive.

Last new, I run the script form c:\ and get the same answer, nothing. I haven't a home drive. :D

Link to comment
Share on other sites

th.meger

This is the problem:

In my script return nothing :D

Manadar

I'm sorry for the mistake. I corrected the script.

I want to use @HomeDrive, no always home drive is C:

I ran into something like that myself. I have a function in my install scripts, which run from a network share, that sets a variable $ScriptRoot to either the drive (i.e. C:) or the UNC root (i.e. \\MyServer\MyShare). I went to the trouble because @HomeDrive doesn't give you that, and I wanted the scripts to look for certain things starting at $ScriptRoot by default. When I get to a windows box I'll post it.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

When I get to a windows box I'll post it.

Slummin' in Windows now, here's my snippet for setting $ScriptRoot at the beginning of all my install scripts:

; Identify script directory root (i.e. F: or \\Server\Share) without trailing backslash
Select
    Case StringMid(@ScriptDir, 2, 1) = ':'
        $ScriptRoot = StringLeft(@ScriptDir, 2)
    Case StringLeft(@ScriptDir, 2) = '\\'
        $ScriptRoot = StringReplace(@ScriptDir, '\\', '')
        $avScriptRoot = StringSplit($ScriptRoot, '\')
        $ScriptRoot = '\\' & $avScriptRoot[1] & '\' & $avScriptRoot[2]
    Case Else
        MsgBox(16, "Error", 'Case not handled: @ScriptDir does not start with "\\" or a drive letter.')
        Exit
EndSelect

MsgBox(64, "Result", "$ScriptRoot = " & $ScriptRoot)

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Slummin' in Windows now, here's my snippet for setting $ScriptRoot at the beginning of all my install scripts:

; Identify script directory root (i.e. F: or \\Server\Share) without trailing backslash
Select
    Case StringMid(@ScriptDir, 2, 1) = ':'
        $ScriptRoot = StringLeft(@ScriptDir, 2)
    Case StringLeft(@ScriptDir, 2) = '\\'
        $ScriptRoot = StringReplace(@ScriptDir, '\\', '')
        $avScriptRoot = StringSplit($ScriptRoot, '\')
        $ScriptRoot = '\\' & $avScriptRoot[1] & '\' & $avScriptRoot[2]
    Case Else
        MsgBox(16, "Error", 'Case not handled: @ScriptDir does not start with "\\" or a drive letter.')
        Exit
EndSelect

MsgBox(64, "Result", "$ScriptRoot = " & $ScriptRoot)

:D

Ok. It works fine. The script shows unit D:, the unit where is the script.

But if I change @ScriptDir by @Homedrive in the first case sentence, the script fails and return the error in else sentence :P

I have found a bug in latest beta? :D

I'm using Windows 2000 SP4 (Spanish) with latest patches and Autoit 3 beta 126.

Link to comment
Share on other sites

Does this return a value?

MsgBox(0, 'HomeDrive', EnvGet('HomeDrive'))
SystemDrive return C: but HomeDrive return nothing, I haven't an environment variable with this name.

SystemDrive=C:

SystemRoot=C:\WINNT

FILE_SERVER=CISG

ISCPATH=C:\Archivos de programa\Intel\ServerManagement

Link to comment
Share on other sites

SystemDrive return C: but HomeDrive return nothing, I haven't an environment variable with this name.

What version of Windows are you running? There should be a HomeDrive and a HomePath environment variable. For XP, the defaults are:

HOMEDRIVE = C:

HOMEPATH = \Documents and Settings\UserName

Could be different values on your machine, but the variables should be declared.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hello.

After weekend I reboot the PC and all works fine :P . The variables HOMEDRIVE and HOMEPATH are back. Why they disappear? I don't know: a virus, a feature of Windows, :D

Thanks a lot to all people help me :D

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...