标题: [文本处理] [已解决]求助用批处理修改xml内的数字数据 [打印本页]
作者: ttrrf 时间: 2013-11-22 16:50 标题: [已解决]求助用批处理修改xml内的数字数据
我这里有个arrays.xml,内容是:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="timezone_filters">
<item>America</item>
<item>Europe</item>
<item>Africa</item>
<item>Asia</item>
<item>Australia</item>
<item>Pacific</item>
<item>All</item>
</string-array>
<string-array name="date_format_values">
<item></item>
<item>MM-dd-yyyy</item>
<item>dd-MM-yyyy</item>
<item>yyyy-MM-dd</item>
</string-array>
<string-array name="screen_timeout_entries">
<item>15 seconds</item>
<item>30 seconds</item>
<item>1 minute</item>
<item>2 minutes</item>
<item>5 minutes</item>
<item>10 minutes</item>
<item>Never</item>
</string-array>
<string-array name="screen_timeout_values">
<item>15000</item>
<item>30000</item>
<item>60000</item>
<item>120000</item>
<item>300000</item>
<item>600000</item>
<item>2147483647</item>
</string-array>
<string-array name="dream_timeout_entries">
<item>Never</item>
<item>15 seconds</item>
<item>30 seconds</item>
<item>1 minute</item>
<item>2 minutes</item>
<item>5 minutes</item>
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
<string-array name="dream_timeout_values">
<item>0</item>
<item>15000</item>
<item>30000</item>
<item>60000</item>
<item>120000</item>
<item>300000</item>
<item>600000</item>
<item>1800000</item>
</string-array>
<string-array name="lock_after_timeout_entries">
<item>Immediately</item>
<item>5 seconds</item>
<item>15 seconds</item>
<item>30 seconds</item>
<item>1 minute</item>
<item>2 minutes</item>
<item>5 minutes</item>
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
<string-array name="lock_after_timeout_values">
<item>0</item>
<item>5000</item>
<item>15000</item>
<item>30000</item>
<item>60000</item>
<item>120000</item>
<item>300000</item>
<item>600000</item>
<item>1800000</item>
</string-array>
<string-array name="entries_font_size">
<item>Small</item>
<item>Normal</item>
<item>Large</item>
<item>Huge</item>
</string-array>
<string-array name="entryvalues_font_size">
<item>0.85</item>
<item>1.0</item>
<item>1.15</item>
<item>1.30</item>
</string-array>
<string-array name="tts_rate_entries">
<item>Very slow</item>
<item>Slow</item>
<item>Normal</item>
<item>Fast</item>
<item>Very fast</item>
</string-array>
<string-array name="tts_rate_values">
<item>60</item>
<item>80</item>
<item>100</item>
<item>150</item>
<item>200</item>
</string-array>
<string-array name="tts_pitch_entries">
<item>Very low</item>
<item>Low</item>
<item>Normal</item>
<item>High</item>
<item>Very high</item>
</string-array>
<string-array name="tts_pitch_values">
<item>50</item>
<item>80</item>
<item>100</item>
<item>120</item>
<item>150</item>
</string-array>
<string-array name="tts_demo_strings">
<item>This is an example of speech synthesis in English.</item>
<item>Voici un échantillon de synthèse vocale en français.</item>
<item>Dies ist ein Beispiel für Sprachsynthese in Deutsch.</item>
<item>Questo è un esempio di sintesi vocale in italiano.</item>
<item>Este es un ejemplo de síntesis de voz en español.</item>
</string-array>
<string-array name="tts_demo_string_langs">
<item>eng</item>
<item>fra</item>
<item>deu</item>
<item>ita</item>
<item>spa</item>
</string-array>
<string-array name="wifi_status">
<item></item>
<item>Scanning…</item>
<item>Connecting…</item>
<item>Authenticating…</item>
<item>Obtaining IP address…</item>
<item>Connected</item>
<item>Suspended</item>
<item>Disconnecting…</item>
<item>Disconnected</item>
<item>Unsuccessful</item>
<item>Blocked</item>
<item>Temporarily avoiding poor connection</item>
</string-array>
<string-array name="wifi_status_with_ssid">
<item></item>
<item>Scanning…</item>
<item>Connecting to %1$s…</item>
<item>Authenticating with %1$s…</item>
<item>Obtaining IP address from %1$s…</item>
<item>Connected to %1$s</item>
<item>Suspended</item>
<item>Disconnecting from %1$s…</item>
<item>Disconnected</item>
<item>Unsuccessful</item>
<item>Blocked</item>
<item>Temporarily avoiding poor connection</item>
</string-array>
<string-array name="wifi_security">
<item>@string/wifi_security_none</item>
<item>@string/wifi_security_wep</item>
<item>@string/wifi_security_psk_generic</item>
<item>@string/wifi_security_eap</item>
</string-array>
<string-array name="wifi_security_no_eap">
<item>@string/wifi_security_none</item>
<item>@string/wifi_security_wep</item>
<item>@string/wifi_security_psk_generic</item>
<item>WAPI PSK</item>
<item>WAPI CERT</item>
</string-array>
<string-array name="wifi_ap_security">
<item>Open</item>
<item>WPA PSK</item>
<item>WPA2 PSK</item>
</string-array>
<string-array name="wifi_eap_method">
<item>PEAP</item>
<item>TLS</item>
<item>TTLS</item>
<item>PWD</item>
</string-array>
<string-array name="wifi_p2p_wps_setup">
<item>Push button</item>
<item>PIN from peer device</item>
<item>PIN from this device</item>
</string-array>
<string-array name="wifi_p2p_status">
<item>Connected</item>
<item>Invited</item>
<item>Unsuccessful</item>
<item>Available</item>
<item>Out-of-range</item>
</string-array>
<string-array name="bluetooth_visibility_timeout_entries">
<item>2 minutes</item>
<item>5 minutes</item>
<item>1 hour</item>
<item>Never time out</item>
</string-array>
<string-array name="wifi_signal">
<item>Poor</item>
<item>Fair</item>
<item>Good</item>
<item>Excellent</item>
</string-array>
<string-array name="wifi_sleep_policy_entries">
<item>Always</item>
<item>Only when plugged in</item>
<item>Never (increases data usage)</item>
</string-array>
<string-array name="wifi_sleep_policy_entries_wifi_only">
<item>Always</item>
<item>Only when plugged in</item>
<item>Never</item>
</string-array>
<string-array name="wifi_sleep_policy_values">
<item>2</item>
<item>1</item>
<item>0</item>
</string-array>
<string-array name="wifi_frequency_band_entries">
<item>Auto</item>
<item>5 GHz only</item>
<item>2.4 GHz only</item>
</string-array>
<string-array name="wifi_frequency_band_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="usage_stats_display_order_types">
<item>Usage time</item>
<item>Launch count</item>
<item>App name</item>
</string-array>
<string-array name="wifi_eap_entries">
<item>PEAP</item>
<item>TLS</item>
<item>TTLS</item>
<item>PWD</item>
</string-array>
<string-array name="wifi_phase2_entries">
<item>None</item>
<item>PAP</item>
<item>MSCHAP</item>
<item>MSCHAPV2</item>
<item>GTC</item>
</string-array>
<string-array name="wifi_ip_settings">
<item>DHCP</item>
<item>Static</item>
</string-array>
<string-array name="wifi_proxy_settings">
<item>None</item>
<item>Manual</item>
</string-array>
<string-array name="emergency_tone_entries">
<item>Off</item>
<item>Alert</item>
<item>Vibrate</item>
</string-array>
<string-array name="emergency_tone_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="special_locale_codes">
<item>zh_CN</item>
<item>zh_TW</item>
</string-array>
<string-array name="special_locale_names">
<item>中文 (简体)</item>
<item>中文 (繁體)</item>
</string-array>
<string-array name="apn_auth_entries">
<item>None</item>
<item>PAP</item>
<item>CHAP</item>
<item>PAP or CHAP</item>
</string-array>
<string-array name="apn_auth_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
<string-array name="apn_protocol_entries">
<item>IPv4</item>
<item>IPv6</item>
<item>IPv4/IPv6</item>
</string-array>
<string-array name="apn_protocol_values">
<item>IP</item>
<item>IPV6</item>
<item>IPV4V6</item>
</string-array>
<string-array name="bearer_entries">
<item>LTE</item>
<item>eHRPD</item>
<item>Unspecified</item>
</string-array>
<string-array name="bearer_values">
<item>14</item>
<item>13</item>
<item>0</item>
</string-array>
<string-array name="app_install_location_entries">
<item>Internal device storage</item>
<item>Removable SD card</item>
<item>Let the system decide</item>
</string-array>
<string-array name="app_install_location_values">
<item>device</item>
<item>sdcard</item>
<item>auto</item>
</string-array>
<string-array name="long_press_timeout_selector_titles">
<item>Short</item>
<item>Medium</item>
<item>Long</item>
</string-array>
<string-array name="long_press_timeout_selector_values">
<item>500</item>
<item>1000</item>
<item>1500</item>
</string-array>
<string-array name="hdcp_checking_titles">
<item>Never check</item>
<item>Check for DRM content only</item>
<item>Always check</item>
</string-array>
<string-array name="hdcp_checking_values">
<item>never</item>
<item>drm-only</item>
<item>always</item>
</string-array>
<string-array name="hdcp_checking_summaries">
<item>Never use HDCP checking</item>
<item>Use HDCP checking for DRM content only</item>
<item>Always use HDCP checking</item>
</string-array>
<string-array name="window_animation_scale_entries">
<item>Animation off</item>
<item>Animation scale .5x</item>
<item>Animation scale 1x</item>
<item>Animation scale 1.5x</item>
<item>Animation scale 2x</item>
<item>Animation scale 5x</item>
<item>Animation scale 10x</item>
</string-array>
<string-array name="window_animation_scale_values">
<item>0</item>
<item>.5</item>
<item>1</item>
<item>1.5</item>
<item>2</item>
<item>5</item>
<item>10</item>
</string-array>
<string-array name="transition_animation_scale_entries">
<item>Animation off</item>
<item>Animation scale .5x</item>
<item>Animation scale 1x</item>
<item>Animation scale 1.5x</item>
<item>Animation scale 2x</item>
<item>Animation scale 5x</item>
<item>Animation scale 10x</item>
</string-array>
<string-array name="transition_animation_scale_values">
<item>0</item>
<item>.5</item>
<item>1</item>
<item>1.5</item>
<item>2</item>
<item>5</item>
<item>10</item>
</string-array>
<string-array name="animator_duration_scale_entries">
<item>Animation off</item>
<item>Animation scale .5x</item>
<item>Animation scale 1x</item>
<item>Animation scale 1.5x</item>
<item>Animation scale 2x</item>
<item>Animation scale 5x</item>
<item>Animation scale 10x</item>
</string-array>
<string-array name="animator_duration_scale_values">
<item>0</item>
<item>.5</item>
<item>1</item>
<item>1.5</item>
<item>2</item>
<item>5</item>
<item>10</item>
</string-array>
<string-array name="overlay_display_devices_entries">
<item>None</item>
<item>720x480 mdpi</item>
<item>1280x720 tvdpi</item>
<item>1920x1080 xhdpi</item>
<item>1280x720 tvdpi and 1920x1080 xhdpi</item>
</string-array>
<string-array name="overlay_display_devices_values">
<item></item>
<item>720x480/160</item>
<item>1280x720/213</item>
<item>1920x1080/320</item>
<item>1280x720/213;1920x1080/320</item>
</string-array>
<string-array name="enable_opengl_traces_entries">
<item>None</item>
<item>Logcat</item>
<item>Systrace (Graphics)</item>
<item>Call stack on glGetError</item>
</string-array>
<string-array name="enable_opengl_traces_values">
<item>0</item>
<item>1</item>
<item>systrace</item>
<item>error</item>
</string-array>
<string-array name="app_process_limit_entries">
<item>Standard limit</item>
<item>No background processes</item>
<item>At most 1 process</item>
<item>At most 2 processes</item>
<item>At most 3 processes</item>
<item>At most 4 processes</item>
</string-array>
<string-array name="app_process_limit_values">
<item>-1</item>
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</string-array>
<string-array name="vpn_types">
<item>PPTP</item>
<item>L2TP/IPSec PSK</item>
<item>L2TP/IPSec RSA</item>
<item>IPSec Xauth PSK</item>
<item>IPSec Xauth RSA</item>
<item>IPSec Hybrid RSA</item>
</string-array>
<string-array name="vpn_types_long">
<item>PPTP VPN</item>
<item>L2TP/IPSec VPN with pre-shared keys</item>
<item>L2TP/IPSec VPN with certificates</item>
<item>IPSec VPN with pre-shared keys and Xauth authentication</item>
<item>IPSec VPN with certificates and Xauth authentication</item>
<item>IPSec VPN with certificates and hybrid authentication</item>
</string-array>
<string-array name="vpn_states">
<item>Disconnected</item>
<item>Initializing…</item>
<item>Connecting…</item>
<item>Connected</item>
<item>Timeout</item>
<item>Unsuccessful</item>
</string-array>
<string-array name="user_content_ratings_entries">
<item>Ascended being</item>
<item>Human</item>
<item>Neanderthal</item>
<item>Chimp</item>
<item>Monkey</item>
</string-array>
<string-array name="user_content_ratings_values">
<item>5</item>
<item>4</item>
<item>3</item>
<item>2</item>
<item>1</item>
</string-array>
<string-array name="security_settings_premium_sms_values">
<item>Ask</item>
<item>Never allow</item>
<item>Always allow</item>
</string-array>
<string-array name="input_method_selector_titles">
<item>@string/input_method_selector_show_automatically_title</item>
<item>@string/input_method_selector_always_show_title</item>
<item>@string/input_method_selector_always_hide_title</item>
</string-array>
<string-array name="input_method_selector_values">
<item>@string/input_method_selector_show_automatically_value</item>
<item>@string/input_method_selector_always_show_value</item>
<item>@string/input_method_selector_always_hide_value</item>
</string-array>
<string-array name="haptic_feedback_level_entries">
<item>Strong</item>
<item>Medium</item>
<item>Light</item>
</string-array>
<string-array name="haptic_feedback_level_values">
<item>2</item>
<item>1</item>
<item>0</item>
</string-array>
<string-array name="media_feedback_level_entries">
<item>Strong</item>
<item>Medium</item>
<item>Light</item>
</string-array>
<string-array name="media_feedback_level_values">
<item>15</item>
<item>7</item>
<item>0</item>
</string-array>
<string-array name="battery_indicator_style_entries">
<item>Graphical</item>
<item>Percentage</item>
<item>Top bar</item>
</string-array>
<string-array name="battery_indicator_style_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="usb_connection_mode_entries">
<item>Ask upon connection</item>
<item>Charge only</item>
<item>Mount SD card</item>
</string-array>
<string-array name="usb_connection_mode_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="led_freq_entries">
<item>2 seconds</item>
<item>3 seconds</item>
<item>4 seconds</item>
<item>5 seconds</item>
<item>6 seconds</item>
<item>7 seconds</item>
<item>8 seconds</item>
<item>9 seconds</item>
</string-array>
<string-array name="led_freq_values">
<item>2000</item>
<item>3000</item>
<item>4000</item>
<item>5000</item>
<item>6000</item>
<item>7000</item>
<item>8000</item>
<item>9000</item>
</string-array>
<string-array name="led_color_values">
<item>blue</item>
<item>red</item>
<item>yellow</item>
<item>green</item>
<item>cyan</item>
<item>white</item>
<item>\#FFAA00AA</item>
</string-array>
<string-array name="mi1_led_color_values">
<item>blue</item>
<item>red</item>
<item>green</item>
<item>\#FFFF0033</item>
<item>\#FF5500FF</item>
<item>\#FFAA00AA</item>
</string-array>
<string-array name="mi1_led_color_entries">
<item>Blue</item>
<item>Red</item>
<item>Green</item>
<item>Pink</item>
<item>Violet</item>
<item>Purple</item>
</string-array>
<string-array name="led_color_entries">
<item>Blue</item>
<item>Red</item>
<item>Yellow</item>
<item>Green</item>
<item>Cyan</item>
<item>White</item>
<item>Violet</item>
</string-array>
<string-array name="always_enabled_app_list">
<item>com.android.providers.applications</item>
<item>com.android.providers.calendar</item>
<item>com.android.providers.contacts</item>
<item>com.android.providers.downloads</item>
<item>com.android.providers.drm</item>
<item>com.android.providers.media</item>
<item>com.android.providers.telephony</item>
<item>com.android.providers.userdictionary</item>
<item>com.miui.providers.userbook</item>
<item>com.miui.providers.weather</item>
<item>com.miui.yellowpage</item>
</string-array>
<string-array name="wifi_security_only_wapi_cert_entries">
<item>WAPI CERT</item>
</string-array>
<string-array name="mi2_wifi_security">
<item>@string/wifi_security_none</item>
<item>@string/wifi_security_wep</item>
<item>@string/wifi_security_psk_generic</item>
<item>@string/wifi_security_eap</item>
<item>WAPI PSK</item>
<item>WAPI CERT</item>
</string-array>
<string-array name="wifi_wapi_key_type">
<item>WAPI ASCII</item>
<item>WAPI hexadecimal</item>
</string-array>
<string-array name="screen_key_long_press_action">
<item>None</item>
<item>Show recent apps tray</item>
<item>Launch Assistant</item>
<item>Launch Google now</item>
<item>Close current app</item>
</string-array>
<string-array name="screen_key_long_press_action_value">
<item>none</item>
<item>recent_panel</item>
<item>voice_assistant</item>
<item>google_now</item>
<item>close_app</item>
</string-array>
<string-array name="screen_key_long_press_timeout">
<item>0.5 second</item>
<item>1 second</item>
<item>1.5 seconds</item>
<item>2 seconds</item>
</string-array>
<string-array name="screen_key_long_press_timeout_value">
<item>500</item>
<item>1000</item>
<item>1500</item>
<item>2000</item>
</string-array> <string-array name="button_light_timeout_entries">
<item>1 second</item>
<item>2 seconds</item>
<item>5 seconds</item>
<item>10 seconds</item>
<item>20 seconds</item>
<item>Always</item>
</string-array>
<string-array name="button_light_timeout_value">
<item>1000</item>
<item>2000</item>
<item>5000</item>
<item>10000</item>
<item>20000</item>
<item>-1</item>
</string-array>
<string-array name="font_size_title">
<item>@string/font_size_small</item>
<item>@string/font_size_normal</item>
<item>@string/font_size_medium</item>
<item>@string/font_size_large</item>
</string-array>
<integer-array name="font_size_preference_preview_size">
<item>14</item>
<item>18</item>
<item>22</item>
<item>27</item>
</integer-array>
<string-array name="dolby_mode_entries">
<item>@string/dolby_mode_off</item>
<item>@string/dolby_mode_music</item>
<item>@string/dolby_mode_movie</item>
</string-array>
<string-array name="dolby_bassboost_ranks">
<item>@string/dolby_bassboost_low</item>
<item>@string/dolby_bassboost_normal</item>
<item>@string/dolby_bassboost_high</item>
</string-array>
<string-array name="dolby_bassboost_rank_valus">
<item>0</item>
<item>3</item>
<item>6</item>
</string-array>
<string-array name="dolby_roomsize_ranks">
<item>@string/dolby_roomsize_low</item>
<item>@string/dolby_roomsize_normal</item>
<item>@string/dolby_roomsize_high</item>
</string-array>
<string-array name="dolby_roomsize_rank_valus">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="dolby_equalizer_preset_values">
<item>0,0,0,0,0,0,0</item>
<item>16,8,0,-8,0,8,16</item>
<item>0,0,-4,-8,-8,-4,0</item>
<item>-8,-20,4,12,8,8,8</item>
<item>4,0,0,-8,-4,0,0</item>
<item>16,4,-4,-4,4,4,4</item>
<item>16,-4,0,-8,0,-4,-4</item>
<item>4,0,-4,-8,0,4,8</item>
<item>16,4,-8,-4,-8,-4,0</item>
<item>0,-4,-4,-4,-8,-4,-8</item>
<item>16,12,-24,-24,-16,12,16</item>
<item>24,14,-20,6,12,16,8</item>
</string-array>
<string-array name="wfd_status">
<item>Device connected, creating session…</item>
<item>Session created.</item>
<item>Session tearing down…</item>
<item>Session failed.</item>
<item>Timed out, retrying…</item>
<item>Device connected</item>
</string-array>
<string-array name="power_mode_entries">
<item>Performance</item>
<item>Balance</item>
<item>Power saving</item>
</string-array>
<string-array name="msd_pc_system">
<item>Windows XP and older versions of Windows</item>
<item>Windows Vista and newer versions of Windows</item>
<item>Mac OS</item>
<item>Linux</item>
</string-array>
<string-array name="msd_pc_system_install_start_summary">
<item>"For Windows XP or older versions,
the driver needs to be manually installed"</item>
<item>"For Windows Vista or newer versions,
the MI 3 music player will appear on your computer"</item>
<item>"For Mac OS operating system,
the driver software needs to be manually installed"</item>
<item></item>
</string-array>
<string-array name="msd_pc_system_install_step_1_summary">
<item>"(Ignore the Setup Wizard)
When connected, Xiaomi will appear as a USB mass storage device.
Open and select Setup.exe to install"</item>
<item></item>
<item>"When connected, Xiaomi will appear as a USB mass storage device on your desktop.
Open and select AndroidFileTransfer.dmg to install."</item>
<item></item>
</string-array>
<string-array name="msd_pc_system_install_step_2_summary">
<item>"2.MI 3 mobile storage device will appear on your computer
You can now transfer files"</item>
<item></item>
<item>"Computer will auto open and read phone data
You can now transfer files"</item>
<item></item>
</string-array>
<string-array name="msd_pc_system_install_finish_summary">
<item>"If you install this driver
MI 3 mobile storage device should appear on the computer"</item>
<item>"For Windows Vista or newer versions,
the MI 3 music player will appear on your computer"</item>
<item>"If you install this driver
Computer will auto open and read phone data"</item>
<item></item>
</string-array>
<string-array name="screen_color_title">
<item>Warm</item>
<item>Standard</item>
<item>Cool</item>
</string-array>
<string-array name="screen_saturation_title">
<item>Brilliant</item>
<item>Standard</item>
</string-array>
<string-array name="perms_hips_values">
<item>2</item>
<item>1</item>
<item>0</item>
</string-array>
<string-array name="perm_hips_action">
<item>Allow</item>
<item>Ask</item>
<item>Deny</item>
</string-array>
<string-array name="startup_hips_values">
<item>2</item>
<item>0</item>
</string-array>
<string-array name="startup_hips_action">
<item>Allow</item>
<item>Deny</item>
</string-array>
<string-array name="entries_color_calibration">
<item>sRGB</item>
<item>Native</item>
</string-array>
<string-array name="values_color_calibration">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="phone_call_noise_suppression_title">
<item>Single mic noise_suppression</item>
<item>Dual mic noise_suppression</item>
</string-array>
<string-array name="phone_call_noise_suppression_values">
<item>1</item>
<item>2</item>
</string-array>
<string-array name="change_security_lock_picker_key">
<item>facial</item>
<item>pattern</item>
<item>numerical</item>
<item>mixed</item>
</string-array>
<string-array name="change_security_lock_picker">
<item>Face unlock</item>
<item>Pattern</item>
<item>PIN</item>
<item>Password</item>
</string-array>
<string-array name="dndm_vip_list_group_array">
<item>@string/dndm_vip_list_custom</item>
<item>@string/dndm_vip_list_contact</item>
</string-array>
<string-array name="dndm_auto_time_trun_on_off">
<item>@string/dndm_auto_time_turn_on</item>
<item>@string/dndm_auto_time_turn_off</item>
</string-array>
<string-array name="nfc_se_route_values">
<item>1</item>
<item>2</item>
</string-array>
<string-array name="wifi_connect_type_entries">
<item>Automatically connect</item>
<item>Manually connect</item>
<item>Always ask</item>
</string-array>
<string-array name="wifi_connect_type_values">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="miracast_policies">
<item>Shorter delay</item>
<item>Standard</item>
<item>Better quality</item>
</string-array>
</resources>
想把上面带红色的数字改小点,比如“0.5 second改成0.25 second和500改成250”“1 second改成0.5 second和1000改成500”后两个数据就这么改。请教大大,愿和你们共同学习。
作者: apang 时间: 2013-11-23 00:41
办法比较笨,不过测试附件能通过- strKey = "screen_key_long_press_timeout"
- with CreateObject("ADODB.Stream")
- .Type = 2
- .Mode = 3
- .CharSet = "utf-8"
- .Open
- .LoadFromFile "arrays.xml"
- ar = Split(.ReadText(-1),"</string-array>")
- For i = 0 to UBound(ar)
- If InStr(ar(i),strKey) Then ar(i) = RegEx(ar(i))
- Next
-
- .Position = 0
- .CharSet = "utf-8"
- .WriteText Join(ar,"</string-array>")
- .SetEOS
- .SaveToFile "a.xml",2
- .Close
- End with
-
- Function RegEx(str)
- Set re = New RegExp
- re.Pattern = "([\s\S]+?)([\d\.]+)|([\s\S]+)$"
- re.Global = true
- For Each m in re.Execute(str)
- If m.SubMatches(1) <> "" Then
- RegEx = RegEx & m.SubMatches(0) & m.SubMatches(1)/2
- Else RegEx = RegEx & m.SubMatches(2)
- End If
- Next
- End Function
复制代码
作者: zhanglei1371 时间: 2013-11-23 14:06
好方法,学习学习
作者: apang 时间: 2013-11-23 16:24
保存为test.bat- @set @n=0//&cscript -nologo -e:jscript "%~0"&pause&exit/b
- strKey = "screen_key_long_press_timeout";
- re = new RegExp(strKey + "[\\s\\S]+?</string-array>","ig")
- with (new ActiveXObject("ADODB.Stream")){
- Type = 2;
- Mode = 3;
- CharSet = "utf-8";
- Open();
- LoadFromFile("a.xml");
- text = ReadText(-1);
- text = text.replace(re,
- function(m){
- return(m.replace(/\d+(\.\d*)?/g,function(n){return(n*0.5)}));
- }
- );
- Position = 0;
- WriteText(text);
- SetEOS();
- SaveToFile("b.xml",2);
- Close();
- };
复制代码
作者: ttrrf 时间: 2013-11-23 16:42
回复 4# apang
你发的这两段代码是一样的效果吗?
作者: ttrrf 时间: 2013-11-23 16:47
回复 4# apang
D:\Documents\Downloads\arrays\test.bat(9, 5) ADODB.Stream: 文件无法被打开。
请按任意键继续. . .
这是什么原因呀?
作者: apang 时间: 2013-11-23 17:21
回复 6# ttrrf
第9行 a.xml 换成实际的文件名
作者: ttrrf 时间: 2013-11-23 19:28
回复 7# apang
可以了,感谢了,向你学习。
作者: ttrrf 时间: 2013-11-23 19:46
回复 4# apang
兄弟,再麻烦下,我想把上面的这个数据改一下:
<string-array name="long_press_timeout_selector_values">
<item>500</item>
<item>1000</item>
<item>1500</item>
</string-array>
我标的红色的。你看看。我是想把500改为200,把1000改为500,把1500改成1000。如何改呀?麻烦下。
作者: apang 时间: 2013-11-24 08:49
回复 9# ttrrf
代码是按0.5倍的数据变化规律来写的,新增加的这段数据变化没有规律,抱歉,我无法实现。
作者: ttrrf 时间: 2013-11-24 12:46
回复 10# apang
我试了试,发现500倒是改成了200,但是1000变为了400,1500变为了600.我把数据改成0.4的倍数了。
作者: ttrrf 时间: 2013-11-24 12:50
回复 10# apang
能否在这3个数字上用3段代码分别对数字进行更改,你说如何?
作者: apang 时间: 2013-11-24 16:40
权当练习- @set @n=0//&cscript -nologo -e:jscript "%~0" &pause&exit/b
- strKey = "(screen_key_long_press_timeout";
- strKey += "|" + "long_press_timeout_selector_values)";
- re = new RegExp(strKey + "[\\s\\S]+?</string-array>","ig")
- with (new ActiveXObject("ADODB.Stream")){
- Type = 2;
- Mode = 3;
- CharSet = "utf-8";
- Open();
- LoadFromFile("a.xml");
- text = ReadText(-1).replace(re,changeNum);
- Position = 0;
- WriteText(text);
- SetEOS();
- SaveToFile("b.xml",2);
- Close();
- };
-
- function changeNum(){
- m=arguments[0];
- r = m.search(/screen_key_long_press_timeout/i);
- return(m.replace(/\d+(\.\d*)?/g,
- function(n){
- if (r=="-1"){
- if (n=="500"){return("200")}
- else if (n=="1000"){return("500")}
- else {return("1000")}
- } else {return(n*0.5)}
- }
- ));
- };
复制代码
作者: ttrrf 时间: 2013-11-24 20:36
回复 13# apang
厉害呀!一次性解决了。向你学习!
作者: nicholasfor 时间: 2013-11-25 10:13
批处理也能这样写??长见识了。
我还以为批处理只能像命令行里的东东一样呢,井蛙了。
作者: zhaoya188 时间: 2016-1-19 17:32
回复 4# apang
请问大大:
第一行 @set @n=0//&cscript 能详细解析一下吗?
作者: CrLf 时间: 2016-1-20 10:23
回复 16# zhaoya188
http://www.bathome.net/thread-31329-1-1.html
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |