Jump to content
Sign in to follow this  
theguy0000

user's autoit directory

Recommended Posts

theguy0000

i need to figure out the user's autoit directory, such as "program files\autoit3\"

thanks!


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
MHz

Just use the Applications path in the registry

$value = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3.exe', '')
$value = StringLeft($value, StringInStr($value, '\', 0, -1)-1)
MsgBox(0, '', $value)

This will work if AutoIt was installed and not from a zip file.

Share this post


Link to post
Share on other sites
theguy0000

i dont want the path to autoit3.exe, i want the path to the directory in program file that autoit is installed in, such as "program files\autoit3\"


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
MHz

Did you test that. AutoIt3.exe resides in the directory. That is why I used string*() functions to remove the '\AutoIt3.exe' from the full path returned with RegRead().

Share this post


Link to post
Share on other sites
theguy0000

oh heh srry ok thanks then


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
theguy0000

but i want the version removed...for example, it comes up with "\program files\autoit3\beta" but i want the "beta" removed


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
MHz

Oh, Ok. I do not use the beta installer. I use the beta zip. So was unaware of this scenerio.

Just adding StringReplace should cover for this difference of version.

$value = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3.exe', '')
$value = StringLeft($value, StringInStr($value, '\', 0, -1)-1)
$value = StringReplace($value, '\beta', '')
MsgBox(0, '', $value)

Share this post


Link to post
Share on other sites
theguy0000

but the user could be using some other version of autoit, so that would be specific to me and other beta users

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
MHz

The above gives you the directory to AutoIt3.exe. If you are enquiring about someone like me, who uses both release and beta? Then use If FileExists for the presence of the Beta directory within the AutoIt directory. For other concepts, then specify more.

Share this post


Link to post
Share on other sites
theguy0000

nvm i figured out a way...

$value = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3.exe', '')
$value = StringLeft($value, StringInStr($value, '\', 0, -1)-1)
$beta = StringInStr ( $value, "\beta" )
If $beta <> 0 Then
    $value = StringReplace($value, '\beta', '')
EndIf
MsgBox ( 0, "", $value )

thanks!


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
MHz

If you want to know if someone has the beta in a subdirectory of the AutoIt directory, then you could use this.

$value = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AutoIt3.exe', '')
$value = StringLeft($value, StringInStr($value, '\', 0, -1)-1)
$value = StringReplace($value, '\beta', '')
If Not @extended Then
    If FileExists($value & '\beta') Then $value = $value & '\beta'
EndIf
MsgBox(0, '', $value)

Share this post


Link to post
Share on other sites
Valik

Or you could (unimaginatively enough), read the values "InstallDir" and "BetaInstallDir" located at "HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt".

Share this post


Link to post
Share on other sites
MHz

I do not have "BetaInstallDir", as to usage of beta zip. Nice try.

Share this post


Link to post
Share on other sites
/dev/null

I do not have "BetaInstallDir", as to usage of beta zip. Nice try.

<{POST_SNAPBACK}>

Guys, never heard of @AutoItExe ??

@AutoItExe - The full path and filename of the AutoIt executable currently running. For compiled scripts it is the path of the compiled script.

Doesn't matter if beta version, installed or from ZIP file. Use String* functions to get the path only...

EDIT: Or even better. Use _PathSplit()

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
Valik

I do not have "BetaInstallDir", as to usage of beta zip. Nice try.

<{POST_SNAPBACK}>

Then there are no guarantees that even the presence of a "beta" directory will actually contain a valid beta version of AutoIt or that should a "valid" beta be found it may not be the newest (Meaning a newer version could be elsewhere). I also don't understand how you expect the AutoIt AppPath entry to be present unless the installer sets it, so we're back to being able to detect only valid (installer) installations, anyway, ergo, checking the two values I mention above is an easier solution than reading the AppPath key and doing splitting and all that stuff.

Share this post


Link to post
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
Sign in to follow this  

×