Autorun Maker, Questo è utile...

« Older   Newer »
  Share  
FrontBack
CAT_IMG Posted on 3/11/2010, 21:52     +1   -1




Autorun Maker


Nuova versione! 2.0.0



Per chi non avesse conoscenza con l'autorun, ma ne vorrebbe uno, questo è il programmino che fa per lui! ;)
Vi presento Autorun Maker!
Grazie a semplici funzioni il codice è in grado di fare un autorun molto professionale! ;)

NB: prima di usarlo, leggere ASSOLUTAMENTE qui!

Eccovi il codice:
SPOILER (click to view)
CODICE
; #########################
; #     Autorun Maker     #
; #      By FrontBack     #
; # Under GNU/GPL License #
; #    Version 2.0.0      #
; #########################

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon
#cs
GNU/GPL License
Auutorun Maker Copyright (C) 2010 Nicolò Di Domenico

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
#ce

Global $i
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Autorun Maker", 625, 445, 192, 124)
$Input1 = GUICtrlCreateInput("", 64, 24, 249, 21)
$Label1 = GUICtrlCreateLabel("File da aprire all'inserimento del CD o DVD (deve essere nella Root del supporto):", 64, 7, 505, 17)
$Button1 = GUICtrlCreateButton("Sfoglia...", 328, 24, 65, 25, $WS_GROUP)
$Label2 = GUICtrlCreateLabel("Icona che apparirà in Esplora Risorse: (deve essere nella Root del supporto):", 64, 56, 583, 17)
$Input2 = GUICtrlCreateInput("", 64, 75, 198, 21)
$Label2_2 = GUICtrlCreateLabel("\",262,77,5,17)
$Input2_2 = GUICtrlCreateInput("",267,75,51,21)
$Button2 = GUICtrlCreateButton("Sfoglia...", 328, 73, 65, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Estrai...", 400, 73, 65, 25, $WS_GROUP)
$Label3 = GUICtrlCreateLabel("Funzioni del Menù Contestuale:", 64, 144, 152, 17)
$Label4 = GUICtrlCreateLabel("NB: Inserire con questa sintassi: "&Chr(34)&"TestoDelTasto|FileAperto"&Chr(34)&". Per più funzioni andare a capo.", 64, 168, 452, 17)
$Edit1 = GUICtrlCreateEdit("", 64, 192, 257, 233)
$Button4 = GUICtrlCreateButton("Genera!", 424, 408, 97, 25, $WS_GROUP)
$Label5 = GUICtrlCreateLabel("Testo che apparirà quando si inserirà il CD o DVD:", 64, 97, 241, 17)
$Input3 = GUICtrlCreateInput("", 64, 120, 249, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$d = DriveGetDrive("CDROM")
$cd = $d[1]&"\"
While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
              Case $GUI_EVENT_CLOSE
                      Exit
                          Case $Button3 ;===> NEW! 2.0.0
                                                               _ExploreIcons()
              Case $Button2
                              $IconFile = FileOpenDialog("Seleziona una icona...",$cd,"Icone Windows (*.ico)",1+2)
                              GUICtrlSetData($Input2,$IconFile)
              Case $Button1
                              $OpenFile = FileOpenDialog("Seleziona un file da aprire...",$cd,"Tutti i File (*.*)",1+2)
                              GUICtrlSetData($Input1,$OpenFile)
              Case $Button4
                              $AutorunFile = FileSaveDialog("Salva file Autorun.inf",@ScriptDir,"File Autorun (autorun.inf)",2+16,"autorun.inf")
                              If GUICtrlRead($Input1) = "" Then
                                      MsgBox(16,"Autorun Maker","Inserisci prima un file da aprire!")
                              Else
                                                                       _GenerateOpen($AutorunFile)
                              EndIf
                              If Not GUICtrlRead($Input2) = "" Then
                                                                       _GenerateIcon($AutorunFile)
                              EndIf
                              If Not GUICtrlRead($Input3) = "" Then
                                      IniWrite($AutorunFile,"autorun","label",GUICtrlRead($Input3))
                              EndIf
                              If Not GUICtrlRead($Edit1) = "" Then
                                                                       _GenerateContext($AutorunFile)
                              EndIf
                              MsgBox(64,"Autorun Maker","La generazione del file .inf è completata. Per vederlo in azione, è necessario inserire un CD o un DVD.")
                              Run("explorer.exe "&$cd)
                              Exit
      EndSwitch

WEnd

; Actions compressed in functions! ===> NEW! 2.0.0
Func _GenerateOpen($oFile)
       $OpenSplitted = StringSplit(GUICtrlRead($Input1),"\")
       $Open = $OpenSplitted[$i]
       $Open = $OpenSplitted[$Open]
       $Ext = StringSplit($Open,".")
   If $Ext[2] = "exe" Then
               IniWrite($oFile,"autorun","Open",$Open)
       Else
               IniWrite($oFile,"autorun","ShellExecute",$Open)
       EndIf
EndFunc

Func _GenerateIcon($iFile)
       $IconSplitted = StringSplit(GUICtrlRead($Input2),"\")
       $Icon = $IconSplitted[$i]
   $AutorunIcon = $IconSplitted[$Icon - 1]
       $AutorunIcon2 = $IconSplitted[$Icon]
       $Ext2 = StringSplit($AutorunIcon,".")
       If GUICtrlRead($Input2_2) = "" Then
               IniWrite($iFile,"autorun","icon",$AutorunIcon)
       Else
               IniWrite($iFile,"autorun","icon",$AutorunIcon2&", "&GUICtrlRead($Input2_2))
       EndIf
EndFunc

Func _GenerateContext($cFile)
       $ContextLines = StringSplit(GUICtrlRead($Edit1),@CRLF)
   $count2 = 1
   $count3 = 1
       For $count = 1 To $ContextLines[$i]-1
               $ContextData = StringSplit($ContextLines[$count2],"|")
               $ContextName = $ContextData[1]
       IniWrite($AutorunFile,"autorun","shell\"&$count3,"&"&$ContextData[1])
               IniWrite($AutorunFile,"autorun","shell\"&$count3&"\command",$ContextData[2])
               $count2 = $count2 + 2
               $count3 = $count3 + 1
       Next
EndFunc

Func _ExploreIcons()
          Local $FileName  = @WindowsDir&"\System32\Shell32.dll"
      Local $_Icon     =  DllStructCreate("int")
          Local $String   = DLLStructCreate("wchar[260]")
      Local $Str = DllStructGetSize($String)/2
      DllStructSetData($String, 1, $FileName)
      DllCall("shell32.dll", "none", 62, "hwnd", 0, "ptr", DllStructGetPtr($String), "int", $Str, "ptr", DllStructGetPtr($_Icon))
          Local $FileName  = DllStructGetData($String, 1)
          Local $IconIndex = DllStructGetData($_Icon, 1)
      GUICtrlSetData($Input2,$FileName)
          GUICtrlSetData($Input2_2,$IconIndex)
EndFunc


Il programma è sotto licenza GNU/GPL!

Edited by FrontBack - 5/11/2010, 17:30
 
Top
xMasteRx
CAT_IMG Posted on 3/11/2010, 23:57     +1   -1




Interessante... questo l'aggiungo al mio archivio XD
ogni tanto può essere utile, complimenti ;)

PS:
Comunque, quando metti la licenza GNU/GPL, metti questo nel tuo script:
SPOILER (click to view)
#cs
NomeProgramma Copyright (C) Ano TuoNomeCognome

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
#ce

e di preferenza mettilo anche in un ConsoleWrite() ;)
[erano i consigli presi direttamente dalla licenza GNU/GPL originale [si, l'o letta completamente XDXD]]
 
Top
FrontBack
CAT_IMG Posted on 4/11/2010, 17:53     +1   -1




@xMasteRx: cavoli, che pazienza che ci vuole! Comunque adesso lo aggiorno.

EDIT: aggiornato
 
Top
FrontBack
CAT_IMG Posted on 4/11/2010, 18:38     +1   -1




UPDATE IMPORTANTE: Versione 2.0.0

Vi ricordate che nel vecchio codice avevo tolto una funzione di estrazione delle icone?

Se sì, ho risolto! :woot:

Attenzione!!!!

Leggere bene! Se nella fase di estrazione delle immagini da una dll di sistema (tipo la comune shell32.dll) il vostro antivirus potrebbe dare segni di vita e far scattare l'allarme. Io non ho mai dato questo fatto come falso positivo, io ve lo dico.

In altre parole, non so se è al 100% un falso positivo, quindi USATE LA FUNZIONE A VOSTRO RISCHIO E PERICOLO!!
NB. Non mi ritengo responsabile di eventuali danni al vostro computer.

Scusate, non volevo urlare, ma solo mettere in evidenza una nota importante.
 
Top
3 replies since 3/11/2010, 21:52   310 views
  Share