forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[APP] Extract and create include external resource file

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Miscellaneous
View previous topic :: View next topic  
Author Message
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Fri Mar 12, 2010 11:12 am    Post subject: [APP] Extract and create include external resource file Reply with quote

Hi Forum,
some time ago I created this little utility to analize a vds souce code to find external resource like #Test.bmp iand create relative script to include this resource file
for ex. from this souce file:
Code:

#Include Funzioni.dsc

If %1 = "P"
  %%Port_ = 1
Else
  %%Port_ =
End

Inizia
Timer Start,1,Ctdown,@Fadd(0,@DateTime(,0:02:00))

  DIALOG CREATE,Local.Network.Mail.System.,-1,0,736,512,BALLOONTIPS,class MainDlg
  DIALOG ADD,STYLE,STYLE1,Verdana,6,B,,
  DIALOG ADD,SHAPE,SHAPE1,0,0,88,736,SILVER,SILVER,,RECTANGLE
  DIALOG ADD,BITBTN,NewMail,12,4,80,44,#NuovaMail.bmp,Nuova Mail,Scrivi Nuova Mail,STYLE1
  DIALOG ADD,BITBTN,Inbox,60,4,80,44,#02MailClosed.bmp,Posta Ricevuta,Casella Posta Ricevuta,STYLE1
  DIALOG ADD,BITBTN,SentBox,132,4,80,44,#Invia.bmp,Posta Inviata,Casella Posta Inviata,STYLE1
  DIALOG ADD,BITBTN,Configurazione,304,4,80,44,#ConfigurationSettings.bmp,Configurazione,Configurazione Client,STYLE1
  DIALOG ADD,BITBTN,Uscita,464,4,80,44,#EXIT.BMP,Uscita,Esce dal client,STYLE1
  DIALOG ADD,BITBTN,Rubrica,192,4,80,44,#01rubrica.bmp,Contatti,Rubrica contatti Interni,STYLE1
  OBJECT CLASS,MainDlg
  OBJECT SCALE,96
  OBJECT ADD,STYLE,STYLE1,,6,,white
  DIALOG SHOW
  GUI SubClass,#MainDlg
  GUI ADD,TOOLTIPCTRL,TOOLTIPCTRL1,#MainDlg
  SplashScreen
  Crea
  Pulisci
 :Loop
Refresh
%a = @object(selpos,richedit1,S)
 
  if @not(@equal(%a,%%posicion))
    %%posicion = %a
       
    OBJECT SET,FONTCOMBO1,@object(getformat,richedit1,N)
    object set,COLORCOMBO1,@object(getformat,richedit1,C)
     
    %%size = @object(getformat,richedit1,S)
    dialog set,SizeFont,%%size
   
    %%bold = @object(getformat,richedit1,B)
    %%italic = @object(getformat,richedit1,I)
    %%underline = @object(getformat,richedit1,U)
    %%align = @object(getformat,richedit1,A)
    %%bullets = @object(getformat,richedit1,T)
   
    if @both(@equal(%%bold,ON),@equal(%%bold_status,B))
      rem Change Bold BUTTON text
     
      dialog set,Bold,*B
     %%bold_status = *B
    else
     
      dialog set,Bold,B
     %%bold_status = B
    end
   
    if @both(@equal(%%italic,ON),@equal(%%italic_status,I))
      rem Change Italic BUTTON text
     
      dialog set,Italic,*I
     %%italic_status = *I
    else
     
      dialog set,Italic,I
     %%italic_status = I
    end
     
    if @both(@equal(%%underline,ON),@equal(%%underline_status,U))
      rem Change underline BUTTON text
     
      dialog set,underline,*U
     %%underline_status = *U
    else
     
      dialog set,underline,U
     %%underline_status = U
    end
   
    if @unequal(%%align_status,%%align)
      rem Change ALIGN
     
     %%align_status = %%slign
    
      %1 = @equal(%%align,LEFT)
      %2 = @equal(%%align,CENTER)
      %3 = @equal(%%align,RIGHT)
   
      dialog set,left,@substr("*",%1)Left
#      dialog set,centert,@substr("*",%2)Center
      dialog set,right,@substr("*",%3)Right
    end
   
    if @both(@equal(%%bullets,ON),@equal(%%bullets_status,Bullet))
      rem Change Bullet BUTTON text
     
      dialog set,Bullet,*Bullet
     %%bullets_status = *Bullet
    else
     
     %%bullets_status = Bullet
      dialog set,Bullet,Bullet
    end
  end

  Wait Event
  %e = @Event(D)
  Goto %e


:TIMER1CTDOWN|0
Refresh
Timer start,1,Ctdown,@Fadd(0,@DateTime(,0:02:00))
Goto Loop

 
:NewMailButton|0
Pulisci
NuovaMail
Goto Loop

:InBoxButton|0
Pulisci
Ricevuti
Goto Loop

:SentBoxButton|0
Pulisci
Inviati
Goto Loop

:RubricaButton|0
Pulisci
Contatti
Goto Loop

