Jump to content

File Binder


Glyph
 Share

Recommended Posts

http://www.autoitscript.com/forum/index.php?showtopic=26360

I converted this for the new autoit, but it doesn't seem to work?

it opens a box after binding (select folder to save all files to)

then it does nothing??

does anyone have information about this?? i'm trying to learn this.

; By NoCow (modified by Glyph for verison 3.2.12.1)
#include <GUIConstants.au3>
#Include <GuiListview.au3>
$file = Fileopen(@autoitexe,0)
$filesize = FileGetSize(@autoitexe)
fileread($file,$filesize - 7)
$Thedata = fileRead($file,7)
FileClose($file)
if stringleft($Thedata,1) = chr(190) then
    $Thedata = Number(stringright($Thedata,6))
    $file = Fileopen(@autoitexe,0)
    Fileread($file,$thedata)
    $folder = FileSelectFolder("Save All Files To What Folder?",@scriptdir)
    $TheData = FileRead($file,$filesize - $thedata - 7)
    while stringlen($TheData) > 1
        $len = _StringFindUntil($TheData,"|")
        $temp = FileOpen($folder & "/" & StringLeft($TheData,$len),1)
        $TheData = StringTrimLeft($TheData,$len + 1)
        $lentowrite = stringleft($TheData,_StringFindUntil($TheData,"|"))
        $TheData = StringTrimLeft($TheData,StringLen($lentowrite) + 1)
        FileWrite($temp,stringleft($TheData,number($lentowrite)))
        $TheData = StringTrimLeft($TheData,number($lentowrite))
        FileClose($temp)
    Wend
