armoros Posted June 13, 2012 Share Posted June 13, 2012 (edited) Hello community. I am on winxp and my drive letter is C:\ so i call something like this ie. Global $Init_Dir = "C:\" OR If WinActive("C:\WINDOWS\system32\regedit.exe") Then But if a user has some other drive letter ie. (E:\) how to make the script run correctly if i make it on my pc that has (C:\). stupid or not quest. i appreciate your advice. Thank you Edited June 14, 2012 by armoros [font="verdana, geneva, sans-serif"] [/font] Link to comment Share on other sites More sharing options...
Mechaflash Posted June 13, 2012 Share Posted June 13, 2012 (edited) Change WinTitleMatchMode() to accept a StringInStr type searching, and just omit the drive letter?Scratch that... stupid hackaround.@SystemDir returns "C:\Windows\System32\"@WindowsDir returns "C:WINDOWS"It should report the drive correctly if windows is installed on another drive letter.If WinActive(@SystemDir & "regedit.exe") Then [...] Edited June 13, 2012 by mechaflash213 Spoiler “Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.” Link to comment Share on other sites More sharing options...
BlueLED Posted June 13, 2012 Share Posted June 13, 2012 (edited) I'm only new to AutoIt, but I do know that running %systemroot% in windows opens the Windows folder regardless of drive letter... Perhaps there's an equivalent, then you'd just need to do & "system32" Edit: Ah, sorry, didn't see the edit. Edited June 13, 2012 by BlueLED Link to comment Share on other sites More sharing options...
armoros Posted June 13, 2012 Author Share Posted June 13, 2012 Thank you Mechanflash123 i appreciate your help. That makes sense. you too BlueLED. [font="verdana, geneva, sans-serif"] [/font] Link to comment Share on other sites More sharing options...
Tripredacus Posted June 13, 2012 Share Posted June 13, 2012 This will only work if you are running from the host OS. If you are trying to look at another drive, from say WinPE or another OS, you'll end up getting that host OS environment variables instead. Twitter | MSFN | VGCollect Link to comment Share on other sites More sharing options...
armoros Posted June 13, 2012 Author Share Posted June 13, 2012 Thank you Tripredacus.. I appreciate your advices [font="verdana, geneva, sans-serif"] [/font] Link to comment Share on other sites More sharing options...
stormbreaker Posted June 14, 2012 Share Posted June 14, 2012 I thought we had something like @SystemDrive in AutoIt? ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
armoros Posted June 14, 2012 Author Share Posted June 14, 2012 @MKISH Thank you my friend. or something like this $drive = EnvGet("systemdrive") [font="verdana, geneva, sans-serif"] [/font] Link to comment Share on other sites More sharing options...
Robjong Posted June 14, 2012 Share Posted June 14, 2012 (edited) It's all been said already, but for completeness sake. ; Changes how literal strings and % symbols are interpreted. By default strings are treated literally, ; this option allows you to use %environment% variables inside strings, e.g., "The temp directory is: %temp%". Opt("ExpandEnvStrings", 1) ; 1 = expand environment variables ; If the system is located on drive D: the results are as stated in the comment. ConsoleWrite(@SystemDir & @LF) ; D:WINDOWSsystem32 ConsoleWrite(@HomeDrive & @LF) ; D: ConsoleWrite(EnvGet("systemdrive") & @LF) ; D: ConsoleWrite("%systemdrive%" & @LF) ; D: ConsoleWrite("%homedrive%" & @LF) ; D: Edit: added use of ExpandEnvStrings. Edited June 14, 2012 by Robjong Link to comment Share on other sites More sharing options...
armoros Posted June 14, 2012 Author Share Posted June 14, 2012 @ Robjong Yes you are correct so time to put a Solved in the title. Thank you all. [font="verdana, geneva, sans-serif"] [/font] Link to comment Share on other sites More sharing options...
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