Sunday, May 20, 2012

The Photoshop SDK Plugin Tutorial Fix

I downloaded the Photoshop SDK, which are currently free at the moment, to start creating my own plug-ins.
The SDK comes with a convoluted tutorial, and it took me the better part of the evening to find the one that showed how to compile the provided source code into an .8bf file for windows.

The HTML file in question is "pluginsdk/documentation/html/pgwinplugins.html" and is a travesty of HTML coding. The author neglected to close any <p> tags, and the images are referring to the wrong folder.

The first thing to do is make use of find/replace in your favorite HTML editor and get the images properly linking.

Now assuming you go through the tutorial - it was written for Visual Studio 2005, so half the settings are no longer applicable - and you compile the beast, you will get an error.
"error d8004 /tc requires an argument"

Not being a C++ programmer, or much of a console programmer at all, this drove me nuts.
The answer is NOT in any forum on MSDN. To find the answer I attempted to convert the existing project the tutorial tells you to copy everything from ("dissolve"). In the UpgradeLog.xml, I discovered the following:
<Event ErrorLevel="1" Project="Dissolve" Source="Dissolve.vcproj" Description="VCConvertEngine could not convert attribute CommandLine = cl /I..\..\..\Common\Includes /I..\..\..\..\PhotoshopAPI\Photoshop /I..\..\..\..\PhotoshopAPI\PICA_SP /I..\..\..\Common\Resources /EP /DMSWindows=1 /DWIN32=1 /Tc&quot;%(FullPath)&quot; &gt; &quot;$(IntDir)%(Filename).rr&quot;&#xA;..\..\..\resources\cnvtpipl.exe &quot;$(IntDir)%(Filename).rr&quot; &quot;$(IntDir)%(Filename).pipl&quot;&#xA;del &quot;$(IntDir)%(Filename).rr&quot;&#xA; under VCCustomBuildTool Debug|Win32.">
</Event><Event ErrorLevel="1" Project="Dissolve" Source="Dissolve.vcproj" Description="VCConvertEngine could not convert attribute CommandLine = cl /I..\..\..\Common\Includes /I..\..\..\..\PhotoshopAPI\Photoshop /I..\..\..\..\PhotoshopAPI\PICA_SP /I..\..\..\Common\Resources /EP /DMSWindows=1 /DWIN32=1 /Tc&quot;%(FullPath)&quot; &gt; &quot;$(IntDir)%(Filename).rr&quot;&#xA;..\..\..\resources\cnvtpipl.exe &quot;$(IntDir)%(Filename).rr&quot; &quot;$(IntDir)%(Filename).pipl&quot;&#xA;del &quot;$(IntDir)%(Filename).rr&quot;&#xA; under VCCustomBuildTool Debug|x64.">
</Event><Event ErrorLevel="1" Project="Dissolve" Source="Dissolve.vcproj" Description="VCConvertEngine could not convert attribute CommandLine = cl /I..\..\..\Common\Includes /I..\..\..\..\PhotoshopAPI\Photoshop /I..\..\..\..\PhotoshopAPI\PICA_SP /I..\..\..\Common\Resources /EP /DMSWindows=1 /DWIN32=1 /Tc&quot;%(FullPath)&quot; &gt; &quot;$(IntDir)%(Filename).rr&quot;&#xA;..\..\..\resources\cnvtpipl.exe &quot;$(IntDir)%(Filename).rr&quot; &quot;$(IntDir)%(Filename).pipl&quot;&#xA;del &quot;$(IntDir)%(Filename).rr&quot;&#xA; under VCCustomBuildTool Release|Win32.">
</Event><Event ErrorLevel="1" Project="Dissolve" Source="Dissolve.vcproj" Description="VCConvertEngine could not convert attribute CommandLine = cl /I..\..\..\Common\Includes /I..\..\..\..\PhotoshopAPI\Photoshop /I..\..\..\..\PhotoshopAPI\PICA_SP /I..\..\..\Common\Resources /EP /DMSWindows=1 /DWIN32=1 /Tc&quot;%(FullPath)&quot; &gt; &quot;$(IntDir)%(Filename).rr&quot;&#xA;..\..\..\resources\cnvtpipl.exe &quot;$(IntDir)%(Filename).rr&quot; &quot;$(IntDir)%(Filename).pipl&quot;&#xA;del &quot;$(IntDir)%(Filename).rr&quot;&#xA; under VCCustomBuildTool Release|x64.">
This refers to the "Enter Custom Build Settings for PiPL" step. Item number 6 - where you Click on "Command Line" and create a temporary .rr file. This little guy is giving you the nasty d8004 error in your custom filter.
To fix it, when you go to enter the custom build settings for PiPL, enter the following code in the Command Line:
cl /I..\..\..\Common\Includes /I..\..\..\..\PhotoshopAPI\Photoshop /I..\..\..\..\PhotoshopAPI\PICA_SP /I..\..\..\Common\Resources /EP /DMSWindows=1 /DWIN32=1 /Tc"%(FullPath)" > "$(IntDir)%(Filename).rr"
..\..\..\resources\cnvtpipl.exe "$(IntDir)%(Filename).rr" "$(IntDir)%(Filename).pipl"
del "$(IntDir)%(Filename).rr"
And for the Output, enter the following:
$(IntDir)%(Filename).pipl
When you compile, Visual Studio will be able to locate the necessary resource files, and you'll finally get the .8bf file generated.

Saturday, May 12, 2012

Silverlight Browser Crash

Recently I was working with SharePoint when the browser crashed. I opened my site back up, went to the "create" menu and... BAM! the browser crashed.
Thinking IE was having a "Microsoft Moment" - I opened the site in Firefox. Open the "create" menu and... CRASH!
But Firefox told me something IE didn't - the Silverlight plug-in was misbehaving.
I found this video via Google searches that suggests a number of things to try and get the plug-in to work again.


What ended up working for me was to go to the Silverlight home page (http://www.microsoft.com/silverlight/), save the plug-in to disk, and run it to re-install Silverlight.