Announcement

Collapse
No announcement yet.

PrettyCommentContest? Nah.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Imagine Programming
    replied
    Originally posted by RizlaUK View Post
    lol, i have it also, but not installed, the WinAPI32 help file is all i need, and thats only 23 MB
    Where can I get that? Quite useful ^^

    Leave a comment:


  • RizlaUK
    replied
    Please tell me PB is easier to master!
    it is for sure, i had a little dable with VB6 but then MS disowned it, so i followed suit and jumped into PB

    when I was trying to emulate your Dummy File Maker tool.
    wow, that was one of my first ever PB projects, i got the function from Droopy's Lib and after seeing some site that was actually selling a tool like that i thought "its a worth while project" so set about coding a free version

    once you get to grips with the basic setup in PB you'll be off, to be honest i struggled at first, i just took other peoples functions and turned them into dll's, but doing that taught me a huge amount, now im free coding at will and produceing some amazing stuff (dont you just live modesty )

    Would you believe I still have on CD, the entire MSDN library for VB-6!
    lol, i have it also, but not installed, the WinAPI32 help file is all i need, and thats only 23 MB

    Leave a comment:


  • mystica
    replied
    Originally posted by RizlaUK View Post
    @mystica, visit the below link, download the files, it will give you a seroius kick start in PB programming :yes

    http://www.purebasic.fr/english/view...=37059&start=0
    Yep, thanks Riz. I remember delving into that website last year, when I was trying to emulate your Dummy File Maker tool. I got as far as reproducing your GUI and getting it to produce dummy-files of a single-size from white-space, but then got totally lost/confused when trying to assign functions to the Gadget Items. LOL. In the end, I gave up and settled with a pretty poor imitation done in AMS.
    Boy, did that little project have some serious drawbacks ... definitley not suited to AMS and easy to see how PB kicks @ss in that particular case.


    Originally posted by RizlaUK View Post
    yup, and when your done there, start on page 1 at MSDN

    that will keep you busy, lmao
    Hahaha, no thanks! Would you believe I still have on CD, the entire MSDN library for VB-6! Spans 3 CDs (over 2GBs worth). It's still useful to this day, when trying to crank out really basic VB6 projects ... but it's such a headache to wade through, lol. Think I prefer to compromise with the bloated AMS executables than deal with all those esoteric VB functions.
    Please tell me PB is easier to master!


    Originally posted by Imagine Programming View Post
    Also, have a look at the CodeArchiv, worthy code in there
    http://purearea.net/pb/CodeArchiv/CodeArchiv.html

    And try to get the sources of the PureBasicOpenSource (PBOSL) libraries,
    amazing sources and information in there :yes
    http://pbosl.purearea.net/
    Ah, okay ... those ones I didn't know about ... will be sure to check them out. Many thanks, IP.

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by RizlaUK View Post
    yup, and when your done there, start on page 1 at MSDN

    that will keep you busy, lmao

    @mystica, visit the below link, download the files, it will give you a seroius kick start in PB programming :yes

    http://www.purebasic.fr/english/view...=37059&start=0
    I'll just read MSDN articles and documents when I specifically search for them,
    I think I'll die trying to read it all

    Nice link! :yes

    Leave a comment:


  • RizlaUK
    replied
    I got really interested and read through the complete PB manual
    yup, and when your done there, start on page 1 at MSDN

    that will keep you busy, lmao

    @mystica, visit the below link, download the files, it will give you a seroius kick start in PB programming :yes

    http://www.purebasic.fr/english/view...=37059&start=0

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by mystica View Post
    Okay yes, I just tried it in Version 4.0 and I don't get those warnings anymore. Thanks IP. With the code functioning properly, I can now study it from a reverse-engineering perspective to learn exactly how it works, and learn new skills in the process. Thanks for sharing. :yes
    No problem, I'd love to see more PB developers around here ^^
    You know what I did? After Dean told me about purebasic, and helped
    me a lot years ago already I guess,
    I got really interested and read through the complete PB manual XD

    Maybe you'll be busy reading for a huge bit, but there's really worthy information
    in there. And sometimes, each topic contains links to website with more info
    regarding that subject, so check out the helpfile, completely :yes

    Also, have a look at the CodeArchiv, worthy code in there
    http://purearea.net/pb/CodeArchiv/CodeArchiv.html

    And try to get the sources of the PureBasicOpenSource (PBOSL) libraries,
    amazing sources and information in there :yes
    http://pbosl.purearea.net/

    You've gotta love Purearea.net

    @Dean, indeed, but it's not because of tailbite, it's because each version
    of PB has diffirent native libs and stuff missing string/menu extension library errors
    suck XD

    Leave a comment:


  • mystica
    replied
    Okay yes, I just tried it in Version 4.0 and I don't get those warnings anymore. Thanks IP. With the code functioning properly, I can now study it from a reverse-engineering perspective to learn exactly how it all works, and learn new skills in the process. Thanks for sharing. :yes


    @Rizla
    Originally posted by RizlaUK View Post
    and there only warnings, your app will still run without problems
    Yeah, I noticed that ... thanks. I was just confused/curious about why the warnings were coming up.
    Last edited by mystica; 03-18-2010, 05:01 PM.

    Leave a comment:


  • RizlaUK
    replied
    and there only warnings, your app will still run without problems

    @mystica, cool, another PB developer born at the IR forums, great stuff, AMS and PB is a perfect marriage :yes
    some libraries I use hare not supported in PB 4.3 and 4.4 so I still use 4.2 quite often
    d.a.m those Talibite libs, lol

    i stick to includes now, sick of being jacked out coz PB rejects the source, the one and only lib i use now is the lua5.1.4 and its multi version (dynamic linking )

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by mystica View Post
    Okay, much better. But what do these compiler-warning messages mean?



    Sorry if that's a dumb question, but I'm not all that familiar with working in PB. To date, I have only poked around in it and used it for building very basic executables. This stuff is pretty complex for a dummy like me.
    Oh yes I had to let you know this was written in PB 4.2, some libraries I use
    hare not supported in PB 4.3 and 4.4 so I still use 4.2 quite often

    In 4.4, those functions are deprecated, but in 4.2, those are required.

    Leave a comment:


  • mystica
    replied
    Okay, much better. But what do these compiler-warning messages mean?



    Sorry if that's a dumb question, but I'm not all that familiar with working in PB. To date, I have only poked around in it and used it for building very basic executables. This stuff is pretty complex for a dummy like me.

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by mystica View Post
    Well, this for example:

    <img>

    This is what PB returns based on the source you provided.
    Yes, because I told you I only gave you the code that calls HW_PrettyPrinter.js

    Anyhow, #Main is the main window, you don't have it opened
    You don't have it enumerated either probably

    Code:
    Enumeration
        #Main ;The main window :)
    EndEnumeration
    Here's the full source, with files missing though...
    #Main is a constant, they have to be declared
    If you would have declared #Main, you'd get an error
    on the next constant haha

    Code:
    ; PureBasic wrapper for the PrettyPrinter by Mikail
    ; Wrappercode written by Imagine Programming.
    ; cscript.exe::scriptpath  [Sourcefile] [Output] [-o(verwrite)] [-s(trip comments)] [-help] [-verbose] [-debug] [-unix]
    ;{ Enumerations
    Enumeration ;The windows
      #Main
    EndEnumeration
    Enumeration ;The objects
      #Frame
    
      #Label_InFile
      #Input_InFile
      #Browse_InFile
      
      #Label_OutFile
      #Input_OutFile
      #Browse_OutFile
      
      
      #Check_Frame
      #Check_Debug
      #Check_StripComments
      #Check_OverwriteOld
      
      #Start
      #Exit
      
      #Log_Frame
      #Log_List
    EndEnumeration  
    NewList DisableItems()
    AddElement(DisableItems()):DisableItems()=#Input_InFile
    AddElement(DisableItems()):DisableItems()=#Browse_InFile
    AddElement(DisableItems()):DisableItems()=#Input_OutFile
    AddElement(DisableItems()):DisableItems()=#Browse_OutFile
    
    For i=#Check_StripComments To #Exit
      AddElement(DisableItems()):DisableItems()=i
    Next 
    Procedure DisableGadgets(state)
      Shared DisableItems()
      ForEach DisableItems()
        DisableGadget(DisableItems(),state)
      Next 
    EndProcedure 
    ;}
    ;XIncludeFile(#PB_Compiler_Home+"Include\Macro.pbi") ;I'll just write it down here, because you don't have it :p
    Macro Enquote(s)
        Chr(34)+s+Chr(34)
    EndMacro
    Procedure.s FixedSys32Dir()
      Protected Sys32.s = GetSystemDirectory() ; You probably don't have this function, use GetEnvironmentVariable("systemroot")+"\system32\"
      If(Right(Sys32,1)<>"\") 
        Sys32+"\"
      EndIf 
      ProcedureReturn Sys32
    EndProcedure 
    Procedure.s FixedTempDir()
      Protected Temp.s = GetTemporaryDirectory()
      If(Right(Temp,1)<>"\")
        Temp+"\"
      EndIf 
      ProcedureReturn Temp
    EndProcedure 
    Procedure PrettyPrinter(szInput.s, szOutput.s, Overwrite.b, StripComments.b, *lpCallbackProcedure)
      Protected szCommandlineString.s = "", hFile, PrettyPrinter, PFlags, PString.s
      If(FileSize(szInput)<0)
        MessageBox_(WindowID(#Main),"Selected file could not be found!", "Error", #MB_ICONERROR)
        ProcedureReturn 0
      EndIf 
      Protected Script.s = FixedTempDir()+"HW2_PrettyPrinter.js"
      szCommandlineString = Enquote(Script) + " " + Enquote(szInput)
      If(Overwrite=0)
        szCommandlineString + " " + Enquote(szOutput)
      Else 
        szCommandlineString + " -o"
      EndIf 
      If(StripComments=1)
        szCommandlineString + " -s"
      EndIf 
      szCommandlineString + " -verbose"
      hFile = OpenFile(#PB_Any, Script)
      If hFile
        WriteData(hFile, ?HW2_PrettyPrinter, (?HW2_End-?HW2_PrettyPrinter))
        CloseFile(hFile)
      Else
        ProcedureReturn -1
      EndIf 
      PFlags        = #PB_Program_Open | #PB_Program_Read | #PB_Program_Hide 
      PrettyPrinter = RunProgram(FixedSys32Dir()+"cscript.exe", szCommandlineString, GetPathPart(szInput), PFlags)
      While ProgramRunning(PrettyPrinter)
        PString = ReadProgramString(PrettyPrinter)
        If PString
          If *lpCallbackProcedure And FindString(LCase(PString),"microsoft",1)=0 ;Screw them! :p It's the script I'm interested in!
            CallFunctionFast(*lpCallbackProcedure, PString) ; The callback procedure should recieve only 1 string.
          EndIf 
        EndIf 
      Wend 
      If *lpCallbackProcedure
        CallFunctionFast(*lpCallbackProcedure, "+OK Ready...")
      EndIf 
      CloseProgram(PrettyPrinter)
      DeleteFile(Script)
      ProcedureReturn 1
    EndProcedure 
    Procedure Logger(szString.s)
      szString = ReplaceString(szString,Chr(9),"    ")
      AddGadgetItem(#Log_List, -1, szString)
      SetGadgetState(#Log_List, CountGadgetItems(#Log_List)-1) ; Select the last item, so it scrolls there aswell.
    EndProcedure 
    If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 350, 340, "PrettyPrinter")
      If CreateGadgetList(WindowID(#Main))
        Frame3DGadget(#Frame, 5, 5, 340, 170, "PrettyPrinter GUI by Imagine Programming, PrettyPrinter by Mikail")
          Distance = 30 ; Ignore this, I just do this to keep even margins :p
          
          TextGadget  (#Label_InFile, 10, Distance+3, 40 , 22, "Input:")
          StringGadget(#Input_InFile, 50, Distance, 225, 22, "", #PB_String_ReadOnly)
          ButtonGadget(#Browse_InFile,280, Distance, 60, 22, "Browse")
          Distance + 27
          
          TextGadget  (#Label_OutFile, 10, Distance+3, 40 , 22, "Output:")
          StringGadget(#Input_OutFile, 50, Distance, 225, 22, "", #PB_String_ReadOnly)
          ButtonGadget(#Browse_OutFile,280, Distance, 60, 22, "Browse")
    
          ButtonGadget(#Start, 265, 168-20, 75, 22, "&Start")
          ButtonGadget(#Exit , 265-80, 168-20, 75, 22, "&Exit")
          
          Distance + 27
          
          Frame3DGadget(#Check_Frame, 10, Distance, 330, 60, "Options")
            Distance + 15
            CheckBoxGadget(#Check_StripComments, 20, Distance, 100, 22, "Strip Comments")
            Distance + 18
            CheckBoxGadget(#Check_OverwriteOld, 20, Distance, 100, 22, "Overwrite Original")
        
        Frame3DGadget(#Log_Frame, 5, 180, 340, 155, "Log")
          ListViewGadget(#Log_List, 10, 195, 330, 135)
          SetGadgetColor(#Log_List, #PB_Gadget_BackColor, RGB($CE,$CE,$CE))
      EndIf 
      
      Repeat 
        Event = WaitWindowEvent()
        E_GID = EventGadget()
        Select Event
          Case #PB_Event_Gadget
            Select E_GID
              Case #Exit : Event = #PB_Event_CloseWindow 
              Case #Start
                In.s = GetGadgetText(#Input_InFile)
                Out.s= GetGadgetText(#Input_OutFile)
                SC   = GetGadgetState(#Check_StripComments)
                OO   = GetGadgetState(#Check_OverwriteOld)
                If(FileSize(In)<0)
                  MessageBox_(WindowID(#Main),"Please give a valid input file!", "Error", #MB_ICONERROR)
                  Continue 
                EndIf 
                If(FileSize(Out)<0)And(OO=1)
                  MessageBox_(WindowID(#Main),"Please give a valid output file!", "Error", #MB_ICONERROR)
                  Continue 
                EndIf 
                ClearGadgetItemList(#Log_List)
                DisableGadgets(1)
                PrettyPrinter(In,Out,OO,SC,@Logger())
                DisableGadgets(0)
              Case #Browse_InFile
                f.s = OpenFileRequester("Select an input file", "", "Lua Scripts (*.lua)|*.lua|", 0)
                If f
                  SetGadgetText(#Input_InFile, f)
                  If GetGadgetText(#Input_OutFile) = f
                    SetGadgetState(#Check_OverwriteOld,1)
                    DisableGadget(#Check_OverwriteOld,1)
                  Else
                    DisableGadget(#Check_OverwriteOld,0)
                    SetGadgetState(#Check_OverwriteOld,0)
                  EndIf 
                EndIf 
              Case #Browse_OutFile
                f.s = OpenFileRequester("Select an output file", "", "Lua Scripts (*.lua)|*.lua|", 0)
                If f
                  SetGadgetText(#Input_OutFile, f)
                  If GetGadgetText(#Input_InFile) = f
                    SetGadgetState(#Check_OverwriteOld,1)
                    DisableGadget(#Check_OverwriteOld,1)
                  Else
                    DisableGadget(#Check_OverwriteOld,0)
                    SetGadgetState(#Check_OverwriteOld,0)
                  EndIf 
                EndIf 
            EndSelect 
        EndSelect 
      Until Event = #PB_Event_CloseWindow 
    EndIf 
    
    End 
    ;{ Datasection
    DataSection 
      HW2_PrettyPrinter: IncludeBinary("HW2_PrettyPrinter.js")
      HW2_End          : Chr(0) ;To determine the length ?Label2-?Label1 :)
    EndDataSection 
    ;}
    Last edited by Imagine Programming; 03-18-2010, 01:45 PM.

    Leave a comment:


  • mystica
    replied
    Originally posted by Imagine Programming View Post
    What don't you get? ^^ I'll be happy to explain stuff :yes
    Well, this for example:



    This is what PB returns based on the source you provided.

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by mystica View Post
    Okay, I been messing around with this for days now ... and seriously do not get it???

    Is this thread now closed?
    Or do I have to send some ASIO spooks around to IP's place to commence water-boarding procedures?
    <image>

    And remember IP, these guys are trained in the art of bitch-slapping!
    What don't you get? ^^ I'll be happy to explain stuff :yes

    Leave a comment:


  • mystica
    replied
    Originally posted by Imagine Programming View Post
    Here's the source, I didn't copy the includes and stuff, just how I see it.
    So, it'll probably won't work for you
    Okay, I been messing around with this for days now ... and seriously do not get it???

    Is this thread now closed?
    Or do I have to send some ASIO spooks around to IP's place to commence water-boarding procedures?



    And remember IP, these guys are trained in the art of bitch-slapping!
    Last edited by mystica; 03-18-2010, 04:17 AM.

    Leave a comment:


  • Imagine Programming
    replied
    Hahaha at the both of you XD firetrucking lol!

    And, my BAAT is probably bigger ^^

    Leave a comment:

Working...
X