Copy link to clipboard
Copied
Hi,
I've placed a Word document that has loads of irritating Unicode markers
(left-to-right etc.)
There is no way that I can see of using the UI to search and delete
these characters.
The unicode value of these markers is: 0x200E as it appears from the
Info palette, but that Unicode value is shared by various things.
Selecting a marker and get its contents (app.selection[0].contents)
returns the number: 1399616109. This is in fact the number for
SpecialCharacters.LEFT_TO_RIGHT_MARK.
To cut a long story short and make a specific question general:
How do you search for a SpecialCharacter that doesn't have an escape
code in the GREP find/replace?
What I've done so far is looped through all the characters in the
document and compared their contents to 1399616109. But this is very
slow, and is also causing InDesign to crash.
Is there a better way?
Thanks,
Ariel
Copy link to clipboard
Copied
No, My Mac's a Brit
Copy link to clipboard
Copied
How abouts
if (!$.dictionary) $.dictionaryCS6Mac = {
classes: ['Assignment', 'Assignments', 'AssignedStory', 'AssignedStories', 'PrintEvent', 'PlaceGun', 'EventListener', 'EventListeners', 'Event', 'Events', 'IdleEvent', 'MutationEvent', 'IdleTask', 'IdleTasks', 'ScriptArg', 'Application', 'BackgroundTask', 'BackgroundTasks', 'Document', 'Documents', 'Window', 'Windows', 'LayoutWindow', 'LayoutWindows', 'StoryWindow', 'StoryWindows', 'DocumentEvent', 'ImportExportEvent', 'ContentPlacerObject', 'Book', 'Books', 'BookContent', 'BookContents', 'Ink', 'Inks', 'TrapPreset', 'TrapPresets', 'MixedInk', 'MixedInks', 'MixedInkGroup', 'MixedInkGroups', 'Gradient', 'Gradients', 'GradientStop', 'GradientStops', 'Swatch', 'Swatches', 'Color', 'Colors', 'Tint', 'Tints', 'OpacityGradientStop', 'OpacityGradientStops', 'DataMergeTextPlaceholder', 'DataMergeTextPlaceholders', 'DataMergeImagePlaceholder', 'DataMergeImagePlaceholders', 'DataMergeField', 'DataMergeFields', 'StoryTypes', 'StoryDirectionOptions', 'ImportFormat', 'NestedStyleDelimiters', 'RuleWidth', 'Justification', 'SingleWordJustification', 'StartParagraph', 'HorizontalOrVertical', 'TabStopAlignment', 'FirstBaseline', 'VerticalJustification', 'Leading', 'OTFFigureStyle', 'Capitalization', 'Position', 'TextFrameContents', 'SpecialCharacters', 'ChangecaseMode', 'BindingOptions', 'PageOrientation', 'RulerOrigin', 'MeasurementUnits', 'PageBindingOptions', 'BaselineGridRelativeOption', 'PageSideOptions', 'WhenScalingOptions', 'PageColorOptions', 'DocumentIntentOptions', 'LayoutRuleOptions', 'SnapshotBlendingModes', 'EPSColorSpace', 'PreviewTypes', 'FontEmbedding', 'ScaleModes', 'PrintLayerOptions', 'UITools', 'GlobalClashResolutionStrategyForMasterPage', 'ClippingPathType', 'UpdateLinkOptions', 'IconSizes', 'PanelLayoutResize', 'PageViewOptions', 'PDFColorSpace', 'AcrobatCompatibility', 'ICCProfiles', 'BitmapCompression', 'CompressionQuality', 'MonoBitmapCompression', 'PDFMarkWeight', 'Sampling', 'ExportPresetFormat', 'PDFCrop', 'PDFCompressionType', 'PDFProfileSelector', 'PDFXStandards', 'ExportLayerOptions', 'PdfMagnificationOptions', 'PageLayoutOptions', 'RasterResolutionOptions', 'PDFRasterCompressionOptions', 'PDFJPEGQualityOptions', 'InteractiveElementsOptions', 'InteractivePDFInteractiveElementsOptions', 'PageTransitionOverrideOptions', 'TaggedPDFStructureOrderOptions', 'ConvertShapeOptions', 'CoordinateSpaces', 'MatrixContent', 'BoundingBoxLimits', 'ResizeConstraints', 'ResizeMethods', 'EmptyFrameFittingOptions', 'CornerOptions', 'DimensionsConstraints', 'ContentType', 'EndCap', 'EndJoin', 'StrokeCornerAdjustment', 'ArrowHead', 'DisplaySettingOptions', 'FitOptions', 'StrokeAlignment', 'GuideTypeOptions', 'ContourOptionsTypes', 'TextWrapSideOptions', 'TextWrapModes', 'FontStatus', 'FontTypes', 'OpenTypeFeature', 'CharacterAlignment', 'AlternateGlyphForms', 'AdornmentOverprint', 'KentenCharacter', 'RubyKentenPosition', 'KentenCharacterSet', 'RubyTypes', 'RubyAlignments', 'RubyParentSpacing', 'RubyOverhang', 'WarichuAlignment', 'KinsokuType', 'KinsokuHangTypes', 'LeadingModel', 'KinsokuSet', 'MojikumiTableDefaults', 'GridAlignment', 'KentenAlignment', 'ComposeUsing', 'PageNumberStyle', 'PaginationOption', 'GradientType', 'JoinOptions', 'PathType', 'PointType', 'CreateProxy', 'ImportedPageCropOptions', 'StrokeFillProxyOptions', 'StrokeFillTargetOptions', 'RotationDirection', 'LocationOptions', 'UIColors', 'NothingEnum', 'AutoEnum', 'EventPhases', 'ExportFormat', 'PlacedVectorProfilePolicy', 'ColorSettingsPolicy', 'DefaultRenderingIntent', 'ProofingType', 'ChangeConditionsModes', 'SearchModes', 'ObjectTypes', 'FindChangeTransliterateCharacterTypes', 'LibraryPanelViews', 'SortAssets', 'LinkStatus', 'AssetType', 'ChangeTypes', 'TextPathEffects', 'TextTypeAlignments', 'PathTypeAlignments', 'FlipValues', 'XMLElementLocation', 'XMLElementPosition', 'XMLImportStyles', 'XMLFileEncoding', 'ImageConversion', 'GIFOptionsPalette', 'JPEGOptionsQuality', 'JPEGOptionsFormat', 'XMLExportUntaggedTablesFormat', 'XMLTransformFile', 'AnchorPosition', 'HorizontalAlignment', 'VerticalAlignment', 'AnchoredRelativeTo', 'BalanceLinesStyle', 'VerticallyRelativeTo', 'PositionalForms', 'TextStrokeAlign', 'OutlineJoin', 'BaselineFrameGridRelativeOption', 'FootnoteFirstBaseline', 'FootnoteRestarting', 'FootnotePrefixSuffix', 'FootnoteNumberingStyle', 'FootnoteMarkerPositioning', 'OverrideType', 'GlobalClashResolutionStrategy', 'StoryHorizontalOrVertical', 'AddPageOptions', 'VariableTypes', 'VariableScopes', 'VariableNumberingStyles', 'SearchStrategies', 'ChangeCaseOptions', 'AutoSizingTypeEnum', 'AutoSizingReferenceEnum', 'SpanColumnTypeOptions', 'SpanColumnCountOptions', 'LineAlignment', 'GridViewSettings', 'CharacterCountLocation', 'InCopyUIColors', 'CursorTypes', 'AntiAliasType', 'LineSpacingType', 'RepaginateOption', 'BookContentStatus', 'SmartMatchOptions', 'RowTypes', 'HeaderFooterBreakTypes', 'AlternatingFillsTypes', 'StrokeOrderTypes', 'DisplayOrderOptions', 'FlattenerLevel', 'BlendingSpace', 'BlendMode', 'ShadowMode', 'FeatherMode', 'FeatherCornerType', 'SpreadFlattenerLevel', 'GlowTechnique', 'InnerGlowSource', 'BevelAndEmbossStyle', 'BevelAndEmbossTechnique', 'BevelAndEmbossDirection', 'FollowShapeModeOptions', 'PageNumberPosition', 'NumberedParagraphsOptions', 'TextImportCharacterSet', 'ImportPlatform', 'ConvertPageBreaks', 'TagTextExportCharacterSet', 'TagTextForm', 'StyleConflict', 'TextExportCharacterSet', 'ConvertTablesOptions', 'TableFormattingOptions', 'AlignmentStyleOptions', 'ResolveStyleClash', 'ContainerType', 'CopyrightStatus', 'IndexCapitalizationOptions', 'IndexFormat', 'CrossReferenceType', 'PageReferenceType', 'HeaderTypes', 'TagTransparency', 'TagVector', 'TagRaster', 'HyperlinkAppearanceHighlight', 'HyperlinkAppearanceWidth', 'HyperlinkAppearanceStyle', 'HyperlinkDestinationPageSetting', 'BuildingBlockTypes', 'RangeSortOrder', 'PreflightRuleFlag', 'RuleDataType', 'PreflightScopeOptions', 'PreflightLayerOptions', 'PreflightProfileOptions', 'PNGExportRangeEnum', 'PNGQualityEnum', 'PNGColorSpaceEnum', 'StateTypes', 'FloatingWindowPosition', 'FloatingWindowSize', 'MoviePosterTypes', 'MoviePlayOperations', 'SoundPosterTypes', 'BehaviorEvents', 'GoToZoomOptions', 'PlayOperations', 'AnimationPlayOperations', 'ViewZoomStyle', 'VersionState', 'EditingState', 'VersionCueSyncStatus', 'SyncConflictResolution', 'LanguageAndRegion', 'UserInteractionLevels', 'Locale', 'ScriptLanguage', 'FeatureSetOptions', 'UndoModes', 'OpenOptions', 'TaskState', 'TaskAlertType', 'SaveOptions', 'ZoomOptions', 'ViewDisplaySettings', 'AnchorPoint', 'ColorModel', 'ColorSpace', 'ScreenModeOptions', 'WatermarkVerticalPositionEnum', 'WatermarkHorizontalPositionEnum', 'PageNumberingOptions', 'ToolTipOptions', 'SelectionOptions', 'SelectAll', 'PreviewSizeOptions', 'ToolsPanelOptions', 'LiveDrawingOptions', 'PreviewPagesOptions', 'StaticAlignmentOptions', 'RenderingIntent', 'MarkLineWeight', 'MarkTypes', 'ColorOutputModes', 'DataFormat', 'Flip', 'FontDownloading', 'PagePositions', 'PostScriptLevels', 'PrintPageOrientation', 'ImageDataTypes', 'Sequences', 'SourceSpaces', 'ThumbsPerPage', 'TilingTypes', 'Trapping', 'InkTypes', 'PrinterPresetTypes', 'ColorRenderingDictionary', 'PageRange', 'PaperSize', 'PPDValues', 'Profile', 'Screeening', 'PaperSizes', 'Printer', 'TrapImagePlacementTypes', 'TrapEndTypes', 'EPSImageData', 'BookletTypeOptions', 'SignatureSizeOptions', 'DocumentPrintUiOptions', 'NoteBackgrounds', 'NoteColorChoices', 'ChangeMarkings', 'ChangebarLocations', 'ChangeTextColorChoices', 'ChangeBackgroundColorChoices', 'LockStateValues', 'JpegColorSpaceEnum', 'ExportRangeOrAllPages', 'RecordSelection', 'ArrangeBy', 'RecordsPerPage', 'Fitting', 'SourceFieldType', 'ListType', 'BulletCharacterType', 'NumberingStyle', 'RestartPolicy', 'ListAlignment', 'ChapterNumberSources', 'CustomLayoutTypeEnum', 'AssignmentExportOptions', 'AssignmentStatus', 'PanningTypes', 'AlignDistributeBounds', 'AlignOptions', 'DistributeOptions', 'SourceType', 'TagType', 'ImageFormat', 'ImageSizeOption', 'ImageResolution', 'ImageAlignmentType', 'ImagePageBreakType', 'PerformanceMetricOptions', 'SWFBackgroundOptions', 'XFLRasterizeFormatOptions', 'AnimationEaseOptions', 'DynamicTriggerEvents', 'PageTransitionTypeOptions', 'PageTransitionDirectionOptions', 'RasterCompressionOptions', 'DynamicDocumentsJPEGQualityOptions', 'DynamicDocumentsTextExportPolicy', 'FitMethodSettings', 'FitDimension', 'PageTransitionDurationOptions', 'SWFCurveQualityValue', 'DynamicMediaHandlingOptions', 'DesignOptions', 'ConditionIndicatorMethod', 'ConditionUnderlineIndicatorAppearance', 'ConditionIndicatorMode', 'SmoothScrollingOptions', 'FolioOrientationOptions', 'FolioBindingDirectionOptions', 'DigpubVersion', 'AttachedDevices', 'DigpubArticleVersion', 'ExportOrder', 'EpubCover', 'BulletListExportOption', 'NumberedListExportOption', 'StyleSheetExportOption', 'EpubVersion', 'ImageExportOption', 'MapType', 'ParagraphDirectionOptions', 'ParagraphJustificationOptions', 'CharacterDirectionOptions', 'DigitsTypeOptions', 'KashidasOptions', 'DiacriticPositionOptions', 'TableDirectionOptions', 'Hyperlink', 'Hyperlinks', 'Bookmark', 'Bookmarks', 'HyperlinkPageItemSource', 'HyperlinkPageItemSources', 'HyperlinkTextSource', 'HyperlinkTextSources', 'HyperlinkTextDestination', 'HyperlinkTextDestinations', 'HyperlinkPageDestination', 'HyperlinkPageDestinations', 'HyperlinkExternalPageDestination', 'HyperlinkExternalPageDestinations', 'HyperlinkURLDestination', 'HyperlinkURLDestinations', 'CrossReferenceFormat', 'CrossReferenceFormats', 'CrossReferenceSource', 'CrossReferenceSources', 'BuildingBlock', 'BuildingBlocks', 'ParagraphDestination', 'ParagraphDestinations', 'Index', 'Indexes', 'IndexOptions', 'Topic', 'Topics', 'CrossReference', 'CrossReferences', 'PageReference', 'PageReferences', 'IndexSection', 'IndexSections', 'FormField', 'FormFields', 'Button', 'Buttons', 'State', 'States', 'MultiStateObject', 'MultiStateObjects', 'CheckBox', 'CheckBoxes', 'ComboBox', 'ComboBoxes', 'ListBox', 'ListBoxes', 'RadioButton', 'RadioButtons', 'TextBox', 'TextBoxes', 'SignatureField', 'SignatureFields', 'Movie', 'Movies', 'NavigationPoint', 'NavigationPoints', 'Sound', 'Sounds', 'Behavior', 'Behaviors', 'GotoFirstPageBehavior', 'GotoFirstPageBehaviors', 'GotoLastPageBehavior', 'GotoLastPageBehaviors', 'GotoNextPageBehavior', 'GotoNextPageBehaviors', 'GotoPreviousPageBehavior', 'GotoPreviousPageBehaviors', 'GotoNextViewBehavior', 'GotoNextViewBehaviors', 'GotoPreviousViewBehavior', 'GotoPreviousViewBehaviors', 'GotoURLBehavior', 'GotoURLBehaviors', 'MovieBehavior', 'MovieBehaviors', 'ShowHideFieldsBehavior', 'ShowHideFieldsBehaviors', 'AnimationBehavior', 'AnimationBehaviors', 'OpenFileBehavior', 'OpenFileBehaviors', 'GotoNextStateBehavior', 'GotoNextStateBehaviors', 'GotoPreviousStateBehavior', 'GotoPreviousStateBehaviors', 'GotoStateBehavior', 'GotoStateBehaviors', 'ViewZoomBehavior', 'ViewZoomBehaviors', 'SoundBehavior', 'SoundBehaviors', 'GotoAnchorBehavior', 'GotoAnchorBehaviors', 'GotoPageBehavior', 'GotoPageBehaviors', 'ClearFormBehavior', 'ClearFormBehaviors', 'PrintFormBehavior', 'PrintFormBehaviors', 'SubmitFormBehavior', 'SubmitFormBehaviors', 'TimingSetting', 'TimingList', 'TimingLists', 'TimingGroup', 'TimingGroups', 'TimingTarget', 'TimingTargets', 'Layer', 'Layers', 'Spread', 'Spreads', 'Page', 'Pages', 'MasterSpread', 'MasterSpreads', 'PDFAttribute', 'PageItem', 'PageItems', 'Oval', 'Ovals', 'Rectangle', 'Rectangles', 'GraphicLine', 'GraphicLines', 'Polygon', 'Polygons', 'Group', 'Groups', 'Image', 'Images', 'EPS', 'EPSs', 'PDF', 'PDFs', 'WMF', 'WMFs', 'PICT', 'PICTs', 'Graphic', 'Graphics', 'TransformationMatrix', 'TransformationMatrices', 'FrameFittingOption', 'Guide', 'Guides', 'TextWrapPreference', 'ContourOption', 'Section', 'Sections', 'Path', 'Paths', 'PathPoint', 'PathPoints', 'SplineItem', 'SplineItems', 'EPSText', 'EPSTexts', 'ImportedPage', 'ImportedPages', 'MediaItem', 'MediaItems', 'Snippet', 'Snippets', 'MotionPreset', 'MotionPresets', 'Article', 'Articles', 'ArticleMember', 'ArticleMembers', 'ArticleChild', 'ArticleChildren', 'HtmlItem', 'HtmlItems', 'Library', 'Libraries', 'Asset', 'Assets', 'Link', 'Links', 'LinkMetadata', 'ObjectStyle', 'ObjectStyles', 'StoryPreference', 'TextFramePreference', 'TextPreference', 'TextDefault', 'DocumentPreference', 'GridPreference', 'GuidePreference', 'MarginPreference', 'PasteboardPreference', 'ViewPreference', 'DocumentPreset', 'DocumentPresets', 'PrintPreference', 'PrintBookletOption', 'PrintBookletPrintPreference', 'EPSExportPreference', 'ToolBox', 'ImagePreference', 'ImageIOPreference', 'ClippingPathSettings', 'GraphicLayerOption', 'GraphicLayer', 'GraphicLayers', 'IMEPreference', 'PDFExportPreference', 'PDFExportPreset', 'PDFExportPresets', 'PDFPlacePreference', 'InteractivePDFExportPreference', 'TaggedPDFPreference', 'PageItemDefault', 'ObjectExportOption', 'TextEditingPreference', 'MojikumiUiPreference', 'FontLockingPreference', 'DictionaryPreference', 'PolygonPreference', 'SpellPreference', 'AutoCorrectPreference', 'SmartGuidePreference', 'EPSImportPreference', 'ImportedPageAttribute', 'StrokeFillProxySetting', 'LayoutAdjustmentPreference', 'Preference', 'Preferences', 'ScriptPreference', 'ColorSetting', 'FindChangeTextOption', 'FindChangeGrepOption', 'FindChangeGlyphOption', 'FindChangeObjectOption', 'FindChangeTransliterateOption', 'FindTextPreference', 'FindGrepPreference', 'FindGlyphPreference', 'FindObjectPreference', 'FindTransliteratePreference', 'ChangeTextPreference', 'ChangeGrepPreference', 'ChangeGlyphPreference', 'ChangeObjectPreference', 'ChangeTransliteratePreference', 'LinkingPreference', 'InCopyExportOption', 'PrinterPreset', 'PrinterPresets', 'XMLImportPreference', 'XMLExportPreference', 'XMLPreference', 'ExportForWebPreference', 'AnchoredObjectDefault', 'AnchoredObjectSetting', 'BaselineFrameGridOption', 'FootnoteOption', 'PageNumberVariablePreference', 'ChapterNumberVariablePreference', 'DateVariablePreference', 'FileNameVariablePreference', 'MatchCharacterStylePreference', 'MatchParagraphStylePreference', 'CustomTextVariablePreference', 'CaptionMetadataVariablePreference', 'GridDataInformation', 'LayoutGridDataInformation', 'StoryGridDataInformation', 'CjkGridPreference', 'GridPrintingPreference', 'GalleyPreference', 'FlattenerPreset', 'FlattenerPresets', 'FlattenerPreference', 'TransparencyPreference', 'TransparencySetting', 'StrokeTransparencySetting', 'FillTransparencySetting', 'BlendingSetting', 'DropShadowSetting', 'FeatherSetting', 'InnerShadowSetting', 'OuterGlowSetting', 'InnerGlowSetting', 'BevelAndEmbossSetting', 'SatinSetting', 'ContentTransparencySetting', 'DirectionalFeatherSetting', 'GradientFeatherSetting', 'FindChangeTransparencySetting', 'FindChangeStrokeTransparencySetting', 'FindChangeFillTransparencySetting', 'FindChangeContentTransparencySetting', 'FindChangeBlendingSetting', 'FindChangeDropShadowSetting', 'FindChangeFeatherSetting', 'FindChangeInnerShadowSetting', 'FindChangeOuterGlowSetting', 'FindChangeInnerGlowSetting', 'FindChangeBevelAndEmbossSetting', 'FindChangeSatinSetting', 'FindChangeDirectionalFeatherSetting', 'FindChangeGradientFeatherSetting', 'TextImportPreference', 'TextExportPreference', 'WordRTFImportPreference', 'TaggedTextExportPreference', 'TaggedTextImportPreference', 'ExcelImportPreference', 'MetadataPreference', 'DisplayPerformancePreference', 'DisplaySetting', 'DisplaySettings', 'XMLViewPreference', 'PreflightOption', 'PreflightBookOption', 'PNGExportPreference', 'ButtonPreference', 'WatermarkPreference', 'GeneralPreference', 'ClipboardPreference', 'TransformPreference', 'NotePreference', 'TrackChangesPreference', 'JPEGExportPreference', 'DataMergePreference', 'DataMergeOption', 'DataMerge', 'ChapterNumberPreference', 'ObjectStyleObjectEffectsCategorySettings', 'ObjectStyleStrokeEffectsCategorySettings', 'ObjectStyleFillEffectsCategorySettings', 'ObjectStyleContentEffectsCategorySettings', 'GrabberPreference', 'AlignDistributePreference', 'SWFExportPreference', 'XFLExportPreference', 'AnimationSetting', 'ConditionalTextPreference', 'EPubExportPreference', 'HTMLExportPreference', 'LinkedStoryOption', 'ParaStyleMapping', 'ParaStyleMappings', 'CellStyleMapping', 'CellStyleMappings', 'CharStyleMapping', 'CharStyleMappings', 'TableStyleMapping', 'TableStyleMappings', 'LinkedPageItemOption', 'PreflightRule', 'PreflightRules', 'RuleDataObject', 'RuleDataObjects', 'PreflightRuleInstance', 'PreflightRuleInstances', 'PreflightProfile', 'PreflightProfiles', 'PreflightProcess', 'PreflightProcesses', 'PreflightProfileRule', 'PreflightProfileRules', 'StrokeStyle', 'StrokeStyles', 'DashedStrokeStyle', 'DashedStrokeStyles', 'DottedStrokeStyle', 'DottedStrokeStyles', 'StripedStrokeStyle', 'StripedStrokeStyles', 'TOCStyle', 'TOCStyles', 'TOCStyleEntry', 'TOCStyleEntries', 'Cell', 'Cells', 'Table', 'Tables', 'Column', 'Columns', 'Row', 'Rows', 'TableStyle', 'TableStyles', 'TableStyleGroup', 'TableStyleGroups', 'CellStyle', 'CellStyles', 'CellStyleGroup', 'CellStyleGroups', 'NestedLineStyle', 'NestedLineStyles', 'NestedGrepStyle', 'NestedGrepStyles', 'Text', 'Texts', 'Character', 'Characters', 'Word', 'Words', 'Line', 'Lines', 'TextColumn', 'TextColumns', 'Paragraph', 'Paragraphs', 'TextStyleRange', 'TextStyleRanges', 'InsertionPoint', 'InsertionPoints', 'TextFrame', 'TextFrames', 'Story', 'Stories', 'ParagraphStyle', 'ParagraphStyles', 'CharacterStyle', 'CharacterStyles', 'TabStop', 'TabStops', 'NestedStyle', 'NestedStyles', 'Language', 'Languages', 'LanguageWithVendors', 'LanguagesWithVendors', 'Font', 'Fonts', 'KinsokuTable', 'KinsokuTables', 'MojikumiTable', 'MojikumiTables', 'HyphenationException', 'HyphenationExceptions', 'UserDictionary', 'UserDictionaries', 'AutoCorrectTable', 'AutoCorrectTables', 'Change', 'Changes', 'TextPath', 'TextPaths', 'Note', 'Notes', 'Footnote', 'Footnotes', 'TextVariable', 'TextVariables', 'TextVariableInstance', 'TextVariableInstances', 'StyleExportTagMap', 'StyleExportTagMaps', 'ParagraphStyleGroup', 'ParagraphStyleGroups', 'CharacterStyleGroup', 'CharacterStyleGroups', 'CompositeFont', 'CompositeFonts', 'CompositeFontEntry', 'CompositeFontEntries', 'NamedGrid', 'NamedGrids', 'IndexingSortOption', 'IndexingSortOptions', 'Bullet', 'NumberingRestartPolicy', 'NumberingList', 'NumberingLists', 'ObjectStyleGroup', 'ObjectStyleGroups', 'Condition', 'Conditions', 'HiddenText', 'HiddenTexts', 'ConditionSet', 'ConditionSets', 'PagesPanel', 'LibraryPanel', 'MenuAction', 'MenuActions', 'ScriptMenuAction', 'ScriptMenuActions', 'Menu', 'Menus', 'MenuElement', 'MenuElements', 'Submenu', 'Submenus', 'MenuItem', 'MenuItems', 'MenuSeparator', 'MenuSeparators', 'Panel', 'Panels', 'Dialog', 'Dialogs', 'Widget', 'Widgets', 'TextEditbox', 'TextEditboxes', 'StaticText', 'StaticTexts', 'Dropdown', 'Dropdowns', 'CheckboxControl', 'CheckboxControls', 'DialogColumn', 'DialogColumns', 'RadiobuttonGroup', 'RadiobuttonGroups', 'RadiobuttonControl', 'RadiobuttonControls', 'IntegerEditbox', 'IntegerEditboxes', 'IntegerCombobox', 'IntegerComboboxes', 'EnablingGroup', 'EnablingGroups', 'AngleCombobox', 'AngleComboboxes', 'PercentCombobox', 'PercentComboboxes', 'RealEditbox', 'RealEditboxes', 'PercentEditbox', 'PercentEditboxes', 'AngleEditbox', 'AngleEditboxes', 'RealCombobox', 'RealComboboxes', 'MeasurementCombobox', 'MeasurementComboboxes', 'MeasurementEditbox', 'MeasurementEditboxes', 'BorderPanel', 'BorderPanels', 'DialogRow', 'DialogRows', 'XMLElement', 'XMLElements', 'XMLAttribute', 'XMLAttributes', 'XMLTag', 'XMLTags', 'XMLImportMap', 'XMLImportMaps', 'XMLExportMap', 'XMLExportMaps', 'ValidationError', 'ValidationErrors', 'XMLComment', 'XMLComments', 'XMLInstruction', 'XMLInstructions', 'XMLItem', 'XMLItems', 'DTD', 'DTDs', 'XmlStory', 'XmlStories', 'XMLRuleProcessor', 'XMLRuleProcessors', 'XMLRuleMatchDat'],
getClasses: function() {
return this.classes;
}
};
try {$.dictionary.getClasses();} catch (e) {$.dictionaryCS6Mac.getClasses();}
Copy link to clipboard
Copied
Trevor×… wrote
Well, what do you know?
Windows version 8.1.0.420 (CS6) works
Mac version 8.1.0.419 doesn't work
What the hell…
FWIW: I'm on a German CS6 8.1.0.419 Mac OSX version.
So with Windows it'll work? Arrgh!
Thanks for testing, Trevor!
Regards,
Uwe
Copy link to clipboard
Copied
That $.dictionary is very similar to the OMV files, so it might help to point the ESTK's object model viewer to your application (i.e. InDesign) and thus cause a rebuild of the OMV file. Eventually even the current script version (as in "versioned script") is considered.
Regards,
Dirk
Copy link to clipboard
Copied
Hi Dirk
Didn't help for me.
One could of course loads the omv from the disk to create the sort of fake $.dictionary I posted in 28
Regards
Trevor
Copy link to clipboard
Copied
Interesting find.
Just a side question, to rule this out: This is not possibly related to my version (and yours possibly to, Uwe?) being a localized German version?
Apparently not, if Trevor has the same result. Hm, quite annoying, really. 😕
Copy link to clipboard
Copied
So, to summarize, $.dictionary may return null in a very few CS6 builds.
At this point my personal workaround will be to just prepend `$.dictionary &&` before the whole snippet, so that Enumerator.toSource() will work the native way in that special case.
@+
Marc
Copy link to clipboard
Copied
So here is my current implementation of the whole thing. (Note that Enumeration.toSource() has been added too. I needed it for improving my ExtendScript-oriented JSON module.)
//==========================================================================
// Number.prototype.toHexa() ; Number.prototype.toAdbe()
//==========================================================================
Number.prototype.toHexa = function toHexa()
//----------------------------------
// Return the "0xHHHH" representation of this number.
// E.g 123456 => "0x1E240"
{
return isNaN(this) ?
'NaN' :
( '0x' + this.toString(16).toUpperCase() );
};
Number.prototype.toAdbe = function toAdbe()
//----------------------------------
// Return the Adobe's 4-char string this number encodes.
// [REM] Only makes sense if `this` is U32.
// E.g 0x414F5069 => "AOPi" ; 0x74787466 => "txtf"
{
return isNaN(this) ?
'NaN' :
String.fromCharCode( 0xFF&(this>>>24), 0xFF&(this>>>16), 0xFF&(this>>>8), 0xFF&(this>>>0) );
};
//==========================================================================
// Temporary global aliases.
//==========================================================================
$.global.E9nProto = NothingEnum.constructor.prototype;
$.global.E8rProto = ('object' == typeof NothingEnum.NOTHING) && NothingEnum.NOTHING.constructor.prototype;
//==========================================================================
// IMPLEMENTATION NOTES
//==========================================================================
/*
Idea based on Dirk Becker's 2014 original code at ixta.com.
Looping through $.dictionary.getClasses() allows to collect every class
whose Reflection has the 'enumeration' flag. From then we can both
(a) Build a hashkey from the XML representation of the class (based on
the sequence of its enum keys) so that we feed a {hash=>className}
mapping. This process is achieved using an xpath() command.
=> Allows to implement Enumeration.prototype.toSource().
(b) Register each enum key in a {key=>data} structure so that data is
either a number (if no unique Enumeration is attached to that value),
or a <value>/<className> string otherwise.
=> Allows to implement Enumerator.prototype.toSource() in CS5 and later.
All needed data are cached in the corresponding methods: callee.DB for
both, and callee.ENUM_XPATH for Enumeration's xpath request.
Note. - The below code may consume more than 200 ms in CC 2017 (Win64.)
[FIX170322]. - It seems that $.dictionary may return `null` in rare CS6
versions. In that case we just ignore the whole fixer.
*/
$.dictionary && (function(/*fct*/fClasses,/*fct|false*/fKeys, QC,XP,QK,a,n,i,x,s,t,k,v)
{
const DIC = $.dictionary;
QC = (fClasses.DB = {/*hashProps => className*/});
XP = (fClasses.ENUM_XPATH = "//property[datatype/type='number' or datatype/type='Enumerator']/@name");
QK = fKeys ? (fKeys.DB = {/*key => value[/className]*/}) : 0;
for( a=DIC.getClasses(), n=a.length, i=-1 ; ++i < n ; )
{
x = DIC.getClass(s=a).toXML();
if( 'true' != x.@enumeration ) continue;
// Enum Classes
// ---
QC[String(x.xpath(XP))] = s;
if( !QK ) continue; // before CS5
// Enum Keys
// [FIX170319] Check whether x..property has more than one
// item (.length()>1) otherwise `for each` would loop inside!
// ---
x = ( 1 < (t=x..property).length() ) ? t : (t.parent());
if( null===x ){ throw Error("XML Error on Enumeration " + s); }
for each( t in x )
{
k = String(t.@name);
v = Number(t..value);
if( !(k&&v) ){ throw Error("XML Error on Enumeration " + s); }
QK
= QK.hasOwnProperty(k) ? v : (v + '/' + s); }
}
})
(
(E9nProto.toSource = function toSource(/*0|1=0*/VERBOSE)
//----------------------------------
// Output an evaluable string S such as this==eval(S) for any Enumeration.
// Eg. Locale.toSource() => "(Locale)"
{
return '(' +
(
callee.DB[String(this.reflect.toXML().xpath(callee.ENUM_XPATH))] ||
( "{" + (VERBOSE?"/*not found Enumeration*/":"") + "}" )
) +
')';
}),
E8rProto && (E8rProto.toSource = function toSource(/*0|1=0*/VERBOSE, k,v,s)
//----------------------------------
// Output an evaluable string S such as this==eval(S) for any Enumerator.
// =>
// <Enumeration>.<Enumerator> /* 0x<Hexa> [<Tag>] */
// if <Enumeration> is the unique parent for that value,
// Eg: AnchorPosition.INLINE_POSITION /* 0x414F5069 [AOPi] */
//
// or
//
// 0x<Hexa> /* <Enumerator> [<Tag>] */
// if Enumerator's value belongs to multiple parents,
// e.g: 0x74787466 /* TEXT_FRAME [txtf] */
//
// [REM] The comment part /*...*/ is added only if VERBOSE is on.
{
if( (v=callee.DB[k=String(this)]) && 'string' == typeof v )
{
// Case 1 -- String("<number>/<class>")
// => EnumClass.ENUM_KEY format.
// ---
s = v.substr(1+v.indexOf('/')) + '.' + k;
if( !VERBOSE ) return s;
v = parseInt(v,10);
k = v.toHexa();
}
else
{
// Case 2 -- Unknown key or number only (multiple parents.)
// => 0xHHHH format.
// ---
s = (v||(v=this.valueOf())).toHexa();
if( !VERBOSE ) return s;
}
return $.global.localize("%1 /* %2 [%3] */", s, k, v.toAdbe());
})
);
//==========================================================================
// Clear globals.
//==========================================================================
delete $.global.E9nProto;
delete $.global.E8rProto;
delete $.global.NothingEnum;
//==========================================================================
// Tests
//==========================================================================
alert( Locale.toSource() );
// => "(Locale)" --if( $.dictionary )
// => "({})" --fallback
alert( Locale.germanLocale.toSource() );
// => "Locale.GERMAN_LOCALE" --if( CS5+ && $.dictionary)
// => "(new Number(1279477613))" --fallback
alert( CoordinateSpaces.parentCoordinates.toSource(1) );
// => "CoordinateSpaces.PARENT_COORDINATES /* 0x78797061 [xypa] */" --if( CS5+ && $.dictionary)
// => "(new Number(2021224545))" --fallback
@+
Marc
Copy link to clipboard
Copied
Sorry for being the days party pooper, but it ain't working for me.
I get 3 alerts of ({})
Copy link to clipboard
Copied
😞
In all versions and platforms? (Weird!)
[I've tested it in six different versions from CS4 to CC (2017), of course outside of ESTK.]
@+
Marc
Copy link to clipboard
Copied
Hi Marc,
tested your code from reply 32 :
German CS4 6.0.6.622 on German Mac OSX 10.6.8 :
Result: "(Locale)" , "(new Number(1279477613))" , "(new Number(2021224545))"
German CS5 7.0.4.553 on German Mac OSX 10.6.8 :
Result: "(Locale)" , "Locale.GERMAN_LOCALE" , "CoordinateSpaces.PARENT_COORDINATES /* 0x78797061 [xypa] */"
German CS5.5 7.5.3.333 on German Mac OSX 10.6.8 :
Result: "(Locale)" , "Locale.GERMAN_LOCALE" , "CoordinateSpaces.PARENT_COORDINATES /* 0x78797061 [xypa] */"
German CS6 8.1.0.419 on German Mac OSX 10.6.8 :
Result: ({}) , ({}) , ({})
German CC 9.3.0.106 on German Mac OSX 10.6.8 :
Result: "(Locale)" , "Locale.GERMAN_LOCALE" , "CoordinateSpaces.PARENT_COORDINATES /* 0x78797061 [xypa] */"
Best,
Uwe
Copy link to clipboard
Copied
Hi Uwe,
Thanks a lot for your detailed report.
Almost what I was expecting. I just made a mistake in the description of the tests. Indeed, since the snippet does nothing if (!$.dictionary), toSource will simply behaves its native way in that specific case, which explains the ({}) results. One could likely improve this using either Trevor's approach—that is, hardcoding a fake $.dictionary—, or at least this.valueOf() for the purpose of returning a `Number(…)` source for Enumerators in CS6 8.1.0.419 Mac OSX 10.6.8.
Left as an exercise to the readers 😉
@+,
Marc