couincouin

FileExists + Toolbar = Bug

5 posts in this topic

#1 ·  Posted (edited)

hello, i have a strange bug with FileExists, it appear when i launch the app from the toolbar, 

For some unknow reason FileExist("history") seem to return 1 when i launch the app from the toolbar, and act normally when i launch it from the folder.

check the video,: 

https://www.youtube.com/watch?v=Q6gEXxUmhNo&feature=youtu.be

 

here the part of code :

 

If FileExists("history.ini") = 1 And FileExists(@AppDataDir & "\VAT Calculator\history.ini") = 1 Then
    MsgBox(0, "!", "Config files conflict, please delete one of them" & @LF & @AppDataDir & "\VAT Calculator\history.ini" & @LF & @ScriptDir & "\history.ini")
    Exit
EndIf

 

 

and the whole code :

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Icon_1.ico
#AutoIt3Wrapper_Outfile=calc.exe
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_Description=VAT Calculator
#AutoIt3Wrapper_Res_Fileversion=0.2.0.0
#EndRegion  ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayIconHide", 1)
Opt("GUIOnEventMode", 1)
#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>
#include <Crypt.au3>
$settingskey = DriveGetSerial(@HomeDrive & "\")


If FileExists("history.ini") = 1 And FileExists(@AppDataDir & "\VAT Calculator\history.ini") = 1 Then
    MsgBox(0, "!", "Config files conflict, please delete one of them" & @LF & @AppDataDir & "\VAT Calculator\history.ini" & @LF & @ScriptDir & "\history.ini")
    Exit
EndIf

If FileExists("history.ini") = 1 Then
    $drive = BinaryToString(_Crypt_DecryptData(IniRead("history.ini", "history", "4", ""), $settingskey, $CALG_AES_128))
    $browspath = BinaryToString(_Crypt_DecryptData(IniRead("history.ini", "history", "3", ""), $settingskey, $CALG_AES_128))
    $profiledir = BinaryToString(_Crypt_DecryptData(IniRead("history.ini", "history", "5", ""), $settingskey, $CALG_AES_128))
    $browser = BinaryToString(_Crypt_DecryptData(IniRead("history.ini", "history", "6", ""), $settingskey, $CALG_AES_128))
Else
    If FileExists(@AppDataDir & "\VAT Calculator\history.ini") = 1 Then
        $drive = BinaryToString(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "4", ""), $settingskey, $CALG_AES_128))
        $browspath = BinaryToString(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "3", ""), $settingskey, $CALG_AES_128))
        $profiledir = BinaryToString(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "5", ""), $settingskey, $CALG_AES_128))
        $browser = BinaryToString(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "6", ""), $settingskey, $CALG_AES_128))
    Else
        $drive = "z"
        $browspath = "C:\Program Files (x86)\Google\Chrome\Application\"
        $profiledir = "\profile\"
        $browser = "chrome"
    EndIf
EndIf

