+ Post New Thread
Results 1 to 14 of 14
Windows Thread, Any windows greppers around? in Technical; Bored??? How about writing a .bat file to take a iterate over a list of Scratch files held inside filelist.txt ...
  1. #1

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 594 Times in 446 Posts
    Rep Power
    169

    Any windows greppers around?

    Bored???

    How about writing a .bat file to take a iterate over a list of Scratch files held inside filelist.txt

    Code:
    john.sb
    amy.sb
    ...

    and use this
    Code:
    <p><applet width="482" height="387" id="ProjectApplet" archive="ScratchApplet.jar" codebase="http://www.somewhere.sch.uk/images/stories/humpty" code="ScratchApplet" style="display: block" title="Java"><param name="project" value="Humpty.sb" /></applet></p>
    and replace Humpty.sb with john.sb amy.sb etc and give me one file with them all in so I can just upload the code onto a website.

    'nixers welcome to join in just to show how easy it is (and how clever they are )

    Si

  2. #2

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 594 Times in 446 Posts
    Rep Power
    169
    PS Full Gui prog would do just as well

    Si

  3. #3

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 594 Times in 446 Posts
    Rep Power
    169
    Come on people - you've had 10 mins! :-)

    Si

  4. #4

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,592
    Thank Post
    109
    Thanked 770 Times in 598 Posts
    Rep Power
    183
    Powershell for you Si!

    Code:
    $myFile = Get-Content c:\temp\myFile.txt
    $out = ""
    foreach ($line in $myFile){
        $out = $out + '<p><applet width="482" height="387" id="ProjectApplet" archive="ScratchApplet.jar" codebase="http://www.somewhere.sch.uk/images/stories/' + $line + '" code="ScratchApplet" style="display: block" title="Java"><param name="project" value="' + $line + '" /></applet></p>'
    }
    $out | out-file c:\temp\myNewFile.txt

  5. Thanks to Ric_ from:

    SimpleSi (10th May 2012)

  6. #5

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,241
    Thank Post
    882
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    11
    Rep Power
    784
    Code:
    strstart = "<p><applet width='482' height='387' id='ProjectApplet' archive='ScratchApplet.jar' codebase='http://www.somewhere.sch.uk/images/stories/humpty' code='ScratchApplet' style='display: block' title='Java'><param name='project' value='"
    strend= "' /></applet></p>"
    Const ForAppending = 8
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile("c:\output.txt", ForAppending, True)
    Set fso = CreateObject("Scripting.FileSystemObject") 
    Set listFile = fso.OpenTextFile("filelist.txt") 
    do while not listFile.AtEndOfStream  
        fName =  listFile.ReadLine() 
        objTextFile.WriteLine(fName + ".txt") 
    loop 
    objTextFile.Close
    This as a vbs should work, I'd test it first though as I just chucked it together in notepad and have not tested it at all.

  7. Thanks to SYNACK from:

    SimpleSi (10th May 2012)

  8. #6

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,592
    Thank Post
    109
    Thanked 770 Times in 598 Posts
    Rep Power
    183
    @SYNACK I beat you and mine is less lines! :-P

  9. #7

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,241
    Thank Post
    882
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    11
    Rep Power
    784
    Quote Originally Posted by Ric_ View Post
    @SYNACK I beat you and mine is less lines! :-P
    Conceeded Is powershell avalible on Windows 98 though

  10. Thanks to SYNACK from:

    SimpleSi (10th May 2012)

  11. #8

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,592
    Thank Post
    109
    Thanked 770 Times in 598 Posts
    Rep Power
    183
    Quote Originally Posted by SYNACK View Post
    Conceeded Is powershell avalible on Windows 98 though
    No... but Si has gone all modern and uses XP nowadays so he should be good

  12. Thanks to Ric_ from:

    SimpleSi (10th May 2012)

  13. #9

    Join Date
    Apr 2007
    Location
    Birmingham
    Posts
    143
    Thank Post
    6
    Thanked 45 Times in 39 Posts
    Rep Power
    23
    This should work on Windows 98

    Code:
    for /F "tokens=*" %%A in (myfile.txt) do @echo ^<p^>^<applet width="482" height="387" id="ProjectApplet" archive="ScratchApplet.jar" codebase="http://www.somewhere.sch.uk/images/stories/%%A" code="ScratchApplet" style="display: block" title="Java"^>^<param name="project" value="%%A" /^>^</applet^>^</p^> >>myNewfile.txt

  14. Thanks to andy_b from:

    SimpleSi (10th May 2012)

  15. #10

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,404
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    169
    I usually do this sort of thing using excel...

  16. #11

    X-13's Avatar
    Join Date
    Jan 2011
    Location
    /dev/null
    Posts
    9,473
    Thank Post
    633
    Thanked 2,118 Times in 1,454 Posts
    Blog Entries
    19
    Rep Power
    882
    well damn... This entire thread makes me feel stupid.

  17. #12

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 594 Times in 446 Posts
    Rep Power
    169
    Thanks for the replies
    I'm trialling the Win98 dos bat one

    And does powershell come/run in XP SP1?
    Si

  18. #13


    Join Date
    Feb 2007
    Location
    51.403651, -0.515458
    Posts
    9,418
    Thank Post
    243
    Thanked 2,827 Times in 2,086 Posts
    Rep Power
    815
    @SimpleSi. Your HTML code is obsolete too.

    Code:
    <!DOCTYPE html><html lang="en"><meta charset=UTF-8>
    <object tabindex="0" type="application/x-java-applet" width="482" height="387">
      <!--Generic parameters for all Java applets. -->
      <param name="codebase" value="http://www.somewhere.sch.uk/images/stories/humpty" >
      <param name="archive"  value="ScratchApplet.jar" >
      <param name="code"     value="ScratchApplet" >
      <!--Specific parameters. -->
      <param name="project"  value="Humpty.sb" >
      Your browser needs Java to view projects.
    </object>
    Source: Embed a Scratch applet in HTML5

  19. Thanks to Arthur from:

    SimpleSi (11th May 2012)

  20. #14
    soveryapt's Avatar
    Join Date
    Jan 2009
    Location
    Lancashire
    Posts
    2,421
    Thank Post
    656
    Thanked 278 Times in 245 Posts
    Rep Power
    78
    Quote Originally Posted by X-13 View Post
    well damn... This entire thread makes me feel stupid.
    I'm glad it's not just me! lol ..

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 2
    Last Post: 24th September 2010, 09:36 PM
  2. [Windows Software] Windows installers that will work with any key.
    By Vizantis in forum Licensing Questions
    Replies: 8
    Last Post: 16th July 2010, 06:26 PM
  3. Replies: 1
    Last Post: 18th June 2010, 03:23 PM
  4. make any window "always on top"
    By RabbieBurns in forum Windows 7
    Replies: 1
    Last Post: 5th January 2010, 02:10 AM
  5. Replies: 1
    Last Post: 30th November 2009, 06:32 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •