Jump to content

Recommended Posts

Posted (edited)

Are there string limitations in autoit?

Ive been having some problems splitting a string using the native StringSplit() function, where an empty array is being returned and @error is set which = 0 (which I also cannot find reference to)

Thought it might be a scite limitation as the string was all on one line, so tried to use & _

for multiple lines, tried Tidy and recieved this error

!> File contains records longer than 4095 characters .. stopping process.

Here is the string which is one complete line, its quite long.

  Reveal hidden contents

#include <Array.au3>
$sString = 'the above string'
$aString = StringSplit($sString, "],[", 3)
_ArrayDisplay($aString)

Any Idea what could be causing this?

EDIT: forgot code.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

This works fine for me. Imho the 4095 character limit is imposed by SciTE only, can be circumvented like shown below.

#include <Array.au3>
$sString = '"torrents_start_stopped",1,"false"],["confirm_when_deleting",1,"true"],["install_revision",0,"19648"],["settings_saved_systime",0,"1277287203"],["confirm_exit",1,"false"],["close_to_tray",1,"true"],' _
         & '["minimize_to_tray",1,"false"],["tray_activate",1,"true"],["tray.show",1,"true"],["tray.single_click",1,"false"],["activate_on_file",1,"true"],["confirm_remove_tracker",1,"true"],' _
         & '["check_assoc_on_start",1,"true"],["reload_freq",0,"0"],["bind_port",0,"54329"],["tracker_ip",2,""],["dir_active_download_flag",1,"false"],["dir_torrent_files_flag",1,"false"],' _
         & '["dir_completed_download_flag",1,"false"],["dir_completed_torrents_flag",1,"false"],["dir_active_download",2,""],["dir_torrent_files",2,""],["dir_completed_download",2,""],["dir_completed_torrents",2,""],' _
         & '["dir_add_label",1,"false"],["max_dl_rate",0,"250"],["max_ul_rate",0,"0"],["max_ul_rate_seed",0,"0"],["max_ul_rate_seed_flag",1,"false"],["gui.ulrate_menu",2,"0,5,10,15,20,30,40,50,100,150,200,300,400,500"],' _
         & '["gui.dlrate_menu",2,"0,5,10,15,20,30,40,50,100,150,200,300,400,500"],["gui.manual_ratemenu",1,"false"],["gui.auto_restart",1,"true"],["gui.report_problems",1,"true"],["gui.persistent_labels",2,""],' _
         & '["gui.compat_diropen",1,"false"],["gui.alternate_color",1,"false"],["gui.transparent_graph_legend",1,"false"],["sys.prevent_standby",1,"true"],["sys.enable_wine_hacks",1,"true"],["ul_slots_per_torrent",0,"4"],' _
         & '["conns_per_torrent",0,"85"],["conns_globally",0,"350"],["max_active_torrent",0,"4"],["max_active_downloads",0,"3"],["seed_prio_limitul",0,"4"],["seed_prio_limitul_flag",1,"false"],'
$sString &= '["seeds_prioritized",1,"false"],["seed_ratio",0,"1500"],["seed_time",0,"0"],["move_if_defdir",1,"true"],["mainwnd_split",0,"348"],["mainwnd_split_x",0,"110"],["resolve_peerips",1,"true"],' _
         & '["check_update",1,"true"],["check_update_beta",1,"false"],["anoninfo",1,"true"],["upnp",1,"true"],["natpmp",1,"true"],["lsd",1,"true"],["disable_fw",1,"true"],["k",2,""],["v",0,"67456192"],' _
         & '["pd",0,"0"],["pu",0,"0"],["asip",2,""],["asdlurl",2,""],["asdns",0,"0"],["ascon",0,"0"],["asdl",0,"0"],["as2ip",2,""],["as2dlurl",2,""],["as2dns",0,"0"],["as2con",0,"0"],["as2dl",0,"0"],' _
         & '["sched_enable",1,"true"],["sched_ul_rate",0,"0"],["sched_dl_rate",0,"0"],["sched_dis_dht",1,"true"],["webui.remote_enable",1,"false"],["enable_scrape",1,"true"],["show_toolbar",1,"true"],' _
         & '["show_details",1,"true"],["show_status",1,"true"],["show_category",1,"true"],["show_tabicons",1,"true"],["rand_port_on_start",1,"false"],["prealloc_space",1,"false"],["language",0,"-1"],' _
         & '["logger_mask",0,"0"],["allow_pairing",1,"true"],["autostart",1,"false"],["dht",1,"true"],["dht_per_torrent",1,"true"],["pex",1,"true"],["rate_limit_local_peers",1,"false"],' _
         & '["multi_day_transfer_limit_en",1,"false"],["multi_day_transfer_mode_ul",1,"false"],["multi_day_transfer_mode_dl",1,"false"],["multi_day_transfer_mode_uldl",1,"true"],'
$sString &= '["multi_day_transfer_limit_unit",0,"1"],["multi_day_transfer_limit_value",0,"200"],["multi_day_transfer_limit_span",0,"11"],["net.bind_ip",2,""],["net.outgoing_ip",2,""],' _
         & '["net.outgoing_port",0,"0"],["net.outgoing_max_port",0,"0"],["net.low_cpu",1,"false"],["net.calc_overhead",1,"false"],["net.max_halfopen",0,"400"],["net.wsaevents",0,"6"],' _
         & '["net.limit_excludeslocal",1,"false"],["net.upnp_tcp_only",1,"false"],["isp.bep22",1,"false"],["dir_autoload_flag",1,"false"],["dir_autoload_delete",1,"false"],["dir_autoload",2,""],' _
         & '["notify_complete",1,"true"],["extra_ulslots",1,"true"],["ipfilter.enable",1,"true"],["dht.rate",0,"-1"],["extras",0,"2"],["score",0,"0"],["append_incomplete",1,"false"],' _
         & '["show_add_dialog",1,"true"],["always_show_add_dialog",1,"true"],["gui.log_date",1,"true"],["ct_hist_comm",2,""],["ct_hist_flags",0,"0"],["ct_hist_skip",2,""],["boss_key",0,"0"],'
$sString &= '["encryption_mode",0,"2"],["encryption_allow_legacy",1,"true"],["rss.update_interval",0,"15"],["rss.smart_repack_filter",1,"true"],["rss.feed_as_default_label",1,"true"],' _
         & '["gui.dblclick_seed",0,"2"],["gui.dblclick_dl",0,"0"],["gui.update_rate",0,"1000"],["gui.sg_mode",0,"1"],["gui.delete_to_trash",1,"true"],["gui.default_del_action",0,"0"],' _
         & '["gui.speed_in_title",1,"false"],["gui.limits_in_statusbar",1,"false"],["gui.graphic_progress",1,"true"],["gui.piecebar_progress",1,"false"],["gui.tall_category_list",1,"true"],' _
         & '["gui.bypass_search_redirect",1,"false"],["gui.last_preference_tab-1.8",0,"9"],["gui.last_overview_tab-1.8",0,"0"],["exe_path",2,"C:\\ProgramFiles\\uTorrent\\uTorrent.exe"],' _
         & '["queue.dont_count_slow_dl",1,"true"],["queue.dont_count_slow_ul",1,"true"],["queue.slow_dl_threshold",0,"1000"],["queue.slow_ul_threshold",0,"1000"],["queue.use_seed_peer_ratio",1,"true"],' _
         & '["queue.prio_no_seeds",1,"true"],["bt.tcp_rate_control",1,"true"],["gui.graph_tcp_rate_control",1,"false"],["gui.graph_overhead",1,"true"],["gui.graph_legend",1,"true"],'
$sString &= '["bt.ratelimit_tcp_only",1,"false"],["bt.transp_disposition",0,"31"],["net.utp_target_delay",0,"100"],["net.utp_packet_size_interval",0,"5"],["net.utp_receive_target_delay",0,"100"],' _
         & '["net.utp_initial_packet_size",0,"4"],["net.utp_dynamic_packet_size",1,"true"],["net.discoverable",1,"true"],["bt.scrape_stopped",1,"false"],["bt.compact_allocation",1,"false"],' _
         & '["bt.enable_tracker",1,"false"],["bt.multiscrape",1,"true"],["bt.send_have_to_seed",1,"true"],["bt.set_sockbuf",1,"false"],["bt.connect_speed",0,"10"],["bt.prio_first_last_piece",1,"false"],' _
         & '["bt.allow_same_ip",1,"false"],["bt.no_connect_to_services",1,"true"],["bt.no_connect_to_services_list",2,"25,110,6666,6667"],["bt.ban_threshold",0,"3"],["bt.use_ban_ratio",1,"true"],' _
         & '["bt.ban_ratio",0,"128"],["bt.use_rangeblock",1,"true"],["bt.graceful_shutdown",1,"true"],["bt.shutdown_tracker_timeout",0,"15"],["bt.shutdown_upnp_timeout",0,"5"],' _
         & '["peer.lazy_bitfield",1,"true"],["peer.resolve_country",1,"false"],["peer.disconnect_inactive",1,"true"],["peer.disconnect_inactive_interval",0,"300"],["diskio.flush_files",1,"true"],'
$sString &= '["diskio.sparse_files",1,"false"],["diskio.no_zero",1,"true"],["diskio.use_partfile",1,"true"],["diskio.smart_hash",1,"true"],["diskio.smart_sparse_hash",1,"true"],' _
         & '["diskio.coalesce_writes",1,"true"],["diskio.coalesce_write_size",0,"2097152"],["cache.override",1,"false"],["cache.override_size",0,"32"],["cache.reduce",1,"true"],' _
         & '["cache.write",1,"true"],["cache.writeout",1,"true"],["cache.writeimm",1,"true"],["cache.read",1,"true"],["cache.read_turnoff",1,"true"],["cache.read_prune",1,"true"],' _
         & '["cache.read_thrash",1,"false"],["cache.disable_win_read",1,"true"],["cache.disable_win_write",1,"true"],["webui.enable",0,"1"],["webui.enable_guest",0,"0"],' _
         & '["webui.enable_listen",0,"1"],["webui.token_auth",1,"true"],["webui.username",2,"admin0"],["webui.password",2,"******"],["webui.guest",2,"guest"],'
$sString &= '["webui.restrict",2,"192.168.1.100"],["webui.port",0,"65439"],' _
         & '["webui.cookie",2,"{\"showDetails\":true,\"showCategories\":true,\"showToolbar\":true,\"showTitleSpeed\":false,\"updateInterval\":3000,\"alternateRows\":false,\"maxRows\":50,\"confirmDelete\":true,\"lang\":\"en\",\"hSplit\":-1,\"vSplit\":-1,\"torrentTable\":{\"rowsSelectable\":true,\"colMask\":78088,\"colOrder\":[],\"colWidth\":[],\"reverse\":false,\"sIndex\":-1},\"fileTable\":{\"colMask\":0,\"colOrder\":[],\"colWidth\":[],\"reverse\":false,\"sIndex\":-1},\"activeLabel\":\"_all_\"}"],' _
         & '["proxy.proxy",2,""],["proxy.type",0,"0"],["proxy.port",0,"8080"],["proxy.auth",1,"false"],["proxy.p2p",1,"false"],["proxy.resolve",1,"false"],["proxy.username",2,""],["proxy.password",2,""'
$aString = StringSplit($sString, "],[", 3)
_ArrayDisplay($aString)
Posted (edited)

  Quote

MAX_LINESIZE = 4095 Maximum size for a line of script.

See help AutoIt Help -> AutoIt3 Limits/defaults

Alternative way... :mellow:

#include <Array.au3>  
$x =FileOpen(".\urstring.txt",0)  
$sString = FileRead($x)  
$aString = StringSplit($sString, "],[", 3)  
_ArrayDisplay($aString)
Edited by ichigo325

[size="2"][font="Lucida Sans Unicode"][b][/b][/font][/size]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...