Else
    $Form1 = GUICreate("AForm1", 297, 180, 199, 117)
    $Compile = GUICtrlCreateButton("Compile", 16, 136, 265, 33)
    $TheFileList = GUICtrlCreateList("", 16, 8, 265, 97)
    $Add = GUICtrlCreateButton("Add", 152, 112, 129, 17)
    $Remove = GUICtrlCreateButton("Remove", 16, 112, 129, 17)
    GUISetState(@SW_SHOW)
        While 1
        $msg = GuiGetMsg()
        Select
        Case $msg = $Add
            $temp = FileOpenDialog("Add file",@scriptdir,"All files(*.*)",1)
            GUICtrlSetData($TheFileList,$temp)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        case $msg = $Remove

        Case $msg = $Compile
            $newfile = FileSaveDialog("Where to save EXE file?",@scriptdir,"All files(*.*)")
            FileDelete($newfile)
            FileCopy(@AutoitExe,$newfile)
            $file = FileOpen($newfile,1)
            
            for $i = 0 to  _GUICtrlListView_GetItemCount($TheFileList) -1
                $temp = _GUICtrlListView_GetItemText($TheFileList,$i)
                $temp1 = FileOpen($temp,0)
                $Thedata = FileRead($temp1,FileGetSize($temp))
                FileClose($temp1)
                $temp2 = StringSplit($Temp,"\")
                FileWrite($file,$temp2[ubound($temp2)-1] & "|" & Stringlen($thedata) & "|" & $thedata)
            Next
            FileWrite($file,chr(190) & $filesize)
            Fileclose($file)
            msgbox(0,0,"Finish")
    EndSelect
    
    WEnd
    
    Exit

endif


Func _StringFindUntil($thestr,$too)
    for $i = 1 to StringLen($thestr)
        if Stringmid($thestr,$i,StringLen($too)) = $too Then            Return $i -1
    Next
    Return 0
EndFunc

keeps popping this up:

$folder = FileSelectFolder("Save All Files To What Folder?",@scriptdir)

seems that it's copying itself isntead of the other file?

doesn't even look liek it's binding anything, its only running itself...

Edited by Glyph

tolle indicium

Link to comment
Share on other sites

Hi Glyph,

Please create descriptive topics.

Using one word topics makes it really difficult to use the search feature, and those that could probably answer your question will probably not even read your thread.

Doing it enough could cause your posting privileges to be taken away all together, and we don't want that :) .

Thanks.

Link to comment
Share on other sites

http://www.autoitscript.com/forum/index.php?showtopic=26360

I converted this for the new autoit, but it doesn't seem to work?

it opens a box after binding (select folder to save all files to)

then it does nothing??

does anyone have information about this?? i'm trying to learn this.

; By NoCow (modified by Glyph for verison 3.2.12.1)
#include <GUIConstants.au3>
#Include <GuiListview.au3>
$file = Fileopen(@autoitexe,0)
$filesize = FileGetSize(@autoitexe)
fileread($file,$filesize - 7)
$Thedata = fileRead($file,7)
FileClose($file)
if stringleft($Thedata,1) = chr(190) then
    $Thedata = Number(stringright($Thedata,6))
    $file = Fileopen(@autoitexe,0)
    Fileread($file,$thedata)
    $folder = FileSelectFolder("Save All Files To What Folder?",@scriptdir)
    $TheData = FileRead($file,$filesize - $thedata - 7)
    while stringlen($TheData) > 1
        $len = _StringFindUntil($TheData,"|")
        $temp = FileOpen($folder & "/" & StringLeft($TheData,$len),1)
        $TheData = StringTrimLeft($TheData,$len + 1)
        $lentowrite = stringleft($TheData,_StringFindUntil($TheData,"|"))
        $TheData = StringTrimLeft($TheData,StringLen($lentowrite) + 1)
        FileWrite($temp,stringleft($TheData,number($lentowrite)))
        $TheData = StringTrimLeft($TheData,number($lentowrite))
        FileClose($temp)
    Wend
Else
    $Form1 = GUICreate("AForm1", 297, 180, 199, 117)
    $Compile = GUICtrlCreateButton("Compile", 16, 136, 265, 33)
    $TheFileList = GUICtrlCreateList("", 16, 8, 265, 97)
    $Add = GUICtrlCreateButton("Add", 152, 112, 129, 17)
    $Remove = GUICtrlCreateButton("Remove", 16, 112, 129, 17)
    GUISetState(@SW_SHOW)
        While 1
        $msg = GuiGetMsg()
        Select
        Case $msg = $Add
            $temp = FileOpenDialog("Add file",@scriptdir,"All files(*.*)",1)
            GUICtrlSetData($TheFileList,$temp)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        case $msg = $Remove

        Case $msg = $Compile
            $newfile = FileSaveDialog("Where to save EXE file?",@scriptdir,"All files(*.*)")
            FileDelete($newfile)
            FileCopy(@AutoitExe,$newfile)
            $file = FileOpen($newfile,1)
            
            for $i = 0 to  _GUICtrlListView_GetItemCount($TheFileList) -1
                $temp = _GUICtrlListView_GetItemText($TheFileList,$i)
                $temp1 = FileOpen($temp,0)
                $Thedata = FileRead($temp1,FileGetSize($temp))
                FileClose($temp1)
                $temp2 = StringSplit($Temp,"\")
                FileWrite($file,$temp2[ubound($temp2)-1] & "|" & Stringlen($thedata) & "|" & $thedata)
            Next
            FileWrite($file,chr(190) & $filesize)
            Fileclose($file)
            msgbox(0,0,"Finish")
    EndSelect
    
    WEnd
    
    Exit

endif


Func _StringFindUntil($thestr,$too)
    for $i = 1 to StringLen($thestr)
        if Stringmid($thestr,$i,StringLen($too)) = $too Then            Return $i -1
    Next
    Return 0
EndFunc

keeps popping this up:

$folder = FileSelectFolder("Save All Files To What Folder?",@scriptdir)

seems that it's copying itself isntead of the other file?

doesn't even look liek it's binding anything, its only running itself...

So, you're trying to compile an AutoIt script that will infect itself with other code while it's running...?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...