Number ncprogram with $ count +1

Number ncprogram with $ count +1

Euroutil
Contributor Contributor
644 Views
2 Replies
Message 1 of 3

Number ncprogram with $ count +1

Euroutil
Contributor
Contributor

Hi,

I want to renumber the nc programs but the macro that I created starts with the assigned number plus one.

 

Desired Ncprogram.png

After runnig the macro.png

 

Could someone help me solve this little problem?

 

attached macro and images;

 

//ESTA MACRO NUMERA LOS NCPROGRAMS

 

Reset localvars


//Comprueba si deseas numerar los NCPrograms

 

string yesorno = "Click SI,para renumerar Ncprograms." + crlf + "Click NO,para cancelar la macro"
bool yes = 0
$yes = QUERY $yesorno

IF yes {


STRING $nombre = ""

INT $COUNT = INPUT "Introduce numero de programa"


// Numerar todos los Ncprograms o solo las seleccionadas

 

string allorno = "Click SI,para numerar todos los Ncprograms." + crlf + "Click NO,otras opciones"
bool yes = 0
$yes = QUERY $allorno

 

IF $yes == 1 {

 

// Numerar todos los Ncprograms

 

FOREACH Ncp IN folder('NCProgram') {
ACTIVATE NCPROGRAM $Ncp.name
$COUNT = $COUNT + 1
STRING NewName = ($nombre + $COUNT)
RENAME NCPROGRAM ; $NewName
}

 


}

 

Thanks

 

Alex

0 Likes
Accepted solutions (1)
645 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution
FOREACH Ncp IN folder('NCProgram') {
ACTIVATE NCPROGRAM $Ncp.name
$COUNT = $COUNT + 1
STRING NewName = ($nombre + $COUNT)
$COUNT = $COUNT + 1

RENAME NCPROGRAM ; $NewName
}
Message 3 of 3

Euroutil
Contributor
Contributor

Hi Karbidhegyu;

 The macro works perfectly!!!!

Thanks,thanks.thanks

Alex

0 Likes