Skip to content

Instantly share code, notes, and snippets.

@rootbsd
Created August 12, 2020 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rootbsd/f62df5821804577103a14f9e29958c71 to your computer and use it in GitHub Desktop.
Save rootbsd/f62df5821804577103a14f9e29958c71 to your computer and use it in GitHub Desktop.
material_search.txt
bool val;
string Value = "";
void main() {
AddStringInput("Value", val);
ModalDialog( "Material name:\n", "");
string UserData = rwPath("");
UserData = UserData+ "\\patterns\\" ;
// powershell.exe -command "$data = Get-ChildItem -Path 'D:\Documents\3D-CoatV49\patterns\' -Recurse '*.pbrm' | Select-String '<Name>' | Select-String 'grass' | Select-Object -Property Path,Line | format-table -hidetableheaders | out-string ; $data=$data.replace('D:\Documents\3D-CoatV49\patterns\',''); write-output $data.replace('<Name>','---> ').replace('</Name>','') "
string part1="/C powershell.exe -command \"$data = Get-ChildItem -Path '";
string part2="' -Recurse '*.pbrm' | Select-String '<Name>' | Select-String '";
string part3="' | Select-Object -Property Path,Line | format-table -hidetableheaders | out-string ; $data=$data.replace('";
string part4="',''); write-output $data.replace('<Name>','---> ').replace('</Name>','') ";
string pause=";$t = Read-Host -Prompt 'press enter to close...'";
string WindowsCMD = part1+UserData+part2+Value+part3+UserData+part4+pause;
Execute("cmd.exe", WindowsCMD);
//ModalDialog( "Command line:\n" + WindowsCMD, "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment