# Running sketch from OpenProcessing.org in PDE

**URL:** <https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97>\
**Category:** Coding Questions\
**Created:** [May 18, 2018, 1:07pm UTC](https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97 "2018-05-18T13:07:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![igenh](https://avatars.discourse-cdn.com/v4/letter/i/f0a364/32.png) [@igenh](https://discourse.processing.org/u/igenh)\
**Post date:** [May 18, 2018, 1:07pm UTC](https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97/1 "2018-05-18T13:07:55Z")

</div>

Hi… I’m really new to processing and I need help figuring out why so many errors are occuring on this sketch from openprocessing… The link is [https://www.openprocessing.org/sketch/424983](https://www.openprocessing.org/sketch/424983) . THANKS

---

<div class="post-metadata">

**Author:** ![WakeMeAtThree](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wakemeatthree/32/38_2.png) [@WakeMeAtThree](https://discourse.processing.org/u/WakeMeAtThree)\
**Post date:** [May 18, 2018, 1:22pm UTC](https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97/2 "2018-05-18T13:22:25Z")

</div>

Sketch seems to be working. Are you trying to run the code in the processing ide in java mode? Because the sketch is written in JavaScript, not Java. If that’s the case, just switch the mode in processing from java to p5.js.

---

<div class="post-metadata">

**Author:** ![igenh](https://avatars.discourse-cdn.com/v4/letter/i/f0a364/32.png) [@igenh](https://discourse.processing.org/u/igenh)\
**Post date:** [May 18, 2018, 1:33pm UTC](https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97/3 "2018-05-18T13:33:08Z")

</div>

Yeah I was originally trying to run it in Java mode… I just tried to install p5.js and run it in that mode however it gives me the error:

> “Cannot change mode,  
> because “p5.js” mode is not compatible with current mode”

Not sure why - Also the JavaScript mode is greyed out in the install browser so I do not think it is compatible with the newest version of processing anymore. Any ideas?

Thanks for your response!

---

<div class="post-metadata">

**Author:** ![WakeMeAtThree](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wakemeatthree/32/38_2.png) [@WakeMeAtThree](https://discourse.processing.org/u/WakeMeAtThree)\
**Post date:** [May 18, 2018, 1:46pm UTC](https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97/4 "2018-05-18T13:46:20Z")

</div>

Make sure you have the processing file saved somewhere, and that you reference the sketch file in the `index.html` file. For example, if you called it `sketch.js`, the `index.html` file should be:

```auto
<html>
<head>
  <meta charset="UTF-8"> 
  <script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
  <script language="javascript" type="text/javascript" src="sketch.js"></script>
  <style> body {padding: 0; margin: 0;} </style>
</head>

<body>
</body>
</html>

```

Also, make sure you have the font `AvenirNextLTPro-Demi.otf` in the same directory as your sketch.js file. If you don’t have that font, you can substitute for any other font.

EDIT: And one more thing, don’t forget to credit the original author of the sketch!

---

<div class="post-metadata">

**Author:** ![ProcessingOrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/processingorg/32/18341_2.png) [@ProcessingOrg](https://discourse.processing.org/u/ProcessingOrg)\
**Post date:** [May 18, 2018, 1:56pm UTC](https://discourse.processing.org/t/running-sketch-from-openprocessing-org-in-pde/97/5 "2018-05-18T13:56:43Z")

</div>

This error:

> [@igenh](#):
>
> “Cannot change mode,  
> because “p5.js” mode is not compatible with current mode”

should go away if you restart Processing and then when it’s started again, switch to p5.js mode.

As mentioned, the trick to getting this code up and running is loading the font, either using the current font of defining a new font and adding it to the folder where the “sketch.js” file lives.
