+ 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,809
    Thank Post
    1,476
    Thanked 592 Times in 444 Posts
    Rep Power
    168

    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,809
    Thank Post
    1,476
    Thanked 592 Times in 444 Posts
    Rep Power
    168
    PS Full Gui prog would do just as well

    Si

  3. #3

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

    Si

  4. #4

    Ric_'s Avatar
    Join Date
    Jun 2005
    Location
    London
    Posts
    7,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180
    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,081
    Thank Post
    853
    Thanked 2,677 Times in 2,271 Posts
    Blog Entries
    9
    Rep Power
    769
    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,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180
    @SYNACK I beat you and mine is less lines! :-P

  9. #7

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,081
    Thank Post
    853
    Thanked 2,677 Times in 2,271 Posts
    Blog Entries
    9
    Rep Power
    769
    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,590
    Thank Post
    109
    Thanked 762 Times in 593 Posts
    Rep Power
    180
    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
    142
    Thank Post
    6
    Thanked 45 Times in 39 Posts
    Rep Power
    22
    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,403
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    168
    I usually do this sort of thing using excel...

  16. #11

    X-13's Avatar
    Join Date
    Jan 2011
    Location
    /dev/null
    Posts
    9,056
    Thank Post
    591
    Thanked 1,945 Times in 1,345 Posts
    Blog Entries
    19
    Rep Power
    813
    well damn... This entire thread makes me feel stupid.

  17. #12

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,809
    Thank Post
    1,476
    Thanked 592 Times in 444 Posts
    Rep Power
    168
    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.405546, -0.510212
    Posts
    8,772
    Thank Post
    222
    Thanked 2,632 Times in 1,939 Posts
    Rep Power
    779
    @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,402
    Thank Post
    648
    Thanked 277 Times in 244 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
  •