Skip to content

Instantly share code, notes, and snippets.

@cKlee
Last active August 29, 2015 14:04
Show Gist options
  • Save cKlee/c85968c306f3373a0116 to your computer and use it in GitHub Desktop.
Save cKlee/c85968c306f3373a0116 to your computer and use it in GitHub Desktop.
WinIBW helpers
/**
* zählt Exemplardatensätze
*
* @return int|null
*/
function __exemplareAnzahl()
{
var strTitle = application.activeWindow.copyTitle();
var regexpExe = /\n(70[0-9][0-9])/g;
var alleExe = new Array();
alleExe = strTitle.match(regexpExe);
//application.messageBox("", alleExe.length, "message-icon");
return (!alleExe) ? null : alleExe.length;
}
/**
* iteriert durch Exemplare und ruft für jedes Exemplar eine Funktion auf
*/
function __iterateExemplare(callback)
{
var exCount = __exemplareAnzahl();
for(var i = 1; i <= exCount; i++)
{
callback(i);
}
}
/**
* test function for __iterateExemplare
*/
function testIterate()
{
__iterateExemplare(
function(i)
{
application.messageBox("", "Exemplar Nr. "+i, "message-icon");
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment