InDesign CS6 script - Export JPG Images with Original Filename into New Folder

My first real InDesign script.

//What it does:
1. Export framed images from InDesign into individual JPG images.
2. These images will be named the same file name as the original linked file.
3. JPEG Settings: Progressive, Medium quality, 72 dpi, RGB (You can change these, but not sure about changing RGB - CMYK).
4. Images saved into created folder: "JPG webexport".

1. The image size will be the same size as the frame of the image.
2. All framed images will be exported.
3. You gotta change the folder; absolute location (two instances).
4. If you know how to change the output folder into same location as the .indd file, PLEASE do tell. I couldn't figure this out.

//If you want to edit it:
1. You may open the file with Notepad (or other).
2. Change stuff.
3. Save it.
4. Make sure extension is .jsx.

DOWNLOAD LINKS (Google Drive):

// Credit where it's due.
These were my main sources. Thank you very much to the helpful guys and gals of StackExchange/StackOverflow :')

Now, I'm pretty sure the script can still be cleaned up, but being that this already took up almost two of my work days, I ain't gonna fix what's not broken :')


//Script in text below (Select to COPY from BELOW here):

var myDoc = app.activeDocument,
apis = myDoc.allPageItems, rect, fileName;

while ( rect = apis.pop() )
    if ( !(rect instanceof Rectangle) || ![0].isValid ){ continue; }

    fileName = File ([0].itemLink.filePath ).name;
    fileName = fileName.replace( /\.[a-z]{2,4}$/i, '.jpg' );

    app.jpegExportPreferences.exportResolution = 72;
    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MEDIUM;

    //make new folder
    var f = new Folder("c:/users/Shadouness/desktop/JPG webexport/"); 

    //give it a unique name
    var myFile = new File('c:/users/Shadouness/desktop/JPG webexport/' + fileName);

    rect.exportFile(ExportFormat.JPG, myFile);

// (Select to COPY until ABOVE here)

Abed Made Me Feel... Weird

Watching the TV series tonight (the April Fool's episode "The Science of Illusion"), there was a scene where Annie and Shirley were in the Dean's office.
Abed was also there, for no apparent reason.
When the dean asked him why he was there he said,
"Short answer? My cable went out."
And then I felt like some spirit went out of my body.

test - YouTube video embed+

2014 Milan Men Autumn Winter Fashion Week Trailer




Yes to Genetically Modified Foods

Why make cheap, big, "dangerous" genetically modified foods (GMO's) that you can donate to needy countries, when you can produce "organic" foods that only the rich can afford and no one in the starving regions of the world will be able to take a bite of?

Come on.

You'd rather have people starve to death than give them food that you labeled as "unsafe". And I bet you're using fossil fuel in your cars.

GMO's are there to help people, to feed people.
But, don't copyright plants and animals, unless you actually created, like 90% of it :'p