If FileExists($drive & ":/") = 0 Then

    If FileExists("history.ini") = 1 Then
        $hidepass = Binary(_Crypt_DecryptData(IniRead("history.ini", "history", "7", ""), $settingskey, $CALG_AES_128))
        $tcpath = BinaryToString(_Crypt_DecryptData(IniRead("history.ini", "history", "1", ""), $settingskey, $CALG_AES_128))
        $file = BinaryToString(_Crypt_DecryptData(IniRead("history.ini", "history", "2", ""), $settingskey, $CALG_AES_128))
    Else
        If FileExists(@AppDataDir & "\VAT Calculator\history.ini") = 1 Then
            $hidepass = Binary(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "7", ""), $settingskey, $CALG_AES_128))
            $tcpath = BinaryToString(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "1", ""), $settingskey, $CALG_AES_128))
            $file = BinaryToString(_Crypt_DecryptData(IniRead(@AppDataDir & "\VAT Calculator\history.ini", "history", "2", ""), $settingskey, $CALG_AES_128))
        Else
            $hidepass = 1
            $tcpath = "C:\Program Files (x86)\TrueCrypt\"
            $file = "C:\file"
        EndIf
    EndIf

    Global $Display_String = '', $Real_String = '', $1, $2, $3, $5, $4, $6, $7

    $MainGui = GUICreate("VAT Calculator", 317, 400, 278, 166)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
    $Display = GUICtrlCreateInput("0", 24, 32, 265, 35, $ES_RIGHT)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent(-1, "Go")
    _Set_Text()
    GUISetState(@SW_SHOW)

    While ('1')
        Sleep('250')
        If $hidepass = 1 Then
            Local $hid
            $pass = GUICtrlRead($Display)
            If StringLen($pass) > 4 And StringIsDigit($pass) = 0 And $hid = 0 And StringInStr($pass, " + ") = 0 And StringInStr($pass, " - ") = 0 And StringInStr($pass, " × ") = 0 And StringInStr($pass, " ÷ ") = 0 And StringInStr($pass, " +VAT ") = 0 And StringInStr($pass, " . ") = 0 Then
                GUICtrlDelete($Display)
                $Display = GUICtrlCreateInput($pass, 24, 32, 265, 35, $ES_PASSWORD + $ES_RIGHT)
                GUICtrlSetFont(-1, 14, 800, 0, "Arial")
                GUICtrlSetOnEvent(-1, "go")
                ControlClick($MainGui, "", $Display, "left", 1, 260)
                $hid = 1
            EndIf
            If StringLen($pass) < 5 Or StringIsDigit($pass) = 1 And $hid = 1 Then
                GUICtrlDelete($Display)
                $Display = GUICtrlCreateInput($pass, 24, 32, 265, 35, $ES_RIGHT)
                GUICtrlSetFont(-1, 14, 800, 0, "Arial")
                GUICtrlSetOnEvent(-1, "go")
                ControlClick($MainGui, "", $Display, "left", 1, 260)
                $hid = 0
            EndIf
        EndIf
    WEnd
EndIf
Brows()

Exit

Func Options()
    Local $aGUI_Main_Pos = WinGetPos($MainGui)
    GUICtrlSetData($Display, "")
    GUISetState(@SW_DISABLE, $MainGui)
    $OptionsGui = GUICreate("Config", 317, 400, 1, 1, $WS_CAPTION, "", $MainGui)
    WinMove($OptionsGui, "", $aGUI_Main_Pos[0] + $aGUI_Main_Pos[2], $aGUI_Main_Pos[1])
    GUICtrlCreateLabel("TC path", 5, 22)
    GUICtrlCreateLabel("Volume", 5, 47)
    GUICtrlCreateLabel("Browser path", 5, 72)
    GUICtrlCreateLabel("Drive", 5, 97)
    GUICtrlCreateLabel("Profile path", 5, 122)
    GUICtrlCreateLabel("Browser", 5, 147)
    $1 = GUICtrlCreateInput($tcpath, 70, 20, 240, 20)
    $2 = GUICtrlCreateInput($file, 70, 45, 240, 20)
    $3 = GUICtrlCreateInput($browspath, 70, 70, 240, 20)
    $4 = GUICtrlCreateInput($drive, 70, 95, 240, 20)
    GUICtrlSetLimit(-1, 1)
    $5 = GUICtrlCreateInput($profiledir, 70, 120, 240, 20)
    $6 = GUICtrlCreateCombo($browser, 70, 145, 240, 20, $CBS_DROPDOWNLIST)
    $7 = GUICtrlCreateCheckbox("Hide password", 70, 170, 240, 20)
    If $hidepass = 1 Then GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlCreateButton("Cancel", 110, 240)
    GUICtrlSetOnEvent(-1, "CancelOptions")
    GUICtrlCreateButton("Save", 160, 240)
    GUICtrlSetOnEvent(-1, "SaveOptions")
    GUISetState(@SW_SHOW)
EndFunc    ;==>Options

Func CancelOptions()
    GUISetState(@SW_HIDE)
    GUISetState(@SW_ENABLE, $MainGui)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>CancelOptions

Func SaveOptions()
    $tcpath = GUICtrlRead($1)
    $file = GUICtrlRead($2)
    $browspath = GUICtrlRead($3)
    $drive = GUICtrlRead($4)
    $profiledir = GUICtrlRead($5)
    $browser = GUICtrlRead($6)
    $hidepass = GUICtrlRead($7)

;~  GUICreate("Save path", 300, 200)
;~  GUICtrlCreateLabel("Save settings to?", 5, 15)
;~  $a = GUICtrlCreateButton("This folder", 20, 50)
;~  $b = GUICtrlCreateButton("AppData folder", 60, 50)

    If FileWrite("writetest", "0") = 1 And FileExists(@AppDataDir & "\VAT Calculator\history.ini") = 0 Then
        FileDelete("writetest")
        IniWrite("history.ini", "history", "1", _Crypt_EncryptData($tcpath, $settingskey, $CALG_AES_128))
        IniWrite("history.ini", "history", "2", _Crypt_EncryptData($file, $settingskey, $CALG_AES_128))
        IniWrite("history.ini", "history", "3", _Crypt_EncryptData($browspath, $settingskey, $CALG_AES_128))
        IniWrite("history.ini", "history", "4", _Crypt_EncryptData($drive, $settingskey, $CALG_AES_128))
        IniWrite("history.ini", "history", "5", _Crypt_EncryptData($profiledir, $settingskey, $CALG_AES_128))
        IniWrite("history.ini", "history", "6", _Crypt_EncryptData($browser, $settingskey, $CALG_AES_128))
        IniWrite("history.ini", "history", "7", _Crypt_EncryptData($hidepass, $settingskey, $CALG_AES_128))
    Else
        If FileExists(@AppDataDir & "\VAT Calculator\history.ini") = 0 Then
            $verify = MsgBox(4, "/!\", "No write rights on this folder!" & @LF & "Save settings to " & @AppDataDir & "\VAT Calculator\ ?")
            If $verify = 6 Then
                DirCreate(@AppDataDir & "\VAT Calculator\")
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "1", _Crypt_EncryptData($tcpath, $settingskey, $CALG_AES_128))
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "2", _Crypt_EncryptData($file, $settingskey, $CALG_AES_128))
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "3", _Crypt_EncryptData($browspath, $settingskey, $CALG_AES_128))
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "4", _Crypt_EncryptData($drive, $settingskey, $CALG_AES_128))
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "5", _Crypt_EncryptData($profiledir, $settingskey, $CALG_AES_128))
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "6", _Crypt_EncryptData($browser, $settingskey, $CALG_AES_128))
                IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "7", _Crypt_EncryptData($hidepass, $settingskey, $CALG_AES_128))
            ElseIf $verify = 7 Then
                Exit
            EndIf
        Else
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "1", _Crypt_EncryptData($tcpath, $settingskey, $CALG_AES_128))
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "2", _Crypt_EncryptData($file, $settingskey, $CALG_AES_128))
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "3", _Crypt_EncryptData($browspath, $settingskey, $CALG_AES_128))
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "4", _Crypt_EncryptData($drive, $settingskey, $CALG_AES_128))
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "5", _Crypt_EncryptData($profiledir, $settingskey, $CALG_AES_128))
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "6", _Crypt_EncryptData($browser, $settingskey, $CALG_AES_128))
            IniWrite(@AppDataDir & "\VAT Calculator\history.ini", "history", "7", _Crypt_EncryptData($hidepass, $settingskey, $CALG_AES_128))
        EndIf
    EndIf
    GUISetState(@SW_HIDE)
    GUISetState(@SW_ENABLE, $MainGui)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>SaveOptions

Func Go()
    $pass = GUICtrlRead($Display)
    If $pass = "conf" Then Options()
    If StringLen($pass) > 5 And StringIsDigit($pass) = 0 And StringInStr($pass, " + ") = 0 And StringInStr($pass, " - ") = 0 And StringInStr($pass, " × ") = 0 And StringInStr($pass, " ÷ ") = 0 And StringInStr($pass, " +VAT ") = 0 And StringInStr($pass, " . ") = 0 Then
        If FileExists($tcpath) = 1 And FileExists($file) = 1 Then
            Run($tcpath & "TrueCrypt.exe /v " & $file & " /l" & $drive & " /p " & $pass & " /a /q background", @SystemDir, @SW_SHOW)
            Do
                Sleep(200)
            Until FileExists($drive & ":/") = 1
            Brows()
            Exit
;~      Else
;~          TraySetState(1)
;~          TrayTip("", "tc/volume path invalid", 15, 2)
;~          TraySetState(2)
        EndIf
    EndIf
EndFunc    ;==>Go

Func Brows()
    If $browser = "chrome" Then
        If FileExists($browspath) = 1 And FileExists($drive & ":" & $profiledir) = 1 Then
            Run($browspath & "chrome.exe --user-data-dir=" & $drive & ":" & $profiledir, @SystemDir, @SW_SHOW)
        Else
            TraySetState(1)
            TrayTip("", "browser or/and profile path invalid", 15, 2)
            TraySetState(2)
        EndIf
    EndIf
;~  If $browser = "firefox" Then
;~  EndIf
    $space = Round(DriveSpaceFree($drive & ":\"))
    If $space < "150" Then
        TraySetState(1)
        TrayTip("", "Only " & $space & " MB left on " & $drive & ":/ !!", 15, 2)
        TraySetState(2)
    EndIf
EndFunc    ;==>Brows

Func _Set_Text()

    $Button1 = GUICtrlCreateButton("1", 32, 104, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button1, '_Set_1')

    $Button2 = GUICtrlCreateButton("2", 92, 104, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button2, '_Set_2')

    $Button3 = GUICtrlCreateButton("3", 152, 104, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button3, '_Set_3')

    $Button4 = GUICtrlCreateButton("4", 32, 164, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button4, '_Set_4')

    $Button5 = GUICtrlCreateButton("5", 92, 164, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button5, '_Set_5')

    $Button6 = GUICtrlCreateButton("6", 152, 164, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button6, '_Set_6')

    $Button7 = GUICtrlCreateButton("7", 32, 223, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button7, '_Set_7')

    $Button8 = GUICtrlCreateButton("8", 92, 223, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button8, '_Set_8')

    $Button9 = GUICtrlCreateButton("9", 152, 223, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button9, '_Set_9')

    $Button0 = GUICtrlCreateButton("0", 92, 282, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($Button0, '_Set_0')

    $ButtonADD = GUICtrlCreateButton("+", 231, 104, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonADD, '_Add')

    $ButtonMINUS = GUICtrlCreateButton("-", 231, 164, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonMINUS, '_Minus')

    $ButtonDIVIDE = GUICtrlCreateButton("÷", 231, 282, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonDIVIDE, '_Divide')

    $ButtonTIMES = GUICtrlCreateButton("x", 231, 223, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonTIMES, '_Times')

    $ButtonEqual = GUICtrlCreateButton("=", 231, 341, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonEqual, '_Equal')

    $ButtonDecimal = GUICtrlCreateButton(".", 152, 282, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonDecimal, '_Decimal')

    $ButtonVAT = GUICtrlCreateButton("+VAT", 32, 282, 49, 49)
    GUICtrlSetFont(-1, 8, 800, 0, "Arial")
    GUICtrlSetOnEvent($ButtonVAT, '_VAT')

    $ClearButton = GUICtrlCreateButton("C", 152, 341, 49, 49)
    GUICtrlSetFont(-1, 14, 800, 0, "Arial")
    GUICtrlSetOnEvent($ClearButton, '_Clear')
EndFunc    ;==>_Set_Text

Func _Set_0()
    _Set_Number('0')
EndFunc    ;==>_Set_0

Func _Set_1()
    _Set_Number('1')
EndFunc    ;==>_Set_1

Func _Set_2()
    _Set_Number('2')
EndFunc    ;==>_Set_2

Func _Set_3()
    _Set_Number('3')
EndFunc    ;==>_Set_3

Func _Set_4()
    _Set_Number('4')
EndFunc    ;==>_Set_4

Func _Set_5()
    _Set_Number('5')
EndFunc    ;==>_Set_5

Func _Set_6()
    _Set_Number('6')
EndFunc    ;==>_Set_6

Func _Set_7()
    _Set_Number('7')
EndFunc    ;==>_Set_7

Func _Set_8()
    _Set_Number('8')
EndFunc    ;==>_Set_8

Func _Set_9()
    _Set_Number('9')
EndFunc    ;==>_Set_9

Func _Clear()
    GUICtrlSetData($Display, '')
    $Real_String = ''
    $Display_String = ''
EndFunc    ;==>_Clear

Func _Divide()
    $Display_String = ($Display_String & ' ÷ ')
    $Real_String = ($Real_String & ' / ')
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Divide

Func _Times()
    $Display_String = ($Display_String & ' × ')
    $Real_String = ($Real_String & ' * ')
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Times

Func _Minus()
    $Display_String = ($Display_String & ' - ')
    $Real_String = ($Real_String & ' - ')
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Minus

Func _Add()
    $Display_String = ($Display_String & ' + ')
    $Real_String = ($Real_String & ' + ')
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Add

Func _VAT()
    $Display_String = ($Display_String & ' +VAT ')
    $Real_String = ($Real_String & ' * 1.175')
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_VAT

Func _Equal()
    $Equal = Execute($Real_String)
    GUICtrlSetData($Display, $Equal)
    $Display_String = ($Equal)
    $Real_String = ($Equal)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Equal

Func _Decimal()
    $Display_String = ($Display_String & ' . ')
    $Real_String = ($Real_String & ' ????? ')
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Decimal

Func _Set_Number($Number)
    $Display_String = ($Display_String & $Number)
    $Real_String = ($Real_String & $Number)
    GUICtrlSetData($Display, $Display_String)
    GUICtrlSetState($Display, $GUI_FOCUS)
EndFunc    ;==>_Set_Number

Func _Exit()
    Exit
EndFunc    ;==>_Exit

 

 

Any workaround ? thanks guys =)

Edited by couincouin

Share this post


Link to post
Share on other sites



Without spitting through the whole script: Are you sure the script always look in the same directory? In other words: is the @workdir these same in all cases?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

thanks, yes i've cheked and when i launch the app from the folder the working dir is correct and if i laucnh it from the toolbar the working dir is replaced with "c:\\windows\system32"

here a smaller example 

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=test.exe
#EndRegion  ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayIconHide", 1)

DirCreate(@AppDataDir & "\test")
IniWrite(@AppDataDir & "\test\history.ini", "test", "test", "test")


If FileExists("history.ini") = 1 And FileExists(@AppDataDir & "\test\history.ini") = 1 Then
    MsgBox(0, "-- IF THEN --", @WorkingDir & @LF & FileExists("history.ini") & @LF & FileExists(@AppDataDir & "\test\history.ini"))
Else
    MsgBox(0, "-- ELSE --", @WorkingDir & @LF & FileExists("history.ini") & @LF & FileExists(@AppDataDir & "\test\history.ini"))
EndIf

FileDelete(@AppDataDir & "\test\history.ini")
DirRemove(@AppDataDir & "\test")

Exit

 

 

there is my 2 problems  :

1) Working dir is replaced with "c:\\windows\system32" when launched from the toolbar 

2) FileExists("history.ini")  is returning 1 instead of 0  (only when launched from the toolbar)

 

 

 

 

Edit, updated the example.

 

thanks

Edited by couincouin

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

so,. Fix the workdir and ensure it is always correct. ;)

FileChangeDir()

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Awesome, thanks you jos !

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=test.exe
#EndRegion  ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayIconHide", 1)

FileChangeDir(@ScriptDir)

DirCreate(@AppDataDir & "\test")
IniWrite(@AppDataDir & "\test\history.ini", "test", "test", "test")


If FileExists("history.ini") = 1 And FileExists(@AppDataDir & "\test\history.ini") = 1 Then
    MsgBox(0, "-- IF THEN --", @WorkingDir & @LF & FileExists("history.ini") & @LF & FileExists(@AppDataDir & "\test\history.ini"))
Else
    MsgBox(0, "-- ELSE --", @WorkingDir & @LF & FileExists("history.ini") & @LF & FileExists(@AppDataDir & "\test\history.ini"))
EndIf

FileDelete(@AppDataDir & "\test\history.ini")
DirRemove(@AppDataDir & "\test")

Exit

 

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