display certain code based on variable passed in url using php - variables

Goal: display 1 of 4 Wistia videos based on url variable passed to php page.
Example url:
showvid.php?vid=1 or
showvid.php?vid=2 or
showvid.php?vid=3 or
showvid.php?vid=4
In showvid.php:
some if/then statement where
if vid=1 then show wistia embed code 1
else
if vid=2 then show wistia embed code 2
else
if vid=3 then show wistia embed code 3
else
if vid=4 then show wistia embed code 4
Pretty straight forward. I apologize if this is answered elsewhere, I looked fairly extensively and couldn't find an answer that would work (plus I'm fairly new and my head is spinning after digging for a while).
Thanks in advance for your help.
EDIT: pulled code from comment
URL: pagename.php?bucket=1
$bucket = $_GET["bucket"]
if ($bucket == 1) {
$bucketdesc = 'Memory Vapor';
}
if ($bucket == 2) {
$bucketdesc = 'Brain Trauma Syndrome';
}
else {
goto "/pagetwo.php"
}

Thanks for the help. The resulting code that worked was...
if ($bucket == 1) {
$bucketdesc = 'desc1';
$bucketvid = 'embed code';}
elseif ($bucket == 2) {
$bucketdesc = 'desc2';
$bucketvid = 'embed code2';}
elseif ($bucket == 3) {
$bucketdesc = 'desc3';
$bucketvid = 'embed code3';}
elseif ($bucket == 4) {
$bucketdesc = 'desc4';
$bucketvid = 'embed code4';}
I had forgotten the ; at then end of each statement! doh...

Related

Multiple visibility outputs from a if statements adobe animate html5

Thank you for your time
I have a large animation I am working on with several if statements with many outputs
I join the outputs with & ampersand and it all works ok, but when I try to call the visibility of a movie clip, it will not work. Here is a simple one I wrote using three movie clips.
this.black_sw.addEventListener("click", fl_ClickToHide.bind(this));
function fl_ClickToHide()
{ if(this.black_mc. visible== true)(
this.black_mc.visible = false
this.redball.visible = true
)
else if(this.black_mc. visible== false)
(this.black_mc.visible = true
this.redball.visible = false)
}
This does not work console error if I add a "&" to join the statements also console error, deleting
one of the (visible = ) conditions in each part, it works, why, I am stumped.
best regards peter
this.black_sw.addEventListener("click", fl_ClickToHide.bind(this));
function fl_ClickToHide()
{
if (this.black_mc.visible)
{
this.black_mc.visible = false
this.redball.visible = true
}
else
{
this.black_mc.visible = true
this.redball.visible = false
}
}
This should work

GameMaker 2: Cannot use function/script name for a variable, using "_dir"

