Help on editing script

I don’t know scripting but I want to edit script made by recording a macro. So if someone can help it will be appreciated!
In script is given filename for import for example C/345_File.obj but those numbers '345’are changeable so I want it to import File.obj no matter what numbers are there.
Have anybody got solution to this?


You can’t use wildcards with file names in zscript, so you need to loop through all the possible names. This bit of code shows how it can be done. Note that the path and last part of the file name are set at the top. This will only load one file, the first it finds that has a path & name of the form “Test/323_File.obj”.

[VarDef,path,“Test/”]//set the path to the file here
[VarDef,fileName,"_File.obj"]//set the end part of file name here

[IButton,???,“Import a file”, //macro button
//start of code inside button
[Loop,1000,//loop through all possible file names

[If,n < 10,



[If,n < 100,







[If,[FileExists,fullFileName],[LoopExit]]//exit loop if there’s a file

,n]//end of loop
[If,[FileExists,fullFileName],//need this check in case loop completed


[IPress,Tool:Import]//import file

//end of code inside button
]//end button

Thanks marcus_civis!
Was hoping for those wildcards at first,like a easy fix.
Nice suprise that you gave effort to help,thank you very much!!!