Sign in to follow this  
Followers 0
LimeSeed

Fileinstall

5 posts in this topic

#1 ·  Posted (edited)

so i have an autoit script as follows. Whenever i try to compile it it says "invalid fileinstall() function:" and then exits. Is there something i am doing wrong with the file install? also when i syntax check, it says no errors, it must not look for compiling errors. Thanks

#region ; Code generated by EzSkin_1-2-3, Created by Valuater
; For personal use only, All Rights Reserved
; Author of this code: Valuater
; Thank you big_daddy and Joscpe

#include <string.au3>
#include <GUIConstants.au3>
#include <EzSkin.au3>
if not fileexists(@ScriptDir &  "/EzSkin/2.bmp") Then
fileinstall(@ScriptDir & "/EzSkin/0.bmp",@ScriptDir &  "/EzSkin/0.bmp")
fileinstall(@ScriptDir &  "/EzSkin/1.bmp",@ScriptDir &  "/EzSkin/1.bmp")
fileinstall(@ScriptDir &  "/EzSkin/2.bmp", @ScriptDir &  "/EzSkin/2.bmp")
fileinstall(@ScriptDir &  "/EzSkin/3.bmp", @ScriptDir &  "/EzSkin/3.bmp")
fileinstall(@ScriptDir &  "/EzSkin/4.bmp", @ScriptDir &  "/EzSkin/4.bmp")
fileinstall(@ScriptDir &  "/EzSkin/5.bmp", @ScriptDir &  "/EzSkin/5.bmp")
fileinstall(@ScriptDir &  "/EzSkin/6.bmp", @ScriptDir &  "/EzSkin/6.bmp")
fileinstall(@ScriptDir &  "/EzSkin/7.bmp", @ScriptDir &  "/EzSkin/7.bmp")
fileinstall(@ScriptDir &  "/EzSkin/dblue1.bmp", @ScriptDir &  "/EzSkin/dblue1.bmp")
fileinstall(@ScriptDir &  "/EzSkin/dblue2.bmp", @ScriptDir &  "/EzSkin/dblue2.bmp")
fileinstall(@ScriptDir &  "/EzSkin/Normal.gif", @ScriptDir &  "/EzSkin/Normal.gif")
fileinstall(@ScriptDir &  "/EzSkin/O_hold.gif", @ScriptDir &  "/EzSkin/O_hold.gif")
fileinstall(@ScriptDir &  "/EzSkin/Over.gif", @ScriptDir &  "/EzSkin/Over.gif")
fileinstall(@ScriptDir &  "/EzSkin/P_hold.gif", @ScriptDir &  "/EzSkin/P_hold.gif")
fileinstall(@ScriptDir &  "/EzSkin/Press.gif", @ScriptDir &  "/EzSkin/Press.gif")
fileinstall(@ScriptDir &  "/EzSkin/Skin.dat", @ScriptDir &  "/EzSkin/Skin.dat")
EndIf

$EzGUI = EzSkinGUICreate("Binary Converter",300,300)
$EzIcon = EzSkinIcon($EzGUI)



;$Button = EzSkinButton("EzSkin Button", 150, 150, 100, 30) ;, $font_color)
$menu = guictrlcreatemenu("Menu")
$open = guictrlcreatemenuitem("Open", $menu)
$save = guictrlcreatemenuitem("Save", $menu)
$copy = guictrlcreatemenuitem("Copy", $menu)
$paste = Guictrlcreatemenuitem("Paste", $menu)
$exit = Guictrlcreatemenuitem("Exit", $menu)
$about = Guictrlcreatemenuitem("About", $menu)
$display = Guictrlcreateedit("", 5, 60, 290, 215)
$tobinary = EzSkinButton("Convert to Binary", 5, 20, 145, 35)
$tostring = EzSkinButton("Convert to String", 150, 20, 145, 35)


GUISetState()