after going through the Space Mods - GML - Enemy Factions (2/3) - GameMaker Studio 2 tutorial on YouTube by Gamemaker.
I've came into some trouble with testing the game.
My compile error goes like this:
Script:create_bullet at line 6; cannot use function/script name for a variable, using "_dir"
The script in question:
/// #description create_bullet
/// #arg direction
/// #arg speed
/// #arg faction
function create_bullet(_dir,_spd,_fac,_creator){
var _dir = argument[0];
var _spd = argument[1];
var _fac = argument[2];
var _creator = self;
audio_play_sound(snd_zap, 1, false);
var inst = instance_create_layer(x,y, "Instances", obj_bullet);
with(inst){
direction = _dir();
speed = _spd;
faction = _fac;
creator = _creator;
if(faction == factions.ally) image_blend = c_aqua;
else if(faction == factions.enemy) image_blend = c_red;
}
}
I've checked the comments to see if anyone else has had a similar problem and I can't find the solution myself. Will anyone be able to help and explain. I'm quite new to coding and just taking it step by step.
I found an answer in another forum.
My mistake seems to have been placing brackets after _dir;:
with(inst){
direction = _dir(); <=
speed = _spd;
faction = _fac;
creator = _creator;
After removing that and taking out the var before:
_dir = argument[0];
_spd = argument[1];
_fac = argument[2];
_creator = self;
It seems to work fine now.

How do I make ABCPdf to automatically write to a new page when text requires more than 1 page?

I deal with dynamic input text, so the pages should be dynamically created. If page 1 is already full, it should write to a new page, so it means I can have page 2, page 3 and so on depending on the data processed.
Currently, my text is truncated. Only writes Page 1, the rest of data are not written.
My current code below:
//add page 1
theDoc.Page = theDoc.AddPage();
theDoc.AddImageHtml(html, true, 826, true);
//continue adding page if needed
while (theDoc.GetInfo(theID, "Truncated") == "1")
{
theDoc.Page = theDoc.AddPage();
theDoc.AddImageHtml(html, true, 826, true);
}
//save file
String pdfFilePath = WebConfigurationManager.AppSettings["pdfFilePath"];
Guid fileName = Guid.NewGuid();
pdfLink = pdfFilePath + fileName.ToString() + ".pdf";
theDoc.Save(pdfLink);
theDoc.Clear();
variable html contains all the data(webpage), I'm probably missing something in my while loop. Any help is appreciated! Thanks
Found it, Use Chainable and then Flatten()
theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageUrl("http://www.yahoo.com/");
while (true) {
theDoc.FrameRect(); // add a black border
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
for (int i = 1; i <= theDoc.PageCount; i++) {
theDoc.PageNumber = i;
theDoc.Flatten();
}

Identify and extract or delete pages of a PDF based on a search string / text (action / javascript)

Good Evening (UK)
I'm trying to filter down a 1500+ page PDF file to only the pages which include a certain text string (typically one or two words). My laptop is locked down with respect to installing more software BUT I have used action(script)s quite a bit
I get the error below when I try to install this action into Abobe Acrobat X Pro (Win 7):
screen dump of error
called "Extract Commented Pages"... supposed to be OK for X and XI this looks like what I want.....
I wondered if there was something simple causing the problem but the actionscript file is rather... busy to say the least.
I used to have an action that I think was based on a legal redaction script but it is filed somewhere!
If you have already got an action that does this or a version of the above that doesn't give the error I get (unable to import the Action.... The file is either invalid or corrupt) I will forever by indebted to your gratitude
Many thanks, have a good weekend!
I recently came across a script found at the following link: http://forums.adobe.com/thread/1077118
I'm having some issues getting the script to run in Acrobat, despite everything looking alright in the script itself. I'll update if I find any errors.
Here is a copy of the script:
// Set the word to search for here
var sWord = "forms";
// Source document = current document
var sd = this;
var nWords, currWord, fp, fpa = [], nd;
var fn = sd.documentFileName.replace(/\.pdf$/i, "");
// Loop through the pages
for (var i = 0; i < sd.numPages; i += 1) {
// Get the number of words on the page
nWords = sd.getPageNumWords(i);
// Loop through the words on the page
for (var j = 0; j < nWords; j += 1) {
// Get the current word
currWord = sd.getPageNthWord(i, j);
if (currWord === sWord) {
// Extract the current page to a new file
fp = fn + "_" + i + ".pdf";
fpa.push(fp);
sd.extractPages({nStart: i, nEnd: i, cPath: fp});
// Stop searching this page
break;
}
}
}
// Combine the individual pages into one PDF
if (fpa.length) {
// Open the document that's the first extracted page
nd = app.openDoc({cPath: fpa[0], oDoc: sd});
// Append any other pages that were extracted
if (fpa.length > 1) {
for (var i = 1; i < fpa.length; i += 1) {
nd.insertPages({nPage: i - 1, cPath: fpa[i], nStart: 0, nEnd: 0});
}
}
// Save to a new document and close this one
nd.saveAs({cPath: fn + "_searched.pdf"});
nd.closeDoc({bNoSave: true});
}

How to automate Photoshop?

I am trying to automate the process of scanning/cropping photos in Photoshop. I need to scan 3 photos at a time, then use Photoshop's Crop and Straighten Photos command, which creates 3 separate images. After that I'd like to save each of the newly created images as a PNG.
I looked at the JSX scripts and they seem to a lot of promise. Is what I described possible to automate in Photoshop using JavaScript or VBScript or whatever?
I just found this script just did the work for me! It automatically crop & straighten the photo and save each result to directory you specified.
http://www.tranberry.com/photoshop/photoshop_scripting/PS4GeeksOrlando/IntroScripts/cropAndStraightenBatch.jsx
Save it to local then run it in the PS=>File=>Command=>Browse
P.S I found in the comment it said the script can be executed directly by double clicking from Mac Finder or Windows Explorer.
Backup gist for the script here
I actually got the answer on the Photoshop forums over at adobe. It turns out that Photoshop CS4 is totally scriptable via JavaScript, VBScript and comes with a really kick-ass Developer IDE, that has everything you'd expect (debugger, watch window, color coding and more). I was totally impressed.
Following is an extract for reference:
you can run the following script that will create a new folder off the existing one and batch split all the files naming them existingFileName#001.png and put them in the new folder (edited)
#target Photoshop
app.bringToFront;
var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder != null){
var fileList = inFolder.getFiles(/\.(jpg|tif|psd|)$/i);
var outfolder = new Folder(decodeURI(inFolder) + "/Edited");
if (outfolder.exists == false) outfolder.create();
for(var a = 0 ;a < fileList.length; a++){
if(fileList[a] instanceof File){
var doc= open(fileList[a]);
doc.flatten();
var docname = fileList[a].name.slice(0,-4);
CropStraighten();
doc.close(SaveOptions.DONOTSAVECHANGES);
var count = 1;
while(app.documents.length){
var saveFile = new File(decodeURI(outfolder) + "/" + docname +"#"+ zeroPad(count,3) + ".png");
SavePNG(saveFile);
activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;
count++;
}
}
}
};
function CropStraighten() {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
executeAction( sTID('CropPhotosAuto0001'), undefined, DialogModes.NO );
};
function SavePNG(saveFile){
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.embedColorProfile = true;
pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
pngSaveOptions.matte = MatteType.NONE;
pngSaveOptions.quality = 1;
pngSaveOptions.PNG8 = false; //24 bit PNG
pngSaveOptions.transparency = true;
activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
}
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
Visit here for complete post.
Have you tried using Photoshop Actions? I don't now about the scanning part, but the rest can all be done by actions quite easily.