@Override
    public void run() throws Exception {
		
		if (currentAddress == null) {
	            println("No Location.");
	            return;
	        }
		MemoryBlock currentMemoryBlock = currentProgram.getMemory().getBlock(currentAddress);
		if(!currentMemoryBlock.isInitialized()){
			println("Script cannot run in uninitialized memory.");
			return;
		}
			
		Listing listing = currentProgram.getListing();
		Address currentAddr = currentAddress;
		byte repeatingByte = currentProgram.getMemory().getByte(currentAddr);
		int repeatLen = 1;
		currentAddr = currentAddr.addNoWrap(1);
		byte nextByte;		
		boolean sameMemoryBlock;
		if(currentProgram.getMemory().getBlock(currentAddr).equals(currentMemoryBlock)) {
			nextByte = currentProgram.getMemory().getByte(currentAddr);
			sameMemoryBlock = true;
		}
		else{
			sameMemoryBlock = false;
			return;
		}
		
		boolean noCollisions = true;
		
		while((sameMemoryBlock) && (nextByte == repeatingByte) && (noCollisions)){
			repeatLen++;
			currentAddr = currentAddr.addNoWrap(1);
			if(currentProgram.getMemory().getBlock(currentAddr) != currentMemoryBlock){
				sameMemoryBlock = false;				
			}
			else{
				nextByte = currentProgram.getMemory().getByte(currentAddr);
				noCollisions = listing.isUndefined(currentAddr,currentAddr);
			}			
		}
		
	
		listing.createData(currentAddress, new AlignmentDataType(), repeatLen);				
		
		println("Applied Alignment datatype at " + currentAddress.toString());				
			
	}
condenses sequence of equal bytes, starting at current byte, into an array of bytes
Ghidra/Features/Base/ghidra_scripts/CondenseRepeatingBytes.java