darknezz21 Posted March 13, 2015 Share Posted March 13, 2015 How would one use _FileCreate and an array to create multiple files? #Include <Array.au3> #include <File.au3> Global $Array1[226] = ["2020bb", "2020bba", "2020bbh", "3countb", "alpham2", "androdun", "aodk", "aof2a", "aof2", "aof3", "aof3k", "aof", "bakatono", "bangbead", "bjourney", "blazstar", "breakers", "breakrev", "bstars2", "bstars", "burningf", "burningh", "crsword", "ct2k3sp", "cthd2003", "ctomaday", "cyberlip", "diggerma", "doubledr", "eightman", "fatfursa", "fatfursp", "fatfury1", "fatfury2", "fatfury3", "fbfrenzy", "fightfev", "fightfva", "flipshot", "fswords", "galaxyfg", "ganryu", "garoubl", "garou", "garouo", "garoup", "ghostlop", "goalx3", "gowcaizr", "gpilots", "gururin", "irrmaze", "janshin", "jockeygp", "joyjoy", "kabukikl", "karnovr", "kf10thep", "kf2k2mp2", "kf2k2mp", "kf2k2pla", "kf2k2pls", "kf2k3bla", "kf2k3bl", "kf2k3pcb", "kf2k3pl", "kf2k3upl", "kf2k5uni", "kizuna", "kof10th", "kof2000n", "kof2000", "kof2001h", "kof2001", "kof2002", "kof2003", "kof2k4se", "kof94", "kof95a", "kof95", "kof96h", "kof96", "kof97a", "kof97pls", "kof97", "kof98k", "kof98n", "kof98", "kof99a", "kof99e", "kof99n", "kof99p", "kof99", "kog", "kotm2", "kotmh", "kotm", "lans2004", "lastblad", "lastbld2", "lastbldh", "lastsold", "lbowling", "legendos", "lresort", "magdrop2", "magdrop3", "maglordh", "maglord", "mahretsu", "marukodq", "matrim", "miexchng", "minasan", "mosyougi", "ms4plus", "ms5pcb", "ms5plus", "mslug2", "mslug3b6", "mslug3", "mslug3n", "mslug4", "mslug5", "mslug", "mslugx", "mutnat", "nam1975", "ncombata", "ncombat", "ncommand", "neobombe", "neocup98", "neodrift", "neogeo", "neomrdo", "ninjamas", "nitd", "overtop", "panicbom", "pbobbl2n", "pbobblen", "pbobblna", "pgoal", "pnyaa", "popbounc", "preisle2", "pspikes2", "pulstar", "puzzldpr", "puzzledp", "quizdai2", "quizdais", "quizkof", "ragnagrd", "rbff1", "rbff2h", "rbff2k", "rbff2", "rbffspec", "ridheroh", "ridhero", "roboarma", "roboarmy", "rotd", "s1945p", "samsh5sh", "samsh5sn", "samsh5sp", "samsho2", "samsho3a", "samsho3", "samsho4", "samsho5b", "samsho5h", "samsho5", "samsho", "savagere", "sdodgeb", "sengokh", "sengoku2", "sengoku3", "sengoku", "shocktr2", "shocktra", "shocktro", "socbrawl", "sonicwi2", "sonicwi3", "spinmast", "ssideki2", "ssideki3", "ssideki4", "ssideki", "stakwin2", "stakwin", "strhoop", "superspy", "svcboot", "svcpcba", "svcpcb", "svcplusa", "svcplus", "svcsplus", "svc", "tophunta", "tophuntr", "tpgolf", "trally", "turfmast", "twinspri", "tws96", "viewpoin", "vlinero", "vliner", "wakuwak7", "wh1h", "wh1", "wh2j", "wh2", "whp", "wjammers", "zedblade", "zintrckb", "zupapa"] $File = "E:\FightCade\config\games\cps.ini" $Read = ClipPut(FileRead($File)) _FileCreate ( $Array1 ) Link to comment Share on other sites More sharing options...
TheSaint Posted March 13, 2015 Share Posted March 13, 2015 (edited) I'm not in the practice of assigning & declaring an array like you have. For me, I would do it this way. Global $a, $Array1 $Array1 = "2020bb, 2020bba, 2020bbh, 3countb, alpham2, androdun, aodk" $Array1 = StringSplit($Array1, ", ", 1) For $a = 1 To $Array1[0] _FileCreate($Array1[$a]) Next Obviously I have truncated your very long string (just for the example), and you could still declare and assign on the same line if you wanted. Also, those are just names, without any extension, so no file type ... and no path. NOTE - Hopefully you've noticed I've removed brackets and extra quotes from your long string, for this to work. I did this not knowing where that long string was coming from. Edited March 13, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
JohnOne Posted March 13, 2015 Share Posted March 13, 2015 _StringSplit($Array1, ", ", 1) Custom UDF ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
darknezz21 Posted March 13, 2015 Author Share Posted March 13, 2015 (edited) Thanks for the reply Saint. When trying to run your example this happens. $Array1 = _StringSplit($Array1, ", ", 1) $Array1 = ^ ERROR My oppologies if I'm going at it wrong with the example. Edited March 13, 2015 by darknezz21 Link to comment Share on other sites More sharing options...
JohnOne Posted March 13, 2015 Share Posted March 13, 2015 Just change it to... StringSplit AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheSaint Posted March 13, 2015 Share Posted March 13, 2015 (edited) Oops, there is no leading underslash. $Array1 = StringSplit($Array1, ", ", 1) Sorry about that. I had a momentary lapse of memory. Fixed the example. P.S. And I use that bugger all the time, would you believe. Edited March 13, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
Chimaera Posted March 13, 2015 Share Posted March 13, 2015 I do mine in a similar way Global $sRegString = "|24x7HELP|331BigDog|*WerKernelReporting|%FP%Friendly fts.exe|*WerKernelReporting|4oD" Global $aRegKeys = StringSplit($sRegString, "|") If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
darknezz21 Posted March 13, 2015 Author Share Posted March 13, 2015 (edited) It works, thanks Saint. Now how would one go about reading a file and copying the text to the clipboard? I tried my hand at it but it just returns a '1' when tested in a message box. #include <File.au3> #Include <Array.au3> Global $a, $Array1 $Array1 = "2020bb, 2020bba, 2020bbh, 3countb, alpham2, androdun, aodk, aof2a, aof2, aof3, aof3k, aof, bakatono, bangbead, bjourney, blazstar, breakers, breakrev, bstars2, bstars, burningf, burningh, crsword, ct2k3sp, cthd2003, ctomaday, cyberlip, diggerma, doubledr, eightman, fatfursa, fatfursp, fatfury1, fatfury2, fatfury3, fbfrenzy, fightfev, fightfva, flipshot, fswords, galaxyfg, ganryu, garoubl, garou, garouo, garoup, ghostlop, goalx3, gowcaizr, gpilots, gururin, irrmaze, janshin, jockeygp, joyjoy, kabukikl, karnovr, kf10thep, kf2k2mp2, kf2k2mp, kf2k2pla, kf2k2pls, kf2k3bla, kf2k3bl, kf2k3pcb, kf2k3pl, kf2k3upl, kf2k5uni, kizuna, kof10th, kof2000n, kof2000, kof2001h, kof2001, kof2002, kof2003, kof2k4se, kof94, kof95a, kof95, kof96h, kof96, kof97a, kof97pls, kof97, kof98k, kof98n, kof98, kof99a, kof99e, kof99n, kof99p, kof99, kog, kotm2, kotmh, kotm, lans2004, lastblad, lastbld2, lastbldh, lastsold, lbowling, legendos, lresort, magdrop2, magdrop3, maglordh, maglord, mahretsu, marukodq, matrim, miexchng, minasan, mosyougi, ms4plus, ms5pcb, ms5plus, mslug2, mslug3b6, mslug3, mslug3n, mslug4, mslug5, mslug, mslugx, mutnat, nam1975, ncombata, ncombat, ncommand, neobombe, neocup98, neodrift, neogeo, neomrdo, ninjamas, nitd, overtop, panicbom, pbobbl2n, pbobblen, pbobblna, pgoal, pnyaa, popbounc, preisle2, pspikes2, pulstar, puzzldpr, puzzledp, quizdai2, quizdais, quizkof, ragnagrd, rbff1, rbff2h, rbff2k, rbff2, rbffspec, ridheroh, ridhero, roboarma, roboarmy, rotd, s1945p, samsh5sh, samsh5sn, samsh5sp, samsho2, samsho3a, samsho3, samsho4, samsho5b, samsho5h, samsho5, samsho, savagere, sdodgeb, sengokh, sengoku2, sengoku3, sengoku, shocktr2, shocktra, shocktro, socbrawl, sonicwi2, sonicwi3, spinmast, ssideki2, ssideki3, ssideki4, ssideki, stakwin2, stakwin, strhoop, superspy, svcboot, svcpcba, svcpcb, svcplusa, svcplus, svcsplus, svc, tophunta, tophuntr, tpgolf, trally, turfmast, twinspri, tws96, viewpoin, vlinero, vliner, wakuwak7, wh1h, wh1, wh2j, wh2, whp, wjammers, zedblade, zintrckb, zupapa" $Array1 = StringSplit($Array1, ", ", 1) For $a = 1 To $Array1[0] _FileCreate($Array1[$a] & ".ini") Next $File = @ScriptDir & "\neo.ini" $Read = ClipPut(FileRead($File)) MsgBox(1, "test", $Read) Edited March 13, 2015 by darknezz21 Link to comment Share on other sites More sharing options...
iamtheky Posted March 13, 2015 Share Posted March 13, 2015 (edited) $string = fileread() clipput($string) though i was recently discouraged from nesting functions, your way works fine....and you are reading text files.... you are msgboxing the output of clipput (which is a 1 or 0), just hit ctrl v to see if its in the clipboard, or msgbox clipget Edited March 13, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
darknezz21 Posted March 13, 2015 Author Share Posted March 13, 2015 Alright, it is copying to the clipboard. Finally how would one write whats in the clipboard to the array of files? #include <File.au3> #Include <Array.au3> #include <FileConstants.au3> Global $a, $Array1 $Array1 = "2020bb, 2020bba, 2020bbh, 3countb, alpham2, androdun, aodk, aof2a, aof2, aof3, aof3k, aof, bakatono, bangbead, bjourney, blazstar, breakers, breakrev, bstars2, bstars, burningf, burningh, crsword, ct2k3sp, cthd2003, ctomaday, cyberlip, diggerma, doubledr, eightman, fatfursa, fatfursp, fatfury1, fatfury2, fatfury3, fbfrenzy, fightfev, fightfva, flipshot, fswords, galaxyfg, ganryu, garoubl, garou, garouo, garoup, ghostlop, goalx3, gowcaizr, gpilots, gururin, irrmaze, janshin, jockeygp, joyjoy, kabukikl, karnovr, kf10thep, kf2k2mp2, kf2k2mp, kf2k2pla, kf2k2pls, kf2k3bla, kf2k3bl, kf2k3pcb, kf2k3pl, kf2k3upl, kf2k5uni, kizuna, kof10th, kof2000n, kof2000, kof2001h, kof2001, kof2002, kof2003, kof2k4se, kof94, kof95a, kof95, kof96h, kof96, kof97a, kof97pls, kof97, kof98k, kof98n, kof98, kof99a, kof99e, kof99n, kof99p, kof99, kog, kotm2, kotmh, kotm, lans2004, lastblad, lastbld2, lastbldh, lastsold, lbowling, legendos, lresort, magdrop2, magdrop3, maglordh, maglord, mahretsu, marukodq, matrim, miexchng, minasan, mosyougi, ms4plus, ms5pcb, ms5plus, mslug2, mslug3b6, mslug3, mslug3n, mslug4, mslug5, mslug, mslugx, mutnat, nam1975, ncombata, ncombat, ncommand, neobombe, neocup98, neodrift, neogeo, neomrdo, ninjamas, nitd, overtop, panicbom, pbobbl2n, pbobblen, pbobblna, pgoal, pnyaa, popbounc, preisle2, pspikes2, pulstar, puzzldpr, puzzledp, quizdai2, quizdais, quizkof, ragnagrd, rbff1, rbff2h, rbff2k, rbff2, rbffspec, ridheroh, ridhero, roboarma, roboarmy, rotd, s1945p, samsh5sh, samsh5sn, samsh5sp, samsho2, samsho3a, samsho3, samsho4, samsho5b, samsho5h, samsho5, samsho, savagere, sdodgeb, sengokh, sengoku2, sengoku3, sengoku, shocktr2, shocktra, shocktro, socbrawl, sonicwi2, sonicwi3, spinmast, ssideki2, ssideki3, ssideki4, ssideki, stakwin2, stakwin, strhoop, superspy, svcboot, svcpcba, svcpcb, svcplusa, svcplus, svcsplus, svc, tophunta, tophuntr, tpgolf, trally, turfmast, twinspri, tws96, viewpoin, vlinero, vliner, wakuwak7, wh1h, wh1, wh2j, wh2, whp, wjammers, zedblade, zintrckb, zupapa" $Array1 = StringSplit($Array1, ", ", 1) For $a = 1 To $Array1[0] _FileCreate($Array1[$a] & ".ini") Next $File = @ScriptDir & "\neo.ini" $Read = ClipPut(FileRead($File)) ;MsgBox(1, $Array1, $Array1) For $a = 1 To $Array1[0] FileWrite($Array1[$a] & ".ini", $Read) Next Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2015 Moderators Share Posted March 13, 2015 darknezz21,I see "$File = "E:FightCadeconfiggamescps.ini"" in the code you posted - what exactly are you trying to do here? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
darknezz21 Posted March 13, 2015 Author Share Posted March 13, 2015 (edited) Hi Melba23. It's for an emulator that has you setup keys for each game individually as you load them. The concept here is that it will take a predefined config for a capcom.ini and a neogeo.ini and write the configs for each game using a capcom setup and a neo geo setup. It's just a pain to setup keys for a game you havn't played yet on fightcade. My buddy hosts a stream on twitch where everyone joins a queue to play random games with other people, but more often than not new comers don't have keys setup for the games yet and everyone has to wait. Edit: This is his channel if anyone were interested in such an event:) Edit2: Cobbled something together that works using the example in FileWrite. Thanks again for the help everyone. Edited March 13, 2015 by darknezz21 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 13, 2015 Moderators Share Posted March 13, 2015 darknezz21,That sounds perilously close to being off-limits. As you are obviously a keen gamer, could I suggest that you read our Forum rules before you post again - no-one wants you to fall foul of them. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now