aggg63 Posted June 16, 2006 Posted June 16, 2006 (edited) Hello. Doesn't work this simple script $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 June 16, 2006 by aggg63
Xenobiologist Posted June 16, 2006 Posted June 16, 2006 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
jvanegmond Posted June 16, 2006 Posted June 16, 2006 $File=@HomeDrive & '\INFO.TXT' msgbox(0,'File',@homedrive & $File) $File = c:\INFO.TXT MsgBox(0,'File', c:c:\INFO.txt) Doesn't look right to me. You're calling homedrive twice. github.com/jvanegmond
jvanegmond Posted June 16, 2006 Posted June 16, 2006 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? github.com/jvanegmond
aggg63 Posted June 16, 2006 Author Posted June 16, 2006 th.megerThis is the problem: @homedrive returns normally only c:In my script return nothing ManadarI'm sorry for the mistake. I corrected the script.I want to use @HomeDrive, no always home drive is C:
aggg63 Posted June 16, 2006 Author Posted June 16, 2006 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.
PsaltyDS Posted June 16, 2006 Posted June 16, 2006 th.megerThis is the problem: In my script return nothing ManadarI'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. 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
jvanegmond Posted June 16, 2006 Posted June 16, 2006 ManadarI'm sorry for the mistake. I corrected the script.You should only be sorry for a mistake, if you haven't learned anything from it. github.com/jvanegmond
PsaltyDS Posted June 16, 2006 Posted June 16, 2006 (edited) 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) Edited June 16, 2006 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
aggg63 Posted June 16, 2006 Author Posted June 16, 2006 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) 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 I have found a bug in latest beta? I'm using Windows 2000 SP4 (Spanish) with latest patches and Autoit 3 beta 126.
MHz Posted June 16, 2006 Posted June 16, 2006 Does this return a value? MsgBox(0, 'HomeDrive', EnvGet('HomeDrive'))
aggg63 Posted June 16, 2006 Author Posted June 16, 2006 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
PsaltyDS Posted June 16, 2006 Posted June 16, 2006 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\UserNameCould be different values on your machine, but the variables should be declared. 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
aggg63 Posted June 19, 2006 Author Posted June 19, 2006 Hello. After weekend I reboot the PC and all works fine . The variables HOMEDRIVE and HOMEPATH are back. Why they disappear? I don't know: a virus, a feature of Windows, Thanks a lot to all people help me
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now