These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

What is wrong in my code?

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Answered

Hi,
 
this is a JavaScript that should displays a pop-up menu (countries of the world, in French language) but when I validate it the console always answer : SyntaxError: unterminated string literal
1:
 
I cannot found what is wrong, can someone helps me?
Here is my code:
 
var reply = app.popUpMenu(["A","AFGHANISTAN","AFRIQUE DU SUD","ÅLAND, ÎLES","ALBANIE","ALGÉRIE","ALLEMAGNE","ANDORRE","ANGOLA","ANGUILLA","ANTARCTIQUE","ANTIGUA-ET-BARBUDA","ARABIE SAOUDITE","ARGENTINE","ARMÉNIE","ARUBA","AUSTRALIE","AUTRICHE","AZERBAÏDJAN"],["B","BAHAMAS","BAHREÏN","BANGLADESH","BARBADE","BÉLARUS","BELGIQUE","BELIZE","BÉNIN","BERMUDES","BHOUTAN","BOLIVIE, l’ÉTAT PLURINATIONAL DE","BONAIRE, SAINT-EUSTACHE ET SABA","BOSNIE-HERZÉGOVINE","BOTSWANA","BOUVET, ÎLE","BRÉSIL","BRUNEI DARUSSALAM","BULGARIE","BURKINA FASO","BURUNDI"],["C","CAÏMANS, ÎLES","CAMBODGE","CAMEROUN","CANADA","CAP-VERT","CENTRAFRICAINE, RÉPUBLIQUE","CHILI","CHINE","CHRISTMAS, ÎLE","CHYPRE","COCOS, ÎLES","COLOMBIE","COMORES","CONGO","CONGO, LA RÉPUBLIQUE DÉMOCRATIQUE DU","COOK, ÎLES","CORÉE, RÉPUBLIQUE DE","CORÉE, RÉPUBLIQUE POPULAIRE DÉMOCRATIQUE DE","COSTA RICA","CÔTE D’IVOIRE","CROATIE","CUBA","CURAÇAO"],["D","DANEMARK","DJIBOUTI","DOMINICAINE, RÉPUBLIQUE","DOMINIQUE"],["E","ÉGYPTE","EL SALVADOR","ÉMIRATS ARABES UNIS","ÉQUATEUR","ÉRYTHRÉE","ESPAGNE","ESTONIE","ÉTATS-UNIS","ÉTHIOPIE"],["F","FALKLAND, ÎLES ","FÉROÉ, ÎLES","FIDJI","FINLANDE","FRANCE"],["G","GABON","GAMBIE","GÉORGIE","GÉORGIE-DU-SUD ET LES ÎLES SANDWICH DU SUD","GHANA","GIBRALTAR","GRÈCE","GRENADE","GROENLAND","GUADELOUPE","GUAM","GUATEMALA","GUERNESEY","GUINÉE","GUINÉE-BISSAU","GUINÉE ÉQUATORIALE","GUYANA","GUYANE FRANÇAISE"],["H","HAÏTI","HEARD-ET-ÎLES MACDONALD, ÎLE","HONDURAS","HONG-KONG","HONGRIE"],["I","ÎLE DE MAN","ÎLES MINEURES ÉLOIGNÉES DES ÉTATS-UNIS","ÎLES VIERGES - UK","ÎLES VIERGES - USA","INDE","INDONÉSIE","IRAN, RÉPUBLIQUE ISLAMIQUE D’","IRAQ","IRLANDE","ISLANDE","ISRAËL","ITALIE"],["J","JAMAÏQUE","JAPON","JERSEY","JORDANIE"],["K","KAZAKHSTAN","KENYA","KIRGHIZISTAN","KIRIBATI","KOWEÏT"],["L","LAOS, RÉPUBLIQUE DÉMOCRATIQUE POPULAIRE","LESOTHO","LETTONIE","LIBAN","LIBÉRIA","LIBYENNE, JAMAHIRIYA ARABE","LIECHTENSTEIN","LITUANIE","LUXEMBOURG"],["M","MACAO","MACÉDOINE, L’EX-RÉPUBLIQUE YOUGOSLAVE DE","MADAGASCAR","MALAISIE","MALAWI","MALDIVES","MALI","MALTE","MARIANNES DU NORD, ÎLES","MAROC","MARSHALL, ÎLES","MARTINIQUE","MAURICE","MAURITANIE","MAYOTTE","MEXIQUE","MICRONÉSIE, ÉTATS FÉDÉRÉS DE","MOLDOVA, RÉPUBLIQUE DE","MONACO","MONGOLIE","MONTÉNÉGRO","MONTSERRAT","MOZAMBIQUE","MYANMAR"],["N","NAMIBIE","NAURU","NÉPAL","NICARAGUA","NIGER","NIGÉRIA","NIUÉ","NORFOLK, ÎLE","NORVÈGE","NOUVELLE-CALÉDONIE","NOUVELLE-ZÉLANDE"],["O","OCÉAN INDIEN, TERRITOIRE BRITANNIQUE DE L’","OMAN","OUGANDA","OUZBÉKISTAN"],["P","PAKISTAN","PALAOS","PALESTINIEN, TERRITOIRE OCCUPÉ","PANAMA","PAPOUASIE-NOUVELLE-GUINÉE","PARAGUAY","PAYS-BAS","PÉROU","PHILIPPINES","PITCAIRN","POLOGNE","POLYNÉSIE FRANÇAISE","PORTO RICO","PORTUGAL"],["Q","QATAR"],["R","RÉUNION","ROUMANIE","ROYAUME-UNI","RUSSIE, FÉDÉRATION DE","RWANDA"],["S","SAHARA OCCIDENTAL","SAINT-BARTHÉLEMY","SAINTE-HÉLÈNE, ASCENSION ET TRISTAN DA CUNHA","SAINTE-LUCIE","SAINT-KITTS ET NEVIS","SAINT-MARIN","SAINT-MARTIN - FR","SAINT-MARTIN - NL","SAINT-PIERRE-ET-MIQUELON","SAINT-SIÈGE - ÉTAT DE LA CITÉ DU VATICAN","SAINT-VINCENT ET LES GRENADINES","SALOMON, ÎLES","SAMOA","SAMOA AMÉRICAINES","SAO TOMÉ-ET-PRINCIPE","SÉNÉGAL","SERBIE","SEYCHELLES","SIERRA LEONE","SINGAPOUR","SLOVAQUIE","SLOVÉNIE","SOMALIE","SOUDAN","SOUDAN DU SUD","SRI LANKA","SUÈDE","SUISSE","SURINAME","SVALBARD ET ÎLE JAN MAYEN","SWAZILAND","SYRIENNE, RÉPUBLIQUE ARABE"],["T","TADJIKISTAN","TAÏWAN, PROVINCE DE CHINE","TANZANIE, RÉPUBLIQUE-UNIE DE","TCHAD","TCHÈQUE, RÉPUBLIQUE","TERRES AUSTRALES FRANÇAISES","THAÏLANDE","TIMOR-LESTE","TOGO","TOKELAU","TONGA","TRINITÉ-ET-TOBAGO","TUNISIE","TURKMÉNISTAN","TURKS-ET-CAÏCOS, ÎLES","TURQUIE","TUVALU"],["U","UKRAINE","URUGUAY"],["V","VANUATU","VÉNÉZUELA, RÉPUBLIQUE BOLIVARIENNE DU","VIET NAM"],["W","WALLIS ET FUTUNA"],["Y","YÉMEN"],["Z","ZAMBIE","ZIMBABWE"]);
if (reply!=null) {event.target.value = reply;}

