Jump to content

Main script not executing function (function) from other file


sundar
 Share

Recommended Posts

I am having an issue with executing function which are available in another file. Basically i have main script (file1) for GUI and another file (file 2) contain only functions (created by me). At the moment i have written three functions each will be executed while pressing buttons. Third function is not executing and dont know where i am making mistake. All three functions uses same variables, so i set all the variables as globle in file1. To test third function i included MsgBox after every line. Form the MsgBox out put i could see that there is no issue with variables but i am struck in this line

$EXT_FILE = '7z.exe x' & " " & $ARCHIVE_FILE & " " & "-y -o" & $DESTINATION_FOLDER & " " & 'file.txt' & " " & "-r"
RunWait($EXT_FILE, "", @SW_HIDE)

7z.exe is in script folder. If i provide variables $ARCHIVE_FILE & $DESTINATION_FOLDER directly and run file 2 then the function works with out an issue. Where am i making mistake?

Edited by sundar
Link to comment
Share on other sites

To be more specific i have shown the (trouble) function code below. The variable $FILE is actually created by the main program.

Func ADD ()
If FileExists ( $FILE ) Then
  $EXT = "C:\Temp\temp"
  DirCreate ( $EXT )
  Local $EXT_FILE
  $EXT_FILE = '7z.exe x' & " " & $FILE & " " & "-y -o" & $EXT & " " & 'file.txt' & " " & "-r"
    RunWait($EXT_FILE, "", @SW_HIDE)
    If FileExists ( $EXT & "\folder\file.txt" ) Then
     $Len = FileRead ( $EXT & "folder\file.txt" )
   StringRegExp ( $Len , "string to search", 2, " " )
    If @error = 0 Then
     MsgBox(4096,"", "Correct file found")
    EndIf
   EndIf
DirRemove ( $EXT )
EndIf
EndFunc ; ==> ADD
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...