While 1
    EzSkinOver()

    $msg = GUIGetMsg()
        If $msg = $EzIcon[1] Then Exit
    If $msg = $EzIcon[2] Then GuiSetstate(@SW_MINIMIZE, $EzGUI)
    Select
        Case ($msg = $copy)
            $readata = guictrlread($display)
            clipput($readata)
        Case ($msg = $paste)
            $put = clipget()
            guictrlsetdata($display, $put)
        Case ($msg = $exit)
            Exit
        Case ($msg = $about)
            msgbox(0, "About", "")
        Case ($msg = $open)
            $openfile = fileopendialog("Open", @desktopdir, "All Files (*.*)")
            $openfileread = fileopen($openfile, 0)
            $data2 = fileread($openfileread)
            guictrlsetdata($display, $data2)
        Case ($msg = $save)
            $readdata = guictrlread($display)
            $savedialog = filesavedialog("Save", @desktopdir, "Text Files (*.txt)")
            filewrite($savedialog, $readdata)
        Case ($msg = $tobinary)
            $input5 = guictrlread($display)
            $input4 = _StringToHex($input5)
            $res = _HexToBinaryString($input4)
            switch @error
                Case 0
                    Guictrlsetdata($display, $res)
                Case -1
                    MsgBox(0,'ERROR',$input & ' is not a valid Hex value.')
                case -2
                    Guictrlsetdata($display, '')
            EndSwitch
        Case ($msg = $tostring)
            $binaryvalue = guictrlread($display)
            $res = _BinaryToHexString($BinaryValue)
            $res1 = _hextostring($res)
            switch @error
                Case 0
                    Guictrlsetdata($display, $res1)
                Case -1
                    MsgBox(0,'ERROR',$input & ' is not a valid Binary value.')
                case -2
                    Guictrlsetdata($display, '')
            EndSwitch
    EndSelect
WEnd



Func _BinaryToHexString($BinaryValue)
    Local $test, $Result = '',$numbytes,$nb

    if $BinaryValue = '' Then
        SetError(-2)
        Return
    endif

    Local $bits = "0000|0001|0010|0011|0100|0101|0110|0111|1000|1001|1010|1011|1100|1101|1110|1111"
    $bits = stringsplit($bits,'|')
    #region check string is binary

    $test = stringreplace($BinaryValue,'1','')
    $test = stringreplace($test,'0','')
    if $test <> '' Then
        SetError(-1);non binary character detected
        Return
    endif
    #endregion check string is binary

    #region make binary string an integral multiple of 4 characters
    While 1
        $nb = Mod(StringLen($BinaryValue),4)
        if $nb = 0 then exitloop
        $BinaryValue = '0' & $BinaryValue
    WEnd
    #endregion make binary string an integral multiple of 4 characters

    $numbytes = Int(StringLen($BinaryValue)/4);the number of bytes

    Dim $bytes[$numbytes],$Deci[$numbytes]
    For $j = 0 to $numbytes - 1;for each byte
    ;extract the next byte
        $bytes[$j] = StringMid($BinaryValue,1+4*$j,4)

    ;find what the dec value of the byte is
        for $k = 0 to 15;for all the 16 possible hex values
            if $bytes[$j] = $bits[$k+1] Then
                $Deci[$j] = $k
                ExitLoop
            EndIf
        next
    Next

;now we have the decimal value for each byte, so stitch the string together again
    $Result = ''
    for $l = 0 to $numbytes - 1
        $Result &= Hex($Deci[$l],1)
    Next
    return $Result
EndFunc

Func _HexToBinaryString($HexValue)
    Local $Allowed = '0123456789ABCDEF'
    Local $Test,$n
    Local $Result = ''
    if $hexValue = '' then
        SetError(-2)
        Return
    EndIf

    $hexvalue = StringSplit($hexvalue,'')
    for $n = 1 to $hexValue[0]
        if not StringInStr($Allowed,$hexvalue[$n]) Then
            SetError(-1)
            return 0
        EndIf
    Next

    Local $bits = "0000|0001|0010|0011|0100|0101|0110|0111|1000|1001|1010|1011|1100|1101|1110|1111"
    $bits = stringsplit($bits,'|')
    for $n = 1 to $hexvalue[0]
        $Result &=  $bits[Dec($hexvalue[$n])+1]
    Next

    Return $Result

EndFunc





#endregion
Edited by LimeSeed

global $warming = true

Share this post


Link to post
Share on other sites



Try to use \ instead of /

nope, still get the file install error but thanks! i would feel like an ididot if that was the solution!


global $warming = true

Share this post


Link to post
Share on other sites

replace by

fileinstall("C:\Your path\EzSkin\0.bmp",@ScriptDir &  "\EzSkin\0.bmp")
Zedna is correct, but to explain why:

The source path of the file to compile. This must be a literal string; it cannot be a variable.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
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
Sign in to follow this  
Followers 0