My Product Information:
Acrobat Pro 10.1, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Works fine for me...
My guess is that at some point you've used a non-standard quotes (probably because you're using the French keyboard settings), and Acrobat does not like that.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Accepted Answer
Thanks Try67.

I replaced all accentued character by their Unicode code and remove all comas inside items : it works fine now !

;-)

Here is my new code :

var reply = app.popUpMenu(["A","AFGHANISTAN","AFRIQUE DU SUD","\u00C5LAND \(\u00CELES\)","ALBANIE","ALG\u00C9RIE","ALLEMAGNE","ANDORRE","ANGOLA","ANGUILLA","ANTARCTIQUE","ANTIGUA-ET-BARBUDA","ARABIE SAOUDITE","ARGENTINE","ARM\u00C9NIE","ARUBA","AUSTRALIE","AUTRICHE","AZERBA\u00CFDJAN"],["B","BAHAMAS","BAHRE\u00CFN","BANGLADESH","BARBADE","B\u00C9LARUS","BELGIQUE","BELIZE","B\u00C9NIN","BERMUDES","BHOUTAN","BOLIVIE \(\u00C9TAT PLURINATIONAL DE\)","BONAIRE \(SAINT-EUSTACHE ET SABA\)","BOSNIE-HERZ\u00C9GOVINE","BOTSWANA","BOUVET \(\u00CELE\)","BR\u00C9SIL","BRUNEI DARUSSALAM","BULGARIE","BURKINA FASO","BURUNDI"],["C","CA\u00CFMANS \(\u00CELES\)","CAMBODGE","CAMEROUN","CANADA","CAP-VERT","CENTRAFRICAINE \(R\u00C9PUBLIQUE\)","CHILI","CHINE","CHRISTMAS \(\u00CELE\)","CHYPRE","COCOS \(\u00CELES\)","COLOMBIE","COMORES","CONGO","CONGO \(R\u00C9PUBLIQUE D\u00C9MOCRATIQUE DU\)","COOK \(\u00CELES\)","COR\u00C9E \(R\u00C9PUBLIQUE DE\)","COR\u00C9E \(R\u00C9PUBLIQUE POPULAIRE D\u00C9MOCRATIQUE DE\)","COSTA RICA","CÔTE D’IVOIRE","CROATIE","CUBA","CURAÇAO"],["D","DANEMARK","DJIBOUTI","DOMINICAINE \(R\u00C9PUBLIQUE\)","DOMINIQUE"],["E","\u00C9GYPTE","EL SALVADOR","\u00C9MIRATS-ARABES-UNIS","\u00C9QUATEUR","\u00C9RYTHR\u00C9E","ESPAGNE","ESTONIE","\u00C9TATS-UNIS","\u00C9THIOPIE"],["F","FALKLAND \(\u00CELES\)","F\u00C9RO\u00C9 \(\u00CELES\)","FIDJI","FINLANDE","FRANCE"],["G","GABON","GAMBIE","G\u00C9ORGIE","G\u00C9ORGIE-DU-SUD ET LES \u00CELES SANDWICH-DU-SUD","GHANA","GIBRALTAR","GR\u00C8CE","GRENADE","GROENLAND","GUADELOUPE","GUAM","GUATEMALA","GUERNESEY","GUIN\u00C9E","GUIN\u00C9E-BISSAU","GUIN\u00C9E \u00C9QUATORIALE","GUYANA","GUYANE FRANÇAISE"],["H","HA\u00CFTI","HEARD ET \u00CELES MACDONALD","HONDURAS","HONG-KONG","HONGRIE"],["I","\u00CELE DE MAN","\u00CELES MINEURES \(\u00C9LOIGN\u00C9ES DES \u00C9TATS-UNIS\)","\u00CELES VIERGES \(UK\)","\u00CELES VIERGES \(USA\)","INDE","INDON\u00C9SIE","IRAN \(R\u00C9PUBLIQUE ISLAMIQUE DE\)","IRAQ","IRLANDE","ISLANDE","ISRA\u00CBL","ITALIE"],["J","JAMA\u00CFQUE","JAPON","JERSEY","JORDANIE"],["K","KAZAKHSTAN","KENYA","KIRGHIZISTAN","KIRIBATI","KOWE\u00CFT"],["L","LAOS \(R\u00C9PUBLIQUE D\u00C9MOCRATIQUE POPULAIRE\)","LESOTHO","LETTONIE","LIBAN","LIB\u00C9RIA","LIBYENNE \(JAMAHIRIYA ARABE\)","LIECHTENSTEIN","LITUANIE","LUXEMBOURG"],["M","MACAO","MAC\u00C9DOINE \(EX-R\u00C9PUBLIQUE YOUGOSLAVE DE\)","MADAGASCAR","MALAISIE","MALAWI","MALDIVES","MALI","MALTE","MARIANNES DU NORD \(\u00CELES\)","MAROC","MARSHALL \(\u00CELES)","MARTINIQUE","MAURICE","MAURITANIE","MAYOTTE","MEXIQUE","MICRON\u00C9SIE \(\u00C9TATS F\u00C9D\u00C9R\u00C9S DE\)","MOLDOVA \(R\u00C9PUBLIQUE DE\)","MONACO","MONGOLIE","MONT\u00C9N\u00C9GRO","MONTSERRAT","MOZAMBIQUE","MYANMAR"],["N","NAMIBIE","NAURU","N\u00C9PAL","NICARAGUA","NIGER","NIG\u00C9RIA","NIU\u00C9","NORFOLK \(\u00CELE\)","NORV\u00C8GE","NOUVELLE-CAL\u00C9DONIE","NOUVELLE-Z\u00C9LANDE"],["O","OC\u00C9AN INDIEN \(TERRITOIRE BRITANNIQUE DE\)","OMAN","OUGANDA","OUZB\u00C9KISTAN"],["P","PAKISTAN","PALAOS","PALESTINIEN \(TERRITOIRE OCCUP\u00C9)","PANAMA","PAPOUASIE-NOUVELLE-GUIN\u00C9E","PARAGUAY","PAYS-BAS","P\u00C9ROU","PHILIPPINES","PITCAIRN","POLOGNE","POLYN\u00C9SIE FRANÇAISE","PORTO RICO","PORTUGAL"],["Q","QATAR"],["R","R\u00C9UNION","ROUMANIE","ROYAUME-UNI","RUSSIE \(F\u00C9D\u00C9RATION DE\)","RWANDA"],["S","SAHARA OCCIDENTAL","SAINT-BARTH\u00C9LEMY","SAINTE-H\u00C9L\u00C8NE \(ASCENSION ET TRISTAN-DA-CUNHA\)","SAINTE-LUCIE","SAINT-KITTS ET NEVIS","SAINT-MARIN","SAINT-MARTIN - FR","SAINT-MARTIN - NL","SAINT-PIERRE-ET-MIQUELON","SAINT-SI\u00C8GE - \(\u00C9TAT DE LA CIT\u00C9 DU VATICAN\)","SAINT-VINCENT ET LES GRENADINES","SALOMON \(\u00CELES\)","SAMOA","SAMOA AM\u00C9RICAINES","SAO-TOM\u00C9 ET PRINCIPE","S\u00C9N\u00C9GAL","SERBIE","SEYCHELLES","SIERRA LEONE","SINGAPOUR","SLOVAQUIE","SLOV\u00C9NIE","SOMALIE","SOUDAN","SOUDAN DU SUD","SRI LANKA","SU\u00C8DE","SUISSE","SURINAME","SVALBARD ET \u00CELE JAN MAYEN","SWAZILAND","SYRIENNE \(R\u00C9PUBLIQUE ARABE\)"],["T","TADJIKISTAN","TA\u00CFWAN \(PROVINCE DE CHINE\)","TANZANIE \(R\u00C9PUBLIQUE UNIE DE\)","TCHAD","TCH\u00C8QUE \(R\u00C9PUBLIQUE\)","TERRES AUSTRALES FRANÇAISES","THA\u00CFLANDE","TIMOR-LESTE","TOGO","TOKELAU","TONGA","TRINIT\u00C9-ET-TOBAGO","TUNISIE","TURKM\u00C9NISTAN","TURKS-ET-CA\u00CFCOS \(\u00CELES\)","TURQUIE","TUVALU"],["U","UKRAINE","URUGUAY"],["V","VANUATU","V\u00C9N\u00C9ZUELA \(R\u00C9PUBLIQUE BOLIVARIENNE DU\)","VIET NAM"],["W","WALLIS ET FUTUNA"],["Y","Y\u00C9MEN"],["Z","ZAMBIE","ZIMBABWE"]);if (reply!=null) {event.target.value = reply;}



try67
Expert
Registered: Oct 30 2008
Posts: 2398
That's good, although the original code you posted worked for me as well...

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Yes, it works on the Windows version of Acrobat 10.1.1, but not on my Mac version…
:-(