#NoEnv ; ; Definitions ; ProjFile = AutoHotkey.vcproj VCpp = Visual C++ 2005 Express Edition ScriptTitle = AutoHotkey Project Upgrade ; Prompts InitialPrompt = ( Join`s %ProjFile% will be modified to allow AutoHotkey to compile in %VCpp%. ) FolderPrompt = Select the folder containing %ProjFile%. RunConversionWizardPrompt = ( % Join`s %ProjFile% is a %pjt% %vcv% project file. It should be opened in %VCpp% to run the conversion wizard. To open %ProjFile% in %VCpp% manually, click No. Close VC++ after the wizard finishes to continue the upgrade process. `n`nLaunch %ProjFile%? ) BackupPrompt = Create a backup of %ProjFile%? ; Error Messages Error_Exit = The script will now exit. Error_NotFound = %ProjFile% not found. %Error_Exit% Error_Invalid = %ProjFile% appears to be invalid. %Error_Exit% MsgBox, 49, %ScriptTitle%, %InitialPrompt% ifMsgBox, Cancel ExitApp FileSelectFolder, SourcePath, *%A_ScriptDir%,, %FolderPrompt% if ErrorLevel ExitApp ProjPath = %SourcePath%\%ProjFile% ifNotExist, %ProjPath% { MsgBox, 16, Error, %Error_NotFound% ExitApp } xpath_load(xml, ProjPath) pjt := xpath(xml, "/VisualStudioProject/@ProjectType/text()") vcv := xpath(xml, "/VisualStudioProject/@Version/text()") if vcv is not number { MsgBox, 16, Error, %Error_Invalid% ExitApp } if vcv < 8.0 { Transform, RunConversionWizardPrompt, Deref, %RunConversionWizardPrompt% MsgBox, 35, AutoHotkey Project Upgrade, %RunConversionWizardPrompt% ifMsgBox, Cancel ExitApp ifMsgBox, Yes { Run, %ProjPath% WinWait, %VCpp% WinWaitClose } } SplitPath, ProjPath,, ProjDir, ProjExt, ProjName MsgBox, 35, AutoHotkey Project Upgrade, %BackupPrompt% ifMsgBox, Cancel ExitApp ifMsgBox, Yes FileCopy, %ProjPath%, %ProjDir%\%ProjName%.%A_Now%.%ProjExt% xpath_load(xml, ProjPath) Loop % xpath(xml, "/VisualStudioProject/Configurations/Configuration/count()") { config := "/VisualStudioProject/Configurations/Configuration[" A_Index "]" config_name := xpath(xml, config "/@Name/text()") ; Optional customization: put upx up one directory so I don't need a copy ; for each project (version of AutoHotkey, Ahk2Exe, etc.) if (config_name = "Release|Win32") && FileExist(ProjDir "\..\upx.exe") xpath(xml, config "/Tool[@Name=VCPostBuildEventTool]/@CommandLine/text()" , "..\upx --best --no-lzma --filter=73 --compress-icons=0 release\AutoHotkey.exe") tool := config "/Tool[@Name=VCCLCompilerTool]" if (config_name != "SC (minimum size)|Win32") { xpath(xml, tool "/@OmitDefaultLibName/text()", "true") xpath(xml, tool "/@UsePrecompiledHeader/text()", "1") } xpath(xml, tool "/@Detect64BitPortabilityProblems/text()", "false") xpath(xml, tool "/@CallingConvention/text()", "0") tool := config "/Tool[@Name=VCLinkerTool]" xpath(xml, tool "/@GenerateManifest/text()", "false") temp := xpath(xml, tool "/@IgnoreDefaultLibraryNames/text()") StringReplace, temp, temp, LibCMT;,, All xpath(xml, tool "/@IgnoreDefaultLibraryNames/text()", temp) } xpath_save(xml, ProjPath) MsgBox, 4, Complete, Launch AutoHotkey.vcproj? ifMsgBox, Yes Run, %ProjPath%