AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using ProgramFiles variable in Windows XP 64

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
JamesVan



Joined: 01 Oct 2007
Posts: 17

PostPosted: Thu Dec 20, 2007 4:14 pm    Post subject: Using ProgramFiles variable in Windows XP 64 Reply with quote

Has anyone tried to find and/or launch applications with AHK scripts running on Windows XP 64? For some reason, code I've written (example below) doesn't seem to find anything...

Code:
AppPath64 = %A_ProgramFiles%\Revit Architecture 2008 - x64 Beta\Program
FLAG64 = 0
IfExist, %AppPath64%\Revit.exe
{
    MsgBox, 4, Revit Architecture 64-Bit Beta found. Would you like to configure its settings also?
    IfMsgBox, No
    {
       FLAG64 = 0
    }
    IfMsgBox, Yes
    {
       FLAG64 = 1
    }
}


The code above is looking for a 64-bit program installed in C:\Program Files and never gets to display the message box.
Back to top
View user's profile Send private message
Erittaf



Joined: 03 Nov 2007
Posts: 182

PostPosted: Thu Dec 20, 2007 10:38 pm    Post subject: Reply with quote

in that version of windows there are 2 program files directories. (I think one of them has an (x86) or something behind it) It is likely AHK is pointing to the wrong one... I would suggest hardcoding it for the time being
Back to top
View user's profile Send private message Send e-mail
JamesVan



Joined: 01 Oct 2007
Posts: 17

PostPosted: Fri Dec 21, 2007 3:58 pm    Post subject: Reply with quote

Yes, I've tried a hard-coded search as in the example below, but it still can't find the files under "C:\Program Files (x86)". Could it be that the parentheses are confusing AutoHotKey?

Code:
IfExist, "%ProgramFiles%\Autodesk\Worksharing Monitor for Revit 2008\WorksharingMonitor.exe"
{
msgbox,Found regular version.
Run "%ProgramFiles%\Autodesk\Worksharing Monitor for Revit 2008\WorksharingMonitor.exe"
}
else
{
msgbox,Can't find regular version.
}
IfExist, "C:\Program Files (x86)\Autodesk\Worksharing Monitor for Revit 2008\WorksharingMonitor.exe"
{
msgbox,Found x86 version.
Run "C:\Program Files (x86)\Autodesk\Worksharing Monitor for Revit 2008\WorksharingMonitor.exe"
}
else
{
msgbox,Can't find x86 version.
}
exitapp
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1159
Location: Denmark

PostPosted: Fri Dec 21, 2007 4:39 pm    Post subject: Reply with quote

This works perfectly on a vista 64 bit - no "'s.
Code:
Run, C:\Program Files (x86)\Windows Mail\WinMail.exe

_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
JamesVan



Joined: 01 Oct 2007
Posts: 17

PostPosted: Fri Dec 21, 2007 10:32 pm    Post subject: Reply with quote

Figured it out. In Windows XP64, if you run SET in a DOS prompt you will see the variable "ProgramFiles" as well as a new one - "ProgramFiles(x86)". This led me to believe that the original "ProgramFiles" now refers to the 64-bit program installation path which is still C:\Program Files\. 32-bit programs installed on XP64 get installed in C:\Program Files (x86)\; however, when AHK calls %A_ProgramFiles% in XP64, you get C:\Program Files (x86)\.

I had my search options backwards.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group