[solved]script not working anymore with NConvert

Discuss and share scripts and script files...
Post Reply
lian00
Posts: 368
Joined: 09 Jul 2014 17:12

[solved]script not working anymore with NConvert

Post by lian00 »

Hello, I use this script associate with NConvert to put a random watermark image on an image. It worked nicely until some times. The only difference I see is XYplorer updates. Is there something in XYplorer code I should check. If everything is OK, I will ask on NConvert forum. Thanks for your answers.

When I run this code now, the watermark image is copied in image directory and nothing more.

Code: Select all

foreach($file, "<get SelectedItemsPathNames |>") {
	$rand = rand(1,5);
	$nomfichier = "G:\img-range\images-perso-xz\essai-cadre-"."$rand".".png";
	wait 1000;
    runret("""C:\Program Files\nconvert\nconvert.exe""-resize longest 500 -quiet -wmflag center -wmfile"." $nomfichier"." -D -out jpeg -o G:\img-range\images-perso-xz\alternative\%-alter.jpg""");
        wait 1000;
        }
 	end confirm ("Allez à Alternative ? !!PENSER à uploader l'image!!") == 0;
          goto "G:\img-range\images-perso-xz\alternative";
Last edited by lian00 on 26 Jul 2020 18:32, edited 1 time in total.
Windows 10 64 bits

klownboy
Posts: 4141
Joined: 28 Feb 2012 19:27

Re: script not working anymore with NConvert

Post by klownboy »

It may not be the problem (I can't test), but you don't have a space after "nconvert quotes ...nconvert.exe""-resize and maybe there should be. As shown, I don't have any when I selected your text directly from the forum.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

lian00
Posts: 368
Joined: 09 Jul 2014 17:12

Re: script not working anymore with NConvert

Post by lian00 »

You are right. But after correcting this, it’s not better. The script goes to the end (with message) but the file is not created. In fact, I did try to modify to change the code from working code (always calling NConvert) as I had the "no file created" problem. So the missing space was coming from my tests. But the original problem is still there. Very frustrating.
Windows 10 64 bits

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: script not working anymore with NConvert

Post by highend »

You're looping over selected images which are addressed by $file and then don't use $file in the loop?
So how should nconvert know what file to process?
This worked nicely (some time ago)? I doubt this.

Apart from that, the quoting is wrong at the end of the runret command...
One of my scripts helped you out? Please donate via Paypal

lian00
Posts: 368
Joined: 09 Jul 2014 17:12

Re: script not working anymore with NConvert

Post by lian00 »

Thanks for pointing all the problems. And you are right, I remember now that my old code did not work anymore and tried to adapt this one. But I did not keep the old working/no more working code. Too bad.

Code: Select all

"Redim 1200"
	 foreach($file, "<get SelectedItemsPathNames |>") {
        $ext     = gpc($file, "ext");
        $oldName = gpc($file, "base");
        $newName = replace(recase($oldName, "lower"), " ", "-");
        rename "s", "$oldName/$newName";
        runret("""C:\Program Files\nconvert\nconvert.exe"" -ratio -rtype lanczos -rflag orient -quiet -resize longest 1200 -out jpeg -o ""G:\images\Output\%.jpg"" ""<curpath>\$newName.$ext""");
    }
    end confirm("Allez à Output ?") == 0;
    goto "G:\images\Output";
This one works perfectly and there is no call to $file in NConvert. Sorry, I don’t master this at all.
Windows 10 64 bits

lian00
Posts: 368
Joined: 09 Jul 2014 17:12

Re: script not working anymore with NConvert

Post by lian00 »

Thanks to @highend, I added the call to $file and it works now. I don’t know how I missed that in my tests.
Windows 10 64 bits

Post Reply