:ConfiguraButton|0
Pulisci
Contatti
Goto Loop


:InviaMailBUTTON|0
  rem Save document
 
  %a = @filedlg("RichText document (*.rtf)|*.rtf|Text file (*.txt)|*.txt")
  if @ok()
    OBJECT SAVEFILE,RICHEDIT1,%a
  End
  goto Loop
 
:ColorCombo1CLICK|0
:FontCombo1CLICK|0
:SizeFontCLICK|0
:DefectoBUTTON|0
:BoldBUTTON|0
:ItalicBUTTON|0
:UnderlineBUTTON|0
  %a = @object(selpos,richedit1,S)
  %b = @object(selpos,richedit1,e)
  object format,richedit1,clipboard,select,%a,@diff(%b,%a)
  object format,richedit1,setfont,@object(item,fontcombo1),@dlgtext(SizeFont),@object(item,colorcombo1)
 
  if @equal(%e,BoldBUTTON)
    if @equal(%%bold,ON)
      %%bold = OFF
      %a =
    else
      %%bold = ON
      %a = *
    end
    dialog set,Bold,%aB
  elsif @equal(%e,ItalicBUTTON)
    if @equal(%%italic,ON)
      %%italic = OFF
      %a =
    else
      %%italic = ON
      %a = *
    end
    dialog set,Italic,%aI
  elsif @equal(%e,UnderlineBUTTON)
    if @equal(%%underline,ON)
      %%underline = OFF
      %a =
    else
      %%underline = ON
      %a = *
    end
    dialog set,Underline,%aU
  end

  object format,richedit1,BOLD,%%bold
  object format,richedit1,ITALIC,%%italic
  object format,richedit1,UNDERLINE,%%underline
  goto Loop
   
:PrintBUTTON|0
  object print,richedit1
  goto Loop

:CutBUTTON|0
  object format,richedit1,clipboard,cut
  goto Loop

:CopyBUTTON|0
  object format,richedit1,clipboard,copy
  goto Loop

:PasteBUTTON|0
  object format,richedit1,clipboard,paste
  goto Loop

:UndoBUTTON|0
  object format,richedit1,clipboard,undo
  goto Loop
 
:RedoBUTTON|0
  object focus,richedit1
  window send,#MiniRichEditor,@ctrl(Y)
  goto Loop

:IndentDecBUTTON|0
  %a = @object(getformat,richedit1,F)
  if @zero(%a)
    goto Loop
  end
 
  %a = @diff(%a,20)
  object format,richedit1,indent,first,%a
  goto Loop
 
:IndentIncBUTTON|0
  %a = @object(getformat,richedit1,F)
  %a = @sum(%a,20)
  object format,richedit1,indent,first,%a
  goto Loop
 
:LeftBUTTON|0
  dialog set,left,*Left
  dialog set,center,Center
  dialog set,right,Right
 
  object format,richedit1,align,left
  goto Loop
 
:CenterBUTTON|0
  dialog set,left,Left
  dialog set,center,*Center
  dialog set,right,Right
 
  object format,richedit1,align,center
  goto Loop

:RightBUTTON|0
  dialog set,left,Left
  dialog set,center,Center
  dialog set,right,*Right
 
  object format,richedit1,align,right
  goto Loop
   
:bulletBUTTON|0
  %a = @object(getformat,richedit1,T)
  if @equal(%a,ON)
    object format,richedit1,bullets,OFF
#    dialog set,Bullet,#BulletOn.bmp
Dialog Remove,Bullet
    DIALOG ADD,BITBTN,Bullet,56,185,22,22,#BulletOn.bmp
  else
    object format,richedit1,bullets,ON
    Dialog Remove,Bullet
    DIALOG ADD,BITBTN,Bullet,56,185,22,22,#BulletOff.bmp
#   dialog set,Bullet,#BulletOff.bmp
  end
  goto Loop
 
:inter1BUTTON|0
  object focus,richedit1
  window send,#MiniRichEditor,@ctrl(1)
  goto Loop
 
:inter15BUTTON|0
  object focus,richedit1
  window send,#MiniRichEditor,@ctrl(5)
  goto Loop
 
:inter2BUTTON|0
  object focus,richedit1
  window send,#MiniRichEditor,@ctrl(2)
  goto Loop
 
:imageBUTTON|0
  %a = @filedlg("Bit Maps (*.bmp)|*.bmp|Enhanced Metafile (*.emf)|*.emf|GIF image (*.gif)|*.gif|Icon image (*.ico)|*.ico|Jpeg image (*.jpg)|*.jpg|Winodw Metafile image(*.wmf)|*.wmf")
  if @ok()
    object format,richedit1,clipboard,insertimage,%a
  end
  goto Loop

