Programmation questions

If you made a script you can offer it to the others here, or ask help to improve it. You can also report here bugs & problems with existing scripts.
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Programmation questions

Post 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 "?"
mrobama
Posts: 85
Joined: 2009-04-03 12:34:34

Re: Programmation questions

Post 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)?
fulvio53s03
Posts: 744
Joined: 2007-04-28 05:46:43
Location: Italy

Re: Programmation questions

Post 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?
:??:
mrobama
Posts: 85
Joined: 2009-04-03 12:34:34

Re: Programmation questions

Post 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.
fulvio53s03
Posts: 744
Joined: 2007-04-28 05:46:43
Location: Italy

Re: Programmation questions

Post 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!
:ha: :innocent: :grinking:
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Programmation questions

Post 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 :D)
fulvio53s03
Posts: 744
Joined: 2007-04-28 05:46:43
Location: Italy

Re: Programmation questions

Post 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?
:wow:
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Programmation questions

Post by antp »

Just try it :D
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.
fulvio53s03
Posts: 744
Joined: 2007-04-28 05:46:43
Location: Italy

Re: Programmation questions

Post by fulvio53s03 »

antp wrote: 2021-03-04 12:48:36 Just try it :D
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.
;)
fulvio53s03
Posts: 744
Joined: 2007-04-28 05:46:43
Location: Italy

Re: Programmation questions

Post 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.
:)
antp
Site Admin
Posts: 9629
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Programmation questions

Post by antp »

Not possible, no
zakk
Posts: 28
Joined: 2008-11-26 20:41:22

Re: Programmation questions

Post by zakk »

[SOLVED]
Hello, I would like to know why SetField(fieldMedia,countries); works,
but not SetField(fieldCountry,countries);

Edit: my field was unticked :(
Last edited by zakk on 2021-05-03 15:54:32, edited 2 times in total.
yeti
Posts: 60
Joined: 2003-09-14 15:50:05

Re: Programmation questions

Post by yeti »

Do you have activated "Script limitations" / "Modifiable fields" / "Country" on the right side of the script window?

Greets,
yeti
zakk
Posts: 28
Joined: 2008-11-26 20:41:22

Re: Programmation questions

Post by zakk »

OMG yes, I had the field unticked !
thanks, deleting previous post
Post Reply