You mentioned somewhere on the forum that you could change and fix scripts with the help of AI.
Is it possible to get some AI tool to help edit PVD scripts?
What do you use and could you share it with other PVD users?
I would also start using AI to help edit PVD scripts if I got the right information on how to use it.
Great to hear you are interested in!!!!!! PVD IS SAVED THEN!
I admit: I was always hesitating to ask you each time for a favor when something goes wrong, especially knowing that I am one of maybe ten users of PVD that still use it. So I decided to learn, not coding, but to recognize it and the most important, how to interact with AI. I'm still struggling with interacting, because it still struggles with itself, so today, I think I better know Pascal, then how to talk to AI, hahaha. I learned a lot in just a month or so.At the moment, and I emphasize that I don't want to pay for this, the best free coding AI out there (or better to say the least bad) is MS Copilot. It's free to use, but it has a lot of downsides. The biggest one, for me at least, is that the message has ~10k characters limit, so if you want to upload whole PVD script, you need 30 messages of copy pasting, and copilot will forget it after several messages. Frustrating! So at the moment, for me it's impossible to create or fix something because I don't know relations within the script and about PVD itself, so that's I asked you if you have some resources, or to share info so we could spread help. My goal is to reintegrate all the fields we once had in a single imdb script, to bring back AllMovie and Rottentomatoes scripts too, because simply there is no reason not to do it today.The other one I tried is duckduckgo chat. It ofers 4 models: All models are anonymously provided by DuckDuckGo
GPT-4o mini
General purpose AI with high built-in moderation
Created by OpenAI
Claude 3 Haiku
General purpose AI with high built-in moderation
Created by Anthropic
Llama 3.1 70B
Open Source
General purpose AI with medium built-in moderation
Created by Meta
Mixtral 8x7B
Open Source
General purpose AI with low built-in moderation
Created by Mistral AI
Please note: starting a new chat with any model will delete your current chat session
I tried briefly Mixtral 8x7B, and it receives ~16k characters, which is pretty good comparing to Copilot, but the total number messages per day is limited. The biggest downside for me is that it doesn't use our data to train themselves, which is brilliant for privacy, but not for outputs, hahaha. So, for someone who's not programmer, it still is extremely hard to achieve any goal.
But, as I said, the most important thing is how to instruct AI, meaning how to "talk" to it. What I learned all along the way, very hard way because I had to learn basics of Pascal and million things in parallel, is to first talk to it, to explain what you want, to ask it for examples, until you are fine with it and then to ask it for a workflow plan. That plan you
save somewhere out of chat for a goal you want to achieve, so you can later just paste it. Here's the example what I got as a workflow from AI, after a talked
a lot to it and once I was to check if multiple posters import is possible to PVD:
Yes, knowing that PVD cannot handle HTTPS and relies on the AHK script for downloading pages, we need to take extra caution when creating part2 of wscr3. Here are some key considerations:
1. Ensure Secure Handling of HTTPS:
Consistent Use of AHK: Ensure that all HTTPS requests are handled through the AHK script to maintain consistency and avoid errors.
Error Handling: Implement robust error handling to manage any potential issues with HTTPS downloads.
2. Avoid Direct HTTPS Calls in Part2:
No Direct HTTP Requests: Ensure that part2 does not attempt any direct HTTP requests, which PVD cannot process.
3. Manage Variable Dependencies:
Separate Variables: Use distinct variables for URLs and file paths in part2 to avoid conflicts with part1.
Consistent Paths: Ensure all paths are correctly set and accessible to both the AHK script and the main processing script.
4. Logging and Debugging:
Detailed Logs: Maintain detailed logs to trace each step and catch any issues early.
Sequential Logging: Ensure that the logs differentiate between the actions of part1 and part2 clearly.
5. Complete Initial Processing Before Starting Part2:
Clear Markers: Use clear markers to indicate the end of part1 and the beginning of part2.
Confirmation of Completion: Ensure part1 completes all tasks before initiating part2.
Example Pseudo-code for Part2:
pascal
// Ensure part1 completion
LogMessage('Function ParsePage smNormal END======================|');
Exit; // End of initial processing
// Part 2: Start new process for multiple posters
LogMessage('Starting process to download multiple posters');
// Define new URL and file path
NewURL := 'https://www.imdb.com/title/tt3461252/mediaindex';
NewDownloadFile := 'Tmp/multipage-UTF8_NO_BOM.htm';
// Download the new page using AHK script
FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+NewURL+'" "'+ScriptPath+NewDownloadFile+'"');
// Wait for the new download to finish
While Not(FileExists(ScriptPath+NewDownloadFile)) Do Begin
wait (2000);
End;
// Process the new page for multiple posters
WebText := FileToString(ScriptPath+NewDownloadFile);
WebText := ConvertEncoding(WebText, 65001);
LogMessage('Downloaded multiple posters page');
// Extract and download multiple posters
// Add your logic here to extract poster links and download them
By taking these precautions and structuring the script carefully, we ensure that part2 integrates smoothly with part1 and reliably handles all the necessary HTTPS requests through the AHK script.
Key Implications:
Sequential Addition: Posters need to be added one by one, using the navigation buttons to move through the poster slots (e.g., pos1, pos2).
Automatic Overwrite: Adding a poster in pos1 will overwrite the existing one unless the user navigates to a new slot (pos2) before adding another poster.
Manual Actions Mimicked by Script: Since manual actions require navigation buttons to switch between slots, the script needs to mimic these actions to add multiple posters.
Approach for wscr3:
To import multiple posters programmatically while respecting the manual navigation process, follow these steps:
Extract Poster URLs:
Extract multiple poster URLs from the gallery page as discussed.
Sequential Addition with Navigation:
Use script logic to simulate the navigation and addition of each poster URL.
Ensure the script switches to the next poster slot (pos2, pos3, etc.) before adding each new poster.
Pseudo-code Example:
pascal
// Ensure part1 completion
LogMessage('Function ParsePage smNormal END======================|');
Exit; // End of initial processing
// Part 2: Start new process for multiple posters
LogMessage('Starting process to download multiple posters');
// New URL and file path
NewURL := 'https://www.imdb.com/title/tt3461252/mediaindex';
NewDownloadFile := 'Tmp/multipage-UTF8_NO_BOM.htm';
// Download the new page using AHK script
FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+NewURL+'" "'+ScriptPath+NewDownloadFile+'"');
// Wait for the new download to finish
While Not(FileExists(ScriptPath+NewDownloadFile)) Do Begin
wait (2000);
End;
// Process the new page for multiple posters
WebText := FileToString(ScriptPath+NewDownloadFile);
WebText := ConvertEncoding(WebText, 65001);
LogMessage('Downloaded multiple posters page');
// Extract and store multiple poster URLs
PosterURLs := ExtractPosterURLs(WebText); // Pseudo-function to parse and get poster URLs
// Navigate and add each poster URL sequentially
For i := 0 to Length(PosterURLs) - 1 Do Begin
// Simulate clicking 'nextposterbtn' to navigate to the next poster slot
SimulateClickNextPosterButton(); // Pseudo-function for clicking the button
// Add the poster URL to the current slot
AddCustomFieldValueByName('posterURL'+IntToStr(i), PosterURLs[i]);
AddCustomFieldValueByName('poster'+IntToStr(i), PosterURLs[i]); // Adjust as needed
End;
// Update poster count
AddCustomFieldValueByName('postercount', IntToStr(Length(PosterURLs)));
Testing:
Run wscr3: Execute the script and verify that each poster is added to a new slot correctly.
Check Navigation: Ensure that the script correctly mimics navigation actions between poster slots.
Validation: Verify that all posters appear correctly in PVD without overwriting each other.
By following these steps, you can ensure that multiple posters are imported into PVD correctly while respecting its manual navigation and addition process.
Knowing all before your last message do you think you could Mimick manual actions with part2 to switch between slots, so part2 could be able to add multiple posters?
Steps to Mimic Manual Actions:
Simulate Clicking the Next Poster Button:
Use an AHK script to simulate the click on the nextposterbtn to switch to the next poster slot (e.g., from pos1 to pos2).
Add Poster URL:
Once the new slot is active, use the script to add the poster URL to that slot.
Detailed Plan:
Extract Poster URLs:
Extract the URLs from the IMDb gallery page.
Navigate and Add Posters:
For each extracted URL, navigate to the next poster slot and add the poster.
Example Pseudo-code for Part2:
Part 2: Adding Multiple Posters
pascal
// Ensure part1 completion
LogMessage('Function ParsePage smNormal END======================|');
Exit; // End of initial processing
// Part 2: Start new process for multiple posters
LogMessage('Starting process to download multiple posters');
// New URL and file path
NewURL := 'https://www.imdb.com/title/tt3461252/mediaindex';
NewDownloadFile := 'Tmp/multipage-UTF8_NO_BOM.htm';
// Download the new page using AHK script
FileExecute(ScriptPath+'PVdBDownPage.exe', '"'+NewURL+'" "'+ScriptPath+NewDownloadFile+'"');
// Wait for the new download to finish
While Not(FileExists(ScriptPath+NewDownloadFile)) Do Begin
wait (2000);
End;
// Process the new page for multiple posters
WebText := FileToString(ScriptPath+NewDownloadFile);
WebText := ConvertEncoding(WebText, 65001);
LogMessage('Downloaded multiple posters page');
// Extract and store multiple poster URLs
PosterURLs := ExtractPosterURLs(WebText); // Pseudo-function to parse and get poster URLs
// Function to simulate clicking the next poster button
procedure SimulateClickNextPosterButton();
begin
// Use AHK script to simulate the click
FileExecute('PathToAHKScript\click_next_poster_button.ahk', '');
end;
// Navigate and add each poster URL sequentially
For i := 0 to Length(PosterURLs) - 1 Do Begin
// Simulate clicking 'nextposterbtn' to navigate to the next poster slot
SimulateClickNextPosterButton();
// Add the poster URL to the current slot
AddCustomFieldValueByName('posterURL'+IntToStr(i), PosterURLs[i]);
AddCustomFieldValueByName('poster'+IntToStr(i), PosterURLs[i]); // Adjust as needed
End;
// Update poster count
AddCustomFieldValueByName('postercount', IntToStr(Length(PosterURLs)));
Steps for Creating AHK Script:
Create AHK Script:
Write an AHK script to simulate the click on the nextposterbtn.
ahk
; AHK script to simulate clicking the next poster button
ControlClick, nextposterbtn, ahk_class PVDWindowClass
return
Integrate AHK with Delphi/Pascal Script:
Ensure the Delphi/Pascal script calls the AHK script correctly to simulate the button click.
By following these steps and ensuring the AHK script correctly simulates the navigation actions, you can effectively add multiple posters to PVD as if done manually. This approach should work smoothly given the outlined process.
When and if I decide to do this, I will just paste this as my request, when I prepare the way to upload script, intermediate .html, .ahk etc.
What I achieved for now is to add my own custom field "IMDb Cast" which imports up to 15 actors from the principal page, out of PEOPLE_LIMIT in the script, and already to revise the code using AI, because meanwhile IMDb layout changed. I just pasted original snippet, gave to AI new IMDb layout, and in a second I got script corrected. I also achieved new custom "IMDb Directed by" snippet, populated as "A FILM BY MEL GIBSON" form, because I cannot position "A FILM BY " to the skin as I intend to because of the limitation of PVD, database and the nature of fields themselves. The peak of new skins (I'm creating 4 versions of it) is in the messages after this due to the limit of attachments. I'm posting my highly customized script too, if someone is interested in it, but I warn you that you have to add corresponding custom fields to PVD if you want your PVD to looks like this.
When you have further questions, just let me know. It is crucial we to share info if we want to save PVD.