:ContButton|0
  DIALOG CREATE,Destinatari,-1,0,232,189,BALLOONTIPS,NOSYS,NOTITLE,ONTOP
  DIALOG ADD,STYLE,STYLE1,Verdana,6,B,,
  DIALOG ADD,LIST,LIST1,20,0,104,169
  DIALOG ADD,LIST,LIST2,20,124,104,169
  DIALOG ADD,BUTTON,piu,44,104,20,24,>,,STYLE1
  DIALOG ADD,BUTTON,Meno,68,104,20,24,<,,STYLE1
  DIALOG ADD,BUTTON,turmeno,108,104,20,24,<<,,STYLE1
  DIALOG ADD,BUTTON,TutPiu,132,104,20,24,>>,,STYLE1
  DIALOG ADD,TEXT,TEXT1,8,4,52,8,Contatti,,STYLE1
  DIALOG ADD,TEXT,TEXT2,8,124,72,8,Destinatari,,STYLE1
  DIALOG ADD,BITMAP,Esci,0,220,12,12,#x.bmp,,STRETCH,CLICK
  DIALOG SHOW
  Goto Loop

:EsciClick|1
Dialog Close
While @Event()
Wend
Goto Loop

:ConfigurazioneButton|0

  DIALOG CREATE,Configurazione,-1,0,308,227,BALLOONTIPS,NOSYS,ONTOP Child
  DIALOG ADD,STYLE,STYLE1,6,B,,,
  DIALOG ADD,EDIT,PathDb,31,7,180,16,PathDb
  DIALOG ADD,BITBTN,CercaDb,30,186,20,20,#Open.bmp,,Cerca
  DIALOG ADD,BITBTN,Ok,188,225,32,32,#Conferma.bmp,,Conferma
  DIALOG ADD,BITBTN,Annulla,188,264,32,32,#Annulla.bmp,,Annulla
  DIALOG ADD,SPIN,TempoRef,85,181,32,24
  DIALOG ADD,TEXT,TEXT1,88,11,,,Controlla nuova posta ogni min.,,STYLE1
  DIALOG ADD,TEXT,TEXT2,13,5,,,Percorso Archivi,,STYLE1
  DIALOG SHOW
Goto Loop

:AnnullaButton|1
  Dialog Close
  While @Event()
  Wend
Goto Loop



:Close|0
:UscitaButton|0
If @Ask(Confermi Uscita?)
  Exit
Else
  Goto loop
End
:Fine
  OBJECT Remove,FONTCOMBO1
  OBJECT Remove,COLORCOMBO1
  OBJECT Remove,RICHEDIT1
  GUI REMOVE, TOOLTIPCTRL,TOOLTIPCTRL1
  GUI UnSubClass,#tooltiptst1

return this:
Code:

#Resource Add,Bitmap,NuovaMail.bmp,NuovaMail.bmp
#Resource Add,Bitmap,02MailClosed.bmp,02MailClosed.bmp
#Resource Add,Bitmap,Invia.bmp,Invia.bmp
#Resource Add,Bitmap,ConfigurationSettings.bmp,ConfigurationSettings.bmp
#Resource Add,Bitmap,EXIT.bmp,EXIT.bmp
#Resource Add,Bitmap,01rubrica.bmp,01rubrica.bmp
#Resource Add,Bitmap,BulletOn.bmp,BulletOn.bmp
#Resource Add,Bitmap,BulletOff.bmp,BulletOff.bmp
#Resource Add,Bitmap,x.bmp,x.bmp
#Resource Add,Bitmap,Open.bmp,Open.bmp
#Resource Add,Bitmap,Conferma.bmp,Conferma.bmp
#Resource Add,Bitmap,Annulla.bmp,Annulla.bmp

and the result can be writed to a file or copied to clipboard
Please tell me what you think about
Many tnx



CreaRis.rar
 Description:
Source code vds6

Download
 Filename:  CreaRis.rar
 Filesize:  18.19 KB
 Downloaded:  1841 Time(s)

Back to top
View user's profile Send private message Send e-mail
Claz
Newbie


Joined: 03 Jan 2009
Posts: 23
Location: The Netherlands

PostPosted: Mon Mar 15, 2010 7:42 pm    Post subject: Codegenerator Reply with quote

Hi Tdk161,

Your solution reminds me of a CodeGenerator I build: it analyses VDS code and creates a lot of standard code.

I include the executable here: just play around a bit and let me know what you think of it.
Ofcourse the source is free; if you want it, just let me know and I will put it here or in the general VDS forum section.

P.S.: I'm using a variable called %%Modal to control the usage of multiple dialog screens: the main screen is 0; a screen coming from the main is 1, etc. See the VDS Help manual for instructions regarding the @event(D) function.

Have fun with it...

Claz



VDSCodeGenerator.zip
 Description:

Download
 Filename:  VDSCodeGenerator.zip
 Filesize:  489.09 KB
 Downloaded:  1571 Time(s)

Back to top
View user's profile Send private message
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Mon Mar 15, 2010 8:25 pm    Post subject: Reply with quote

Hi Claz Smile
I tried it, I think it nice and in the future I will use it for coding, to do some repetitive action in my script
Thank you Very Happy
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Miscellaneous All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group