Page 7 of 7
Re: Programmation questions
Posted: 2020-07-09 07:07:51
by antp
It uses the default non-unicode charset of the Windows settings, so in you case indeed windows-1252.
There are utf8encode and utf8decode functions to convert unicode characters from webpages, but of course those which do not exist in the local charset cannot be used in AMC fields: they will be replaced by "?"
Re: Programmation questions
Posted: 2020-07-13 17:26:06
by mrobama
antp wrote: 2020-07-09 07:07:51
It uses the default non-unicode charset of the Windows settings, so in you case indeed windows-1252.
There are utf8encode and utf8decode functions to convert unicode characters from webpages, but of course those which do not exist in the local charset cannot be used in AMC fields: they will be replaced by "?"
Thank you @Antp.
If I try to write "Η Έκσταση του Αίματος" in a field I can see it without any ?. I see "?" only if I save, close and reopen AMC. I think AMC use the default charset when saving, so here in Italy in old Windows it's windows-1252 charset. Question: if I change my default windows charset or if I use
https://archive.codeplex.com/?p=ntlea or
https://pooi.moe/Locale-Emulator/ and I set a unicode default charset, can I use UTF-8? Or windows-1252 charset is "hardcoded" in AMC?
[Update 14/07/2020 00:49] I just tried with Windows 10 and UTF8 enabled as default charset and I can save "Η Έκσταση του Αίματος" without problem. By the way, I have some encoding problem with translation: lng files have their own charset (all lng files use windows-1252), so some char is not displayed correctly in Windows 10.
Another question: to change Ant user agent (in getPage, ...) I added "http.Request.UserAgent=..." in my language file in [GetScriptWin] section. Can I change it in the ifs script? If I cannot set it, how can I get it (to check the value)?
Re: Programmation questions
Posted: 2020-07-14 04:13:19
by fulvio53s03
mrobama wrote: 2020-07-13 17:26:06
Another question: to change Ant user agent (in getPage, ...) I added "http.Request.UserAgent=..." in my language file in [GetScriptWin] section. Can I change it in the ifs script? If I cannot set it, how can I get it (to check the value)?
Did you see this
viewtopic.php?f=12&t=3557&hilit=UserAgent ?
on
2008-02-03 19:08:31 there was an answer to your first question by Antp.
It is old but Is it still valid?

Re: Programmation questions
Posted: 2020-07-14 09:33:39
by mrobama
fulvio53s03 wrote: 2020-07-14 04:13:19
mrobama wrote: 2020-07-13 17:26:06
Another question: to change Ant user agent (in getPage, ...) I added "http.Request.UserAgent=..." in my language file in [GetScriptWin] section. Can I change it in the ifs script? If I cannot set it, how can I get it (to check the value)?
Did you see this
viewtopic.php?f=12&t=3557&hilit=UserAgent ?
on
2008-02-03 19:08:31 there was an answer to your first question by Antp.
It is old but Is it still valid?
Hi Fulvio, That post is old. As I wrote, I can successfully change the user agent adding "http.Request.UserAgent" in italian.lng file. That's why I asked if I can change it inside an ifs file too.
Re: Programmation questions
Posted: 2020-07-14 20:40:51
by fulvio53s03
mrobama wrote: 2020-07-14 09:33:39
Hi Fulvio, That post is old. As I wrote, I can successfully change the user agent adding "http.Request.UserAgent" in italian.lng file. That's why I asked if I can change it inside an ifs file too.
Hi, Mr. President!

I know the post is old (2008) but there's nothing new about that argument (I think) and you joined the forum in 2009 so, may be, you never read it!

Re: Programmation questions
Posted: 2020-07-15 08:46:44
by antp
The charset of the lng files is the same as the one used by the program, the default one of Windows, as far as I remember I did not hardcode the 1252 anywhere.
The user agent can't be automatically overridden by a script because if a site blocks AMC, that should not be too easy to bypass (I want to avoid having problems with the sites

)
Re: Programmation questions
Posted: 2021-03-03 20:39:52
by fulvio53s03
I need informations about using files .pas
If I have a
script.ifs who
uses functions.pas.... can I
execute in my
functions.pas a procedure contained in
script.ifs?
... (just the opposite of what happens normally) ....

...and more....
my script uses functions1.pas and functions2.pas....
can they execute procedures each other?

Re: Programmation questions
Posted: 2021-03-04 12:48:36
by antp
Just try it

But I don't think that the included script can call things from the one which included it.
And I also don't think they can reciprocally include each other.
Re: Programmation questions
Posted: 2021-03-05 16:14:04
by fulvio53s03
antp wrote: 2021-03-04 12:48:36
Just try it

But I don't think that the included script can call things from the one which included it.
And I also don't think they can reciprocally include each other.
As usual, you are right and my strategy was just wrong.
thanks.

Re: Programmation questions
Posted: 2021-03-14 10:32:40
by fulvio53s03
Is it possible to show bold characters in a field?
i.e. How to show "Barcode and Other Identifiers" as
"Barcode and Other Identifiers"
Thanks.

Re: Programmation questions
Posted: 2021-03-16 06:14:51
by antp
Not possible, no
Re: Programmation questions
Posted: 2021-05-03 11:53:15
by zakk
[SOLVED]
Hello, I would like to know why
SetField(fieldMedia,countries); works,
but not
SetField(fieldCountry,countries);
Edit: my field was unticked

Re: Programmation questions
Posted: 2021-05-03 15:03:26
by yeti
Do you have activated "Script limitations" / "Modifiable fields" / "Country" on the right side of the script window?
Greets,
yeti
Re: Programmation questions
Posted: 2021-05-03 15:52:25
by zakk
OMG yes, I had the field unticked !
thanks, deleting previous post
Re: Programmation questions
Posted: 2025-07-06 23:27:45
by Jo_Sch
Hi antb
catalog format is XML
At set-up images are configured to be stored at a pics-sub-fulder of the catalog.
If I use:
IF GetPicture(imageURL) then
filename := GetPictureFullPath
ELSE
Error;
filename is empty and no picture at pics-folder of the catalog.
Same behaviour for GetExtraPicture...
After the script-loop is finished and the result is saved at the final dialog-window, the image is availabel at the pics-folder.
Question:
Is there a possibility to get the "future" filename of a downloaded image?
Regards
Josef
Re: Programmation questions
Posted: 2025-07-07 06:33:25
by antp
Hi,
Unfortunately no, as it will decide how to store the picture only when saving the script results to the movie record.
Re: Programmation questions
Posted: 2025-07-07 19:42:31
by Jo_Sch
Hi antb
Thank you for the quick answer.
Question based on your answer:
Is it possible to load a specific record into the script-work-space - e.g. based on fieldNumber (I use it as a unique identifier of a record).
If yes:
the first action at the script would be to load the previous record (based on a static parameter), pick up the filenames of the images (store them at a file - based on the content of a specific log-file), reload the original record and perform the normal actions of the script.
Background:
I would like to implement a method not to download images multiple times (save space) - e.g. people (director, actor,...)
Concept:
create a unique txt-filename base on the URL for image download.
in case of a new image:
create a file with the URL-based name.
Content of file is the filename (created by AMC) of the downloaded image.
Before using an image-URL for download I check, if the URL-based txt-filename already exists.
if Yes: read the filename of the image from the URL-based filename.
and instead of downloading the image again, assign the existing filename to the AMC-record (use function ImportExtraPicture instead of GetExtraPicture)
if No: download the image and create the URL-based file
Based on a log-file I check at script-start, if the image-files exists (the "save" at final dialog might be missed, or crash,..) to perform a clean-up.
Or do you know a concept which can be realized with the possibilities of the toolbox for scripts?
Regards
Josef
Re: Programmation questions
Posted: 2025-07-08 06:21:45
by antp
Hi,
Except if there is something added back then by Mickaël that I'm missing, it is not possible to control the progress between movies by script (you can only get the info on that you are on the n-th movie out of how many).
Re: Programmation questions
Posted: 2025-07-09 22:51:31
by Jo_Sch
Hi
If there is nothing available, I guess the simplest new implementation would be a 'repeat' command flag, which can be set (reset and read) within a script.
if set to ON (true) amc would NOT increment the movie (stay at same movie) after the script is finished.
At next script-run the movie would be the same (it also works for the last movie of the list).
Two additional flags (managed by amc) would be nice (option) - for script this are "read-only" parameters:
a: "RepeatingFlag": if true, current movie is same as previous one
b: "SaveDoneFlag' if true, it tells the script the movie data were saved at end of previous script-loop (independent from repeating)
With the optional "RepeatingFlag", amc would reset the 'repeat' command flag (for safety reason) before next script-start, and
also the save dialog at end of script will be not shown at a repeating movie, if there are no changes of the movie data.
Regards
Josef