Scripting problem

PhilM
Mitglied
Posts: 171
Joined: Thu 28 May 2015 18:00
Location: Belgium

Scripting problem

Post by PhilM »

This VB script used to work to export a renamed JPG copy of the current PLD document.

Code: Select all

...
If Not doc Is Nothing Then
        docPath = doc.Path
        If (Len(docPath) > 0) Then
                Dim PathLen
                PathLen = Len(docPath)		
                docPath = Left(doc.Path, PathLen-4) & "_rw.jpg"		'Remplace ".jpg" with "_rw.jpg"
                MsgBox docPath , VBOKOnly , "New Path"

                doc.Export(docPath)
        End If
End If

Now, Export() does not save the copy, and it closes the PLD documents.

I attempted to replace with doc.SaveAs() : it does create a new untitled JPG document.

Win 10 and PL V24

Phil
Martin Huber
Entwickler
Entwickler
Posts: 4167
Joined: Tue 19 Nov 2002 15:49

Re: Scripting problem

Post by Martin Huber »

PhilM wrote: Mon 09 Oct 2023 12:46 Now, Export() does not save the copy, and it closes the PLD documents.
Strange. I can only test on Windows 11, but it works fine here (also with PhotoLine 24).

It exports the file and doesn't close the document. It doesn't matter whether I execute the script with a simple image or a complex document.

I first started PhotoLine and then opened my document. After that I started the script from Notepad++ and directly from Explorer. Both ways worked fine.

Does your MsgBox show the correct filename?

Martin
PhilM
Mitglied
Posts: 171
Joined: Thu 28 May 2015 18:00
Location: Belgium

Re: Scripting problem

Post by PhilM »

Yes the file name displays OK in the MsgBox.

I think it has to do with V24.00 and V24.40b4 both installed on my machine.

If I open a file in V24.40b4 and go from the "Filter/Scripts" menu, everything works as expected.
If I launch the script from the windows explorer, it opens an empty V24.00
PhilM
Mitglied
Posts: 171
Joined: Thu 28 May 2015 18:00
Location: Belgium

Re: Scripting problem

Post by PhilM »

Further investigation ...

I noticed in the Windows Parameters/Applications that only Photoline V24.40 Beta was listed.
So, I reinstalled V24.00.
Now, only V24.00 is listed. V24.40 is not there anymore ...

And my script now works as expected in V24.00 and fails in V24.40 ...

If I remember correctly, both versions used to be listed in Windows Applications ?

New Windows behavior ?
Or new installer version ?

Phil
Martin Huber
Entwickler
Entwickler
Posts: 4167
Joined: Tue 19 Nov 2002 15:49

Re: Scripting problem

Post by Martin Huber »

Only one PhotoLine version can be registered for scripting, usually the last one you installed.

If you have installed several PhotoLine versions and you want to use another version for scripting, you can activate it by executing this version from command line with

PhotoLine.exe /RegisterPerUser

Martin
PhilM
Mitglied
Posts: 171
Joined: Thu 28 May 2015 18:00
Location: Belgium

Re: Scripting problem

Post by PhilM »

Thank you Martin