1

I've made a very simple photo resizer with Mathematica: It takes some files in a folder, processes them and write them into that folder. Now, I have to open the Mathematica file every time and evaluate the code. Is it possible to automate this? Perhaps making an applet or something? I tried to at least automate the closing of the code with Exit[] and Quit[] but it didn't work the way I wanted.

It would be really useful to have a file in my desktop and every time I open it, it automatically executes de resizing process and then closes. Notice that I don't need it to run in other computers that don't have Mathematica, I need it to run only on my computer that has Mathematica.

Red Banana
  • 5,329
  • 2
  • 29
  • 47
  • 2
    Perhaps making an applet or something? applets are dead. If you want to run the Mathematica code inside a browser, the CDF plugin is no longer supported. few years ago, one could have run a CDF inside a browser. Another option is to make a CDF file, and run it inside a Mathematica CDF player. But you will not be able to avoid having to open something and click on a button to run it. You could also try Mathematica online. There are many questions here about how to deploy Mathematica code online. But I think the simplest thing is to make a CDF and use the player to run it using a button. – Nasser Apr 19 '21 at 06:47
  • 1
    Also you could check the initialization code in notebook. These are cells which you can set to automatically execute/run when you open a notebook. see https://mathematica.stackexchange.com/questions/9484/running-an-initialization-cell-on-mathematica-start-up You should be able to set the code in the initialization cell to automatically run the code you want and close the notebook at the end. You could also make a mathematica script to do this all. – Nasser Apr 19 '21 at 06:55
  • @Nasser The solution provided there doesn't seems to work. – Red Banana Apr 19 '21 at 07:52
  • 2
    You could create a Wolfram Language Script. These can be executed e.g. from a link or a command line. – Daniel Huber Apr 19 '21 at 07:53
  • @DanielHuber This worked perfectly! But when I run it, it does this. Can we make it close automatically after the script finishes? Without having to press enter or esc? – Red Banana Apr 19 '21 at 18:36
  • @DanielHuber I switched from Conemu to the standard Windows terminal and it works the way I want. I guess the trouble in am finding has to do with Conemu, not with Mathematica. – Red Banana Apr 19 '21 at 18:42
  • 1
    E.g. if you put "Hello">>"d:/tmp/test.txt" in a script (**.wls), you can double click the file, the test file is written and the command windows is closed automatically. – Daniel Huber Apr 19 '21 at 18:46
  • @DanielHuber Yeah, I think this is a problem with Conemu. – Red Banana Apr 19 '21 at 19:01

0 Answers0