Skip to content

Instantly share code, notes, and snippets.

@kastnerp
Created August 6, 2024 18:59
Show Gist options
  • Save kastnerp/681ad6662d14a493cc926921bfb0ce8a to your computer and use it in GitHub Desktop.
Save kastnerp/681ad6662d14a493cc926921bfb0ce8a to your computer and use it in GitHub Desktop.
Compile UMCF-8.0 with BlueCFD 2020-1
@echo off
setlocal enabledelayedexpansion
:: Set the path to blueCFD-Core batch file (adjust this path if needed)
set "BLUECFD_PATH=C:\Program Files\blueCFD-Core-2020\blueCFD-Core_MSys2_mingw64.bat"
:: Set the commands you want to execute
set "COMMANDS=mkdir -p /c/Eddy3D;cd /c/Eddy3D;git clone https://github.com/Eddy3D-Dev/urbanMicroClimateFoam-BlueCFD;cd urbanMicroClimateFoam-BlueCFD;git checkout of-org_v8.0-bluecfd;./Allwclean && ./Allwmake"
:: Start blueCFD-Core bash
start "" "%BLUECFD_PATH%"
:: Wait for the window to appear and get focus
powershell -command "Start-Sleep -Seconds 2"
:: Find the MinGW window and bring it to foreground
powershell -command "Add-Type -AssemblyName System.Windows.Forms; $mingwWindow = [System.Windows.Forms.Application]::OpenForms | Where-Object { $_.Text -like '*MINGW64:/mingw64*' }; if ($mingwWindow) { $mingwWindow.Activate() }"
:: Set clipboard content
powershell -command "Set-Clipboard -Value '%COMMANDS%'"
:: Simulate Ctrl+V to paste
powershell -command "$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^v')"
:: Simulate pressing Enter
powershell -command "$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('{ENTER}')"
echo Commands pasted. Check the blueCFD-Core window for execution.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment