Changeset 228 for trunk/lingosource
- Timestamp:
- 03/20/09 18:08:22 (3 years ago)
- Location:
- trunk/lingosource
- Files:
-
- 10 edited
-
castlib1/OSCmenu_Utilities.ls (modified) (3 diffs)
-
castlib1/alexUtilities.ls (modified) (1 diff)
-
castlib1/memberInfo.xml (modified) (22 diffs)
-
castlib1/subversion_version_field.txt (modified) (1 diff)
-
castlib1/svn_Utilities.ls (modified) (3 diffs)
-
castlib2/GetSetPrefs.ls (modified) (1 diff)
-
castlib2/PseudoXMLPS.ls (modified) (19 diffs)
-
castlib2/aleXtrasMovieScript.ls (modified) (2 diffs)
-
castlib2/commonMovieScript.ls (modified) (4 diffs)
-
castlib2/memberInfo.xml (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lingosource/castlib1/OSCmenu_Utilities.ls
r221 r228 186 186 li.add(subli) 187 187 188 subli.add("Export sel cetd text as...")189 pLookUpCommandList.setaprop("Export sel cetd text as...", ["mExportSelectedText me, theType_optional", "alexUtilities"])188 subli.add("Export selected text as...") 189 pLookUpCommandList.setaprop("Export selected text as...", ["mExportSelectedText me, theType_optional", "alexUtilities"]) 190 190 191 191 subli.add("") … … 196 196 pLookUpCommandList.setaprop("Export to bitmap...", ["mExportBM me, theMember, thePath_optional, theType_optional, compr_optional", "alexUtilities"]) 197 197 198 subli.add("Export script-, text-, fieldmember...") 199 pLookUpCommandList.setaprop("Export script-, text-, fieldmember...", ["mExportScripttext me, skipIcons_optional, convertLineBreaksToUnix_optional, theFolder_optional", "alexUtilities"]) 198 200 199 201 … … 312 314 subli = [] 313 315 svn_subli.add(subli) 316 317 subli.add("SVN Update all castlibs") 318 pLookUpCommandList.setaprop("SVN Update all castlibs", ["mSVN_Update_AllCastlib_and_source me, chooseNewPath_optional, onlyUpdate_SVN_WorkingFolder_optional, revisionNumber_optional", "svn_Utilities"]) 314 319 315 320 subli.add("SVN Update selected castlib(s)...") -
trunk/lingosource/castlib1/alexUtilities.ls
r221 r228 2432 2432 end 2433 2433 2434 2434 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2435 2436 on mExportScripttext me, skipIcons, convertLineBreaksToUnix, theFolder 2437 2438 2439 theFolder = string(theFolder) 2440 if length(theFolder) < 1 then theFolder = mGetFolderPathFromUser(me) 2441 if length(theFolder) < 1 then exit 2442 2443 if the last char of theFolder <> the last char of the moviepath then put the last char of the moviepath after theFolder 2444 2445 2446 cl = the activecastlib 2447 sel = the selection of castlib cl 2448 firstCastNum = cl 2449 lastCastNum = cl 2450 2451 2452 DirectImageInstance = 0 2453 if skipIcons <> 1 then 2454 if mCheckForXtra(me, "SharpExport") = 1 then 2455 SharpExportInst = new(xtra "SharpExport") 2456 else 2457 skipIcons = 1 2458 end if 2459 end if 2460 2461 2462 isMac = (the platform contains "mac") -- we need the differentiation because of the dreaded 31 char limit 2463 2464 ----------------------- 2465 resetUNames = 0 2466 if isMac then 2467 if baSysFolder("prefs") starts "/" then 2468 baReturnUnixNames(0) 2469 resetUNames = 1 2470 end if 2471 end if 2472 ----------------------- 2473 2474 doit = 0 2475 versionNum = mGetFloatVersionNumber(me, the productversion) 2476 2477 repeat with m = firstCastNum to lastCastNum 2478 2479 listOfAllFiles = [] 2480 2481 thisFolder = theFolder 2482 2483 doit = 0 2484 2485 sel = the selection of castlib m 2486 2487 repeat with sub in sel 2488 repeat with n = sub[1] to sub[2] 2489 2490 memref = member(n, m) 2491 memtype = memref.type 2492 2493 convertLineBreaksToUnixT = 0 2494 2495 if [#script, #field, #text].getPos(memtype) > 0 then 2496 2497 case memtype of 2498 2499 ----------------------- 2500 #script: 2501 ext = ".ls" 2502 scrText = memref.scripttext 2503 scrtype = memref.scripttype 2504 2505 ------------------------------ meta data 2506 infolist = [:] 2507 infolist[#name] = memref.name 2508 infolist[#scripttype] = memref.scripttype 2509 if versionNum >= 10 then infolist[#scriptSyntax] = memref.scriptSyntax 2510 comm = memref.comments 2511 offs = offset(RETURN, comm) 2512 repeat while offs 2513 put QUOTE & " & RETURN & " & QUOTE into char offs of comm 2514 end repeat 2515 infolist[#comments] = comm 2516 2517 offs2 = 0 2518 export_meta_data = scrText&"" 2519 offs = offset("--!memberProperties:", export_meta_data) 2520 if offs > 0 then 2521 delete char 1 to offs of export_meta_data 2522 offs2 = offset("]", export_meta_data) 2523 end if 2524 2525 if offs2 > 0 then 2526 put "--!memberProperties:" && infolist into char offs to offs + offs2 of scrText 2527 else 2528 put "--!memberProperties:" && infolist & RETURN before scrText 2529 end if 2530 2531 ------------------------------ 2532 2533 ----------------------- 2534 #field: 2535 ext = ".txt" 2536 scrText = memref.text 2537 scrtype = #field 2538 ----------------------- 2539 #text: 2540 ext = ".html" 2541 scrText = memref.html 2542 convertLineBreaksToUnixT = 0 2543 scrtype = #text 2544 ----------------------- 2545 otherwise: 2546 ext = ".txt" 2547 scrText = memref.text 2548 scrtype = #field 2549 end case 2550 2551 memname = memref.name 2552 2553 theDefaultName = memname 2554 2555 doit = 1 2556 2557 if length(theDefaultName) < 1 then 2558 theDefaultName = "member" & n & "_" & m 2559 memref.name = theDefaultName 2560 put "renamed member" && memref && "to member(" & QUOTE & theDefaultName & QUOTE & ") as member without names are not supported" 2561 end if 2562 2563 theDefaultName = mStripFunnyCharsFromFileName(me, theDefaultName) 2564 2565 origname = theDefaultName&"" 2566 if length(theDefaultName) > 25 and isMac then 2567 2568 ms = string(the milliseconds) 2569 mlen = length(ms) 2570 ms = char mlen - 6 to mlen of ms 2571 2572 theDefaultName = char 1 to 18 of theDefaultName 2573 theDefaultName = theDefaultName & ms -- trim filenames as the mac version of fileio wants to deal with 31 chars 2574 2575 end if 2576 2577 2578 2579 ------------------------------------------ trac subversion support works better with unix linebreaks... 2580 if voidP(convertLineBreaksToUnix) then convertLineBreaksToUnix = 1 2581 if convertLineBreaksToUnix = "" then convertLineBreaksToUnix = 1 2582 2583 if convertLineBreaksToUnix = 1 then 2584 if convertLineBreaksToUnixT <> 1 then 2585 if mCheckForXtra(me, "Pregex") = 1 then 2586 2587 scrTextLi = [scrText] 2588 pregex_replace(scrTextLi, "\x0D\x0A?", "g", "\x0A") 2589 scrText = scrTextLi[1] 2590 2591 else 2592 2593 fndStr = numToChar(13) & numToChar(10) 2594 offs = offset(fndStr, scrText) 2595 repeat while offs > 0 2596 delete char offs of scrText 2597 offs = offset(fndStr, scrText) 2598 end repeat 2599 2600 fndStr = numToChar(13) 2601 offs = offset(fndStr, scrText) 2602 repeat while offs > 0 2603 put numToChar(10) into char offs of scrText 2604 offs = offset(fndStr, scrText) 2605 end repeat 2606 end if 2607 end if 2608 end if 2609 ----------------------------------------- 2610 2611 if theDefaultName <> origname then 2612 alterText = "" 2613 snam = baShortFileName(thisFolder & origname & ext) 2614 if length(snam) > 0 then 2615 alterText = mGetTextFromFile(me, snam) 2616 else 2617 alterText = mGetTextFromFile(me, thisFolder & origname & ext) 2618 end if 2619 else 2620 alterText = mGetTextFromFile(me, thisFolder & theDefaultName & ext) 2621 end if 2622 2623 listOfAllFiles.add(mLowerCase(me, origname)) 2624 2625 if alterText <> scrText then 2626 2627 --------------------- compare without whitespaces: 2628 noChanges = (mRemoveWhiteSpaces(me, scrText&"") = mRemoveWhiteSpaces(me, alterText&"")) 2629 2630 2631 if noChanges = 0 then 2632 2633 mSaveToTextFile me, scrText, thisFolder & theDefaultName & ext 2634 2635 bmexp = 0 2636 if skipIcons <> 1 then 2637 2638 thumbmember = new(#bitmap) 2639 thumbmember.picture = memref.thumbnail 2640 2641 if thumbmember.width > 0 then 2642 bmexp = 1 2643 if baFileExists(thisFolder & theDefaultName & ".png") then baDeleteFile(thisFolder & theDefaultName & ".png") 2644 2645 if objectP(DirectImageInstance) then 2646 2647 DirectImageInstance.imageLoadFromMember(thumbmember) 2648 DirectImageInstance.imageSaveToFile(thisFolder & theDefaultName & ".png", 100, 1,1) 2649 2650 else if objectP(SharpExportInst) then 2651 mExportBM me, thumbmember, thisFolder & theDefaultName & ".png", "png", 100, SharpExportInst 2652 2653 end if 2654 end if 2655 2656 thumbmember.erase() 2657 2658 end if 2659 2660 2661 if theDefaultName <> origname then 2662 2663 snam = baShortFileName(thisFolder & origname & ext) 2664 if length(snam) > 0 then baDeleteFile(snam) 2665 erg = baRenameFile(thisFolder & theDefaultName & ext, thisFolder & origname & ext) 2666 if erg <> 1 then put "Couldn't rename file " & thisFolder & theDefaultName & ext & " to " & thisFolder & origname & ext 2667 if bmexp = 1 then 2668 snam = baShortFileName(thisFolder & origname & ".png") 2669 if length(snam) > 0 then baDeleteFile(snam) 2670 erg = baRenameFile(thisFolder & theDefaultName & ".png", thisFolder & origname & ".png") 2671 if erg <> 1 then put "Couldn't rename file " & thisFolder & theDefaultName & ".png to " & thisFolder & origname & ".png" 2672 end if 2673 2674 end if 2675 2676 if origname <> memname then 2677 put "Renamed member" && memref && "to" && origname & ". Scriptmember names must not be emoty or contain illegal characters (SPACE, /, :, \, &)" 2678 end if 2679 2680 end if 2681 end if 2682 2683 end if 2684 end repeat 2685 end repeat 2686 2687 end repeat 2688 2689 if resetUNames = 1 then baReturnUnixNames(1) 2690 2691 DirectImageInstance = 0 2692 SharpExportInst = 0 2693 2694 end 2435 2695 2436 2696 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
trunk/lingosource/castlib1/memberInfo.xml
r223 r228 5 5 <comments>http://www.farbflash.de/cgi-bin/versionChecker.pl?movieName=HandlerMenu_OSC</comments> 6 6 <memberName>subversion_version_field</memberName> 7 <f Name>subversion_version_field</fName>7 <fname>subversion_version_field</fname> 8 8 </subversion_version_field> 9 9 <doCommandMovieScript> … … 11 11 <comments></comments> 12 12 <memberName>doCommandMovieScript</memberName> 13 <f Name>doCommandMovieScript</fName>13 <fname>doCommandMovieScript</fname> 14 14 </doCommandMovieScript> 15 15 <thisMoviesScript> … … 17 17 <comments></comments> 18 18 <memberName>thisMoviesScript</memberName> 19 <f Name>thisMoviesScript</fName>19 <fname>thisMoviesScript</fname> 20 20 </thisMoviesScript> 21 21 <keyboardNavigation_FrameLoop> … … 23 23 <comments></comments> 24 24 <memberName>keyboardNavigation_FrameLoop</memberName> 25 <f Name>keyboardNavigation_FrameLoop</fName>25 <fname>keyboardNavigation_FrameLoop</fname> 26 26 </keyboardNavigation_FrameLoop> 27 27 <menu1_button> … … 29 29 <comments></comments> 30 30 <memberName>menu1_button</memberName> 31 <f Name>menu1_button</fName>31 <fname>menu1_button</fname> 32 32 </menu1_button> 33 33 <menu2_button> … … 35 35 <comments></comments> 36 36 <memberName>menu2_button</memberName> 37 <f Name>menu2_button</fName>37 <fname>menu2_button</fname> 38 38 </menu2_button> 39 39 <simpleBMMenu> … … 41 41 <comments></comments> 42 42 <memberName>simpleBMMenu</memberName> 43 <f Name>simpleBMMenu</fName>43 <fname>simpleBMMenu</fname> 44 44 </simpleBMMenu> 45 45 <OSCmenu_Utilities> … … 47 47 <comments></comments> 48 48 <memberName>OSCmenu_Utilities</memberName> 49 <f Name>OSCmenu_Utilities</fName>49 <fname>OSCmenu_Utilities</fname> 50 50 </OSCmenu_Utilities> 51 51 <alexUtilities> … … 53 53 <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 54 54 <memberName>alexUtilities</memberName> 55 <f Name>alexUtilities</fName>55 <fname>alexUtilities</fname> 56 56 </alexUtilities> 57 57 <bbedit_Utilities> … … 59 59 <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 60 60 <memberName>bbedit_Utilities</memberName> 61 <f Name>bbedit_Utilities</fName>61 <fname>bbedit_Utilities</fname> 62 62 </bbedit_Utilities> 63 63 <svn_Utilities> … … 65 65 <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 66 66 <memberName>svn_Utilities</memberName> 67 <f Name>svn_Utilities</fName>67 <fname>svn_Utilities</fname> 68 68 </svn_Utilities> 69 69 <custom_Utilities> … … 71 71 <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 72 72 <memberName>custom_Utilities</memberName> 73 <f Name>custom_Utilities</fName>73 <fname>custom_Utilities</fname> 74 74 </custom_Utilities> 75 75 <convert_Lingo_2_CSS_Html> … … 77 77 <comments>~/Documents/Scripts/lingo/convert_Lingo_2_CSS_Html.ls</comments> 78 78 <memberName>convert_Lingo_2_CSS_Html</memberName> 79 <f Name>convert_Lingo_2_CSS_Html</fName>79 <fname>convert_Lingo_2_CSS_Html</fname> 80 80 </convert_Lingo_2_CSS_Html> 81 81 <OSCmenu_Handlers> … … 83 83 <comments></comments> 84 84 <memberName>OSCmenu_Handlers</memberName> 85 <f Name>OSCmenu_Handlers</fName>85 <fname>OSCmenu_Handlers</fname> 86 86 </OSCmenu_Handlers> 87 87 <pastefeld> … … 89 89 <comments></comments> 90 90 <memberName>pastefeld</memberName> 91 <f Name>pastefeld</fName>91 <fname>pastefeld</fname> 92 92 </pastefeld> 93 93 <oldclipboard> … … 95 95 <comments></comments> 96 96 <memberName>oldclipboard</memberName> 97 <f Name>oldclipboard</fName>97 <fname>oldclipboard</fname> 98 98 </oldclipboard> 99 99 <searchword> … … 101 101 <comments></comments> 102 102 <memberName>searchword</memberName> 103 <f Name>searchword</fName>103 <fname>searchword</fname> 104 104 </searchword> 105 105 <resizewindowfs> … … 107 107 <comments></comments> 108 108 <memberName>resizewindowfs</memberName> 109 <f Name>resizewindowfs</fName>109 <fname>resizewindowfs</fname> 110 110 </resizewindowfs> 111 111 <showHideHelp> … … 113 113 <comments></comments> 114 114 <memberName>showHideHelp</memberName> 115 <f Name>showHideHelp</fName>115 <fname>showHideHelp</fname> 116 116 </showHideHelp> 117 117 <helptext> … … 122 122 rtf</comments> 123 123 <memberName>helptext</memberName> 124 <f Name>helptext</fName>124 <fname>helptext</fname> 125 125 </helptext> 126 126 <texthyperlinkBehavior> … … 128 128 <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/texthyperlinkBehavior.ls</comments> 129 129 <memberName>texthyperlinkBehavior</memberName> 130 <f Name>texthyperlinkBehavior</fName>130 <fname>texthyperlinkBehavior</fname> 131 131 </texthyperlinkBehavior> 132 132 <statusOutput> … … 137 137 rtf</comments> 138 138 <memberName>statusOutput</memberName> 139 <f Name>statusOutput</fName>139 <fname>statusOutput</fname> 140 140 </statusOutput> 141 141 </Untitled> -
trunk/lingosource/castlib1/subversion_version_field.txt
r225 r228 1 r2 271 r230 -
trunk/lingosource/castlib1/svn_Utilities.ls
r225 r228 1393 1393 1394 1394 if ilk(infolist) <> #proplist then 1395 infolistPath = thePath & "memberInfo.xml" 1396 infolist = mReadXML_2_List(me, infolistPath) 1397 if ilk(infolist) <> #proplist then infolist = [:] 1398 1399 infolist = infolist.getaprop(symbol(fname)) 1400 if ilk(infolist) <> #proplist then infolist = [:] 1395 1396 offs = offset("--!memberProperties:", scrtext) 1397 1398 if offs > 0 then 1399 infolist = scrtext.char[offs + 20 .. length(scrtext)] 1400 offs = offset("]", infolist) 1401 if offs > 0 then 1402 infolist = value(infolist.char[1 .. offs]) 1403 end if 1404 end if 1405 1406 if ilk(infolist) <> #proplist then 1407 infolistPath = thePath & "memberInfo.xml" 1408 infolist = mReadXML_2_List(me, infolistPath) 1409 if ilk(infolist) <> #proplist then infolist = [:] 1410 1411 infolist = infolist.getaprop(symbol(fname)) 1412 if ilk(infolist) <> #proplist then infolist = [:] 1413 end if 1414 1401 1415 end if 1402 1416 … … 2549 2563 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2550 2564 2565 on mSVN_Update_AllCastlibs_and_source me, chooseNewPath, onlyUpdate_SVN_WorkingFolder, selectionList, revisionNumber, dontShowAlert 2566 mSVN_Update_Working_Copy_ScriptText me, revisionNumber, void, #all, 1 2567 mSVN_Update_SelectedCastlib me, chooseNewPath, onlyUpdate_SVN_WorkingFolder, #all, revisionNumber, dontShowAlert 2568 end 2569 2570 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2571 2551 2572 on mSVN_Update_SelectedCastlib_and_source me, chooseNewPath, onlyUpdate_SVN_WorkingFolder, selectionList, revisionNumber, dontShowAlert 2552 2573 mSVN_Update_Working_Copy_ScriptText me, revisionNumber, void, selectionList, 1 … … 2560 2581 castlibList = 0 2561 2582 2562 selectionList = string(selectionList) 2563 if length(selectionList) > 0 then 2564 2565 offs = offset("'", selectionList) 2566 repeat while offs > 0 2567 put QUOTE into char offs of selectionList 2583 if symbolP(selectionList) then 2584 -- #all 2585 clnum = the number of castlibs 2586 castlibList = [] 2587 repeat with n = 1 to clnum 2588 castlibList.add(n) 2589 end repeat 2590 2591 else 2592 2593 selectionList = string(selectionList) 2594 if length(selectionList) > 0 then 2595 2568 2596 offs = offset("'", selectionList) 2569 end repeat 2570 2571 if char 1 of selectionList <> "[" then put "[" before selectionList 2572 if the last char of selectionList <> "]" then put "]" after selectionList 2573 2574 selectionList = value(selectionList) 2575 if listP(selectionList) then 2576 clnum = the number of castlibs + 1 2577 castlibList = [] 2578 selectionListCnt = count(selectionList) 2579 repeat with n = 1 to selectionListCnt 2580 2581 cl = castlib(selectionList[n]) 2582 if ilk(cl) = #castlib then 2583 int = cl.number 2584 if castlibList.getPos(int) < 1 then 2585 castlibList.add(int) 2586 end if 2587 else 2588 int = integer(selectionList[n]) 2589 if integerP(int) then 2590 if clnum > int then 2591 if castlibList.getPos(int) < 1 then castlibList.add(int) 2597 repeat while offs > 0 2598 put QUOTE into char offs of selectionList 2599 offs = offset("'", selectionList) 2600 end repeat 2601 2602 if char 1 of selectionList <> "[" then put "[" before selectionList 2603 if the last char of selectionList <> "]" then put "]" after selectionList 2604 2605 selectionList = value(selectionList) 2606 if listP(selectionList) then 2607 clnum = the number of castlibs + 1 2608 castlibList = [] 2609 selectionListCnt = count(selectionList) 2610 repeat with n = 1 to selectionListCnt 2611 2612 cl = castlib(selectionList[n]) 2613 if ilk(cl) = #castlib then 2614 int = cl.number 2615 if castlibList.getPos(int) < 1 then 2616 castlibList.add(int) 2617 end if 2618 else 2619 int = integer(selectionList[n]) 2620 if integerP(int) then 2621 if clnum > int then 2622 if castlibList.getPos(int) < 1 then castlibList.add(int) 2623 end if 2592 2624 end if 2593 2625 end if 2594 end if2595 end repeat2626 end repeat 2627 end if 2596 2628 end if 2597 2629 end if -
trunk/lingosource/castlib2/GetSetPrefs.ls
r186 r228 179 179 -- delete line 1 of prefsText 180 180 181 gPrefs = call(#mGetListFromXMLString , mGetXScript(#PseudoXMLPS), prefsText)181 gPrefs = call(#mGetListFromXMLStringX, mGetXScript(#PseudoXMLPS), prefsText) 182 182 if objectP(gPrefs) then globs[#gPrefs] = gPrefs 183 183 -
trunk/lingosource/castlib2/PseudoXMLPS.ls
r215 r228 2 2 ----------------------------------- 3 3 -- CREATED: 4 -- 06.03.20084 -- 2002 5 5 -- 6 6 -- DESCRIPTION: 7 7 -- Pseudo XML by Alex da Franca c2003 8 -- Convert a lingo list to a XML like string and back8 -- Convert a lingo list to a XML like string and back 9 9 10 10 -- 11 11 -- REQUIRES: 12 -- (Prerequisites) 12 -- only the functions mSaveList_2_XML() and mReadXML_2_List() require my system of library scripts 13 -- in order to write and read text with fileio. All other functions have no dependencies 14 -- Either get these scripts from my website, or replace the write/read stuff with your own fileIO handlers 15 -- That is: 16 -- * movie script "aleXtrasMovieScript" 17 -- * parent script "commonMovieScript" 18 -- * parent script "FileIOFunktionen" 13 19 -- 14 20 -- USAGE: 21 -- ---------- please see the comments for each handler for a how-to. 22 -- ---------- nonetheless here are some fast start comments with the minimum amount of parameters 23 -- PseudoXMLPS = new(script "PseudoXMLPS") 24 -- -- Convert a list to an xml string: 25 -- xmlString = PseudoXMLPS.mGetXMLStringFromList(["one", "two", [#prop: 3]]) 26 -- lingolist = PseudoXMLPS.mGetListFromXMLStringX(xmlString) 27 -- ---------- basically that's it 28 -- 29 -- ---------- another "hack" to be aware of is the following: 30 -- ---------- linear lists get identified by having a nodename which starts with the exact string "item" 31 -- ---------- so if an xml node like <item1>one</item1> is encountered, it is treated as linear list: ["one"] 32 -- ---------- and NOT as [#item1:"one"] 33 -- 34 -- ---------- the mGetXMLStringFromList() function escapes the reserved xml chars <> and & and ' and " by default 35 -- ---------- if for some reason you rather want to enclose the contents in a <![CDATA[ tag, use the dontReplaceGT flag. 36 --------------------------------------------- EXAMPLE for <dontReplaceGT = 1> (dontReplaceGT means don't replace "greater than" btw...): 37 -- 15 38 -- myList = [#stringWithInvalidChars:"A string with invalid chars like <> and & and ' and " & QUOTE] 16 39 -- myList[#stringWithInvalidChars] = "<![CDATA[" & myList[#stringWithInvalidChars] & "]]>" … … 28 51 -- end if 29 52 -- end repeat 53 --------------------------------------------- please note, that the above example is ONLY needed, if you use dontReplaceGT = 1 !! 30 54 -- 31 55 -- HISTORY: … … 129 153 -- ACTION: Convert lingo list (also nested lists) to XML stylish string 130 154 -- INPUT: 131 --<listref> format: property list or linear list132 --<docName> format: #string; optional. if omitted "Untitled" is used for the XML document name155 -- <listref> format: property list or linear list 156 -- <docName> format: #string; optional. if omitted "Untitled" is used for the XML document name 133 157 -- <strict> => boolean; avoid spaces in tag names 134 158 -- <dontReplaceGT> => boolean; dont replace < and > 135 159 -- <withParams> => boolean; write attribute in tag for the lingo ilk => bigger xml files and unfortunately it is slower to parse 136 ----------------------------- (I thought avoiding value() would help, but in this case the additional text parsing of the attributes tag slows down)160 ----------------------------- (I thought avoiding value() would help, but in this case the additional text parsing of the attributes tag slows down) 137 161 -- RETURNS: string 138 162 -- EXAMPLE: saveString = mGetXMLStringFromList(me, lingo_list, "documentName") … … 173 197 -- ACTION: Description 174 198 -- INPUT: 175 --<str> format: #string; split a string using <> and </> tags into lingo list176 --<convertValues> #integer 0=>don't convert (fast, all values are strings), 1 => convert only numbers (slower); 2 => try to convert all data, even colors (slow)199 -- <str> format: #string; split a string using <> and </> tags into lingo list 200 -- <convertValues> #integer 0=>don't convert (fast, all values are strings), 1 => convert only numbers (slower); 2 => try to convert all data, even colors (slow) 177 201 -- <withParams> : #boolean : parse parameters too. new, not very well tested 178 202 -- RETURNS: property list … … 224 248 -- BUT it must be a valid xml string, the above is slower but allows more malformed xml 225 249 -- INPUT: 226 --<str> format: #string; split a string using <> and </> tags into lingo list227 --<convertValues> #integer228 ---- -- 0 => don't convert (fast, all values are strings)229 ---- -- 1 => convert only integer() and float() (slower)230 ---- -- 2 => try to convert all data with value(), even parse for colors in hexstring format (slow)250 -- <str> format: #string; split a string using <> and </> tags into lingo list 251 -- <convertValues> #integer 252 -- -- -- 0 => don't convert (fast, all values are strings) 253 -- -- -- 1 => convert only integer() and float() (slower) 254 -- -- -- 2 => try to convert all data with value(), even parse for colors in hexstring format (slow) 231 255 -- RETURNS: property list 232 256 -- EXAMPLE: lingo_list = mGetListFromXMLStringX(me, saveString) … … 306 330 li = mConvertXMLPropList(me, [xx], convertValues, dontEscapeSpecialChars) 307 331 308 -- put "x" && the milliseconds - ms332 -- put "PseudoXMLPS: mGetListFromXMLStringX:" && the milliseconds - ms 309 333 310 334 if not(listP(li)) then return [:] … … 328 352 329 353 dertext = xscr(#FileIOFunktionen).mGetTextFromFile(thePath) 330 if length(dertext) > 0 then return xscr(#PseudoXMLPS).mGetListFromXMLStringX(dertext)354 if length(dertext) > 0 then return mGetListFromXMLStringX(me, dertext) 331 355 return [:] 332 356 end … … 345 369 346 370 if not(listP(theList)) then return 0 347 theResult = xscr(#PseudoXMLPS).mGetXMLStringFromList(theList)371 theResult = mGetXMLStringFromList(me, theList) 348 372 return xscr(#FileIOFunktionen).mSaveToTextFile(theResult, thePath) 349 373 end … … 757 781 758 782 if val.length = 7 then 759 if (val.char[1] = "#") and (offset(val.char[2], "abcdef0123456789") > 0) then return rgb(val) 783 if (val.char[1] = "#") then 784 isColor = 1 785 repeat with n = 2 to 7 786 if (offset(val.char[n], "abcdef0123456789") < 1) then 787 isColor = 0 788 exit repeat 789 end if 790 end repeat 791 if isColor = 1 then return rgb(val) 792 end if 760 793 end if 761 794 … … 921 954 if count(val) then 922 955 if ilk(retlist) = #proplist then 923 retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars))924 else956 retlist.addProp(symbol(inputlist[n].getaprop(#name)), mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 957 else 925 958 retlist.add(mConvertXMLPropList(me, val, convertValues, dontEscapeSpecialChars)) 926 959 end if … … 943 976 944 977 -- unescape <>&'" 945 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val)978 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 946 979 947 980 #integer: … … 988 1021 989 1022 -- unescape <>&'" 990 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val)1023 if dontEscapeSpecialChars <> 1 then val = mUnEscapeSpecialChars(me, val) 991 1024 992 1025 … … 1000 1033 1001 1034 if ilk(retlist) = #proplist then 1002 retlist.addProp(symbol(inputlist[n].getaprop(#name)), val)1035 retlist.addProp(symbol(inputlist[n].getaprop(#name)), val) 1003 1036 else 1004 1037 retlist.add(val) … … 1022 1055 -- INPUT: <theText> ; string ; required => xml formatted string 1023 1056 -- RETURNS: property list 1024 -- EXAMPLE: plist = xscr(#PseudoXMLPS).mParseExcelXML(xscr(#FileIOFunktionen).mGetTextFromFile())1057 -- EXAMPLE: plist = new(script "PseudoXMLPS").mParseExcelXML(xscr(#FileIOFunktionen).mGetTextFromFile()) 1025 1058 ----------------------------------- 1026 1059 … … 1061 1094 1062 1095 else 1063 call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list")1096 put "mParseExcelXML: Row "&n&" Cell "&m&" is not a property list" 1064 1097 end if -- if ilk(thisCell) = #proplist then 1065 1098 … … 1067 1100 1068 1101 else 1069 call(#mPut, mGetXScript(), "mParseExcelXML: Row "&n&" is not a list")1102 put "mParseExcelXML: Row "&n&" is not a list" 1070 1103 end if -- if listP(currRow) then 1071 1104 … … 1073 1106 1074 1107 else 1075 call(#mPut, mGetXScript(), "mParseExcelXML: Table not found")1108 put "mParseExcelXML: Table not found" 1076 1109 end if -- if listP(xmlList) then 1077 1110 1078 1111 else 1079 call(#mPut, mGetXScript(), "mParseExcelXML: Worksheet not found")1112 put "mParseExcelXML: Worksheet not found" 1080 1113 end if -- if ilk(xmlList) = #proplist then 1081 1114 1082 1115 else 1083 call(#mPut, mGetXScript(), "mParseExcelXML: Workbook not found")1116 put "mParseExcelXML: Workbook not found" 1084 1117 end if -- if ilk(xmlList) = #proplist then 1085 1118 1086 1119 else 1087 call(#mPut, mGetXScript(), "mParseExcelXML: ROOT is not a property list")1120 put "mParseExcelXML: ROOT is not a property list" 1088 1121 end if --if ilk(xmlList) = #proplist then 1089 1122 1090 1123 else 1091 call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() returned empty list")1124 put "mParseExcelXML: Xml parser makelist() returned empty list" 1092 1125 end if -- if count(xmlList) > 0 then 1093 1126 1094 1127 else 1095 call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser makelist() failed")1128 put "mParseExcelXML: Xml parser makelist() failed" 1096 1129 end if -- if listP(xmlList) then 1097 1130 1098 1131 else 1099 call(#mPut, mGetXScript(), "mParseExcelXML: Xml parser error: "&xmlp.getError())1132 put "mParseExcelXML: Xml parser error: "&xmlp.getError() 1100 1133 end if -- if voidP(xmlp.getError()) then 1101 1134 … … 1113 1146 -- INPUT: <pfad> ; string ; full pathname to plist file. This is optional, if it is void or "" a file selection dialog is displayed 1114 1147 -- RETURNS: property list 1115 -- EXAMPLE: plist = xscr(#PseudoXMLPS).mReadPList()1148 -- EXAMPLE: plist = new(script "PseudoXMLPS").mReadPList() 1116 1149 ----------------------------------- 1117 1150 … … 1186 1219 1187 1220 on mGetListFromPListString me, str 1188 return mConvertKeyList(me, mGetListFromXMLString (me, str, 0))1221 return mConvertKeyList(me, mGetListFromXMLStringX(me, str, 0)) 1189 1222 end 1190 1223 -
trunk/lingosource/castlib2/aleXtrasMovieScript.ls
r186 r228 49 49 halt 50 50 end if 51 52 if voidP(cms.script) then -- strangely enough this happened suddenly, dunno why... 53 -- until now it happened only in authoring with the stopped movie 54 -- therefore I just exit here without alert 55 halt 56 end if 57 51 58 alextras = rawnew(cms.script) 52 59 if ilk(alextras) <> #instance then … … 55 62 end if 56 63 (script "aleXtrasMovieScript").pAleXtras = alextras 64 57 65 end if 58 66 return alextras -
trunk/lingosource/castlib2/commonMovieScript.ls
r215 r228 387 387 -- ACTION: Create/Get timeout object 388 388 -- This handler works the same with the old player <10 and the new player >=10 389 -- INPUT: || ÊtheName || string || name for new timeout object||390 -- || ÊtheDuration || integer || timeout perios in milliseconds||389 -- INPUT: || theName || string || name for new timeout object|| 390 -- || theDuration || integer || timeout perios in milliseconds|| 391 391 -- || theHandler || symbol || handler to be called on each timepout event|| 392 392 -- || theTarget || object || object to be sent the timeout event <theHandler>|| … … 1705 1705 -- dummy handler for translate function 1706 1706 1707 on mTranslate me, aString 1707 on mTranslate me, aString, variablesList 1708 1708 theGlobs = mGetGlobalList(me) 1709 1709 uebersetzungsListe = theGlobs.getaprop(#gUebersetzung) … … 1711 1711 uebersetzung = uebersetzungsListe.getaprop(aString) 1712 1712 if voidP(uebersetzung) then 1713 if listP(variablesList) then return mReplacePlaceHoldersInString(me, aString, variablesList) 1713 1714 return aString 1714 1715 else … … 1725 1726 end 1726 1727 1728 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1729 1730 on mReplacePlaceHoldersInString me, aString, variablesList 1731 if ilk(variablesList) = #proplist then 1732 cnt = count(variablesList) 1733 if cnt > 0 then 1734 repeat with n = 1 to cnt 1735 str = string(variablesList[n]) 1736 prop = variablesList.getPropAt(n) 1737 srchStr = "%%" & prop & "%%" 1738 len = length(srchStr) - 1 1739 offs = offset(srchStr, aString) 1740 repeat while offs > 0 1741 put str into char offs to offs + len of aString 1742 offs = offset(srchStr, aString) 1743 end repeat 1744 end repeat 1745 end if 1746 else if ilk(variablesList) = #list then -- printf like replacement 1747 if count(variablesList) > 0 then 1748 offs = offset("%s", aString) 1749 str = string(variablesList[1]) 1750 repeat while offs > 0 1751 put str into char offs to offs + 1 of aString 1752 if count(variablesList) > 1 then variablesList.deleteAt(1) 1753 offs = offset("%s", aString) 1754 end repeat 1755 end if 1756 end if 1757 return aString 1758 end 1727 1759 1728 1760 -- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -
trunk/lingosource/castlib2/memberInfo.xml
r198 r228 5 5 <comments>~/Documents/Scripts/lingo/commonMovieScript.ls</comments> 6 6 <memberName>commonMovieScript</memberName> 7 <f Name>commonMovieScript</fName>7 <fname>commonMovieScript</fname> 8 8 </commonmoviescript> 9 9 <FileIOFunktionen> … … 11 11 <comments>~/Documents/Scripts/lingo/FileIOFunktionen.ls</comments> 12 12 <memberName>FileIOFunktionen</memberName> 13 <f Name>FileIOFunktionen</fName>13 <fname>FileIOFunktionen</fname> 14 14 </FileIOFunktionen> 15 15 <GetSetPrefs> … … 17 17 <comments>~/Documents/Scripts/lingo/GetSetPrefs.ls</comments> 18 18 <memberName>GetSetPrefs</memberName> 19 <f Name>GetSetPrefs</fName>19 <fname>GetSetPrefs</fname> 20 20 </GetSetPrefs> 21 21 <aleXtrasMovieScript> … … 23 23 <comments>~/Documents/Scripts/lingo/aleXtrasMovieScript.ls</comments> 24 24 <memberName>aleXtrasMovieScript</memberName> 25 <f Name>aleXtrasMovieScript</fName>25 <fname>aleXtrasMovieScript</fname> 26 26 </aleXtrasMovieScript> 27 27 <PseudoXMLPS> … … 29 29 <comments>~/Documents/Scripts/lingo/PseudoXMLPS.ls</comments> 30 30 <memberName>PseudoXMLPS</memberName> 31 <f Name>PseudoXMLPS</fName>31 <fname>PseudoXMLPS</fname> 32 32 </PseudoXMLPS> 33 33 <simpleGoToAction> … … 35 35 <comments>/Users/alex/Documents/ALIEN/myLinkedScripts/simpleGoToAction.ls</comments> 36 36 <memberName>simpleGoToAction</memberName> 37 <f Name>simpleGoToAction</fName>37 <fname>simpleGoToAction</fname> 38 38 </simpleGoToAction> 39 39 <SpriteNameBeaver> … … 41 41 <comments>~/Documents/Scripts/lingo/SpriteNameBeaver.ls</comments> 42 42 <memberName>SpriteNameBeaver</memberName> 43 <f Name>SpriteNameBeaver</fName>43 <fname>SpriteNameBeaver</fname> 44 44 </SpriteNameBeaver> 45 45 <subversionVersionChecker> … … 47 47 <comments>~/Documents/Scripts/lingo/subversionVersionChecker.ls</comments> 48 48 <memberName>subversionVersionChecker</memberName> 49 <f Name>subversionVersionChecker</fName>49 <fname>subversionVersionChecker</fname> 50 50 </subversionVersionChecker> 51 51 </Untitled>
Note: See TracChangeset
for help on using the changeset viewer.
