My program is launched by a GPO on our domain. The only problem is that I want the ini file (which is located on a server share with the program) to be read and input information into the program.
When the program is launched by a user it functions correctly, but when the GPO launches my application, it can not find the ini file. Any clues?
I do not want to encode our server path into the acctual program becuase then it can not be moved to a different server or company or customer (unless I recompile it for them each time).
Here is the function that reads ini file.
;This function sets the server_path$ string, and configures the three text lines in the graphics display.
;All based on the appPusher.ini file.
Function Read_ini ()
file = OpenFile("appPusher.ini") ;Open the ini file
If FileType ("appPusher.ini") = 1 ;test to see if the ini file is a file (it could be a folder by mistake, or not exist).
While Not Eof(file)
ini$ = ReadLine(file)
If Instr (ini$, "Server_Path=") <> 0 ;This checks to see if the read line is the server path line.
server_path$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
server_path$ = server_path$ + a$
Next
Else If Instr (ini$, "Message Text Line1") <> 0
graphicsTextLine1$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
graphicsTextLine1$ = graphicsTextLine1$ + a$
Next
Else If Instr (ini$, "Message Text Line2") <> 0
graphicsTextLine2$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
graphicsTextLine2$ = graphicsTextLine2$ + a$
Next
Else If Instr (ini$, "Message Text Line3") <> 0
graphicsTextLine3$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
graphicsTextLine3$ = graphicsTextLine3$ + a$
Next
Else
RuntimeError "The program ini file does not have the correct data in it. (Run the config program.)"
End If
Wend
Else
RuntimeError "The ini file is missing or corrupt. Please run the config program to fix it."
End If
End Function
When the program is launched by a user it functions correctly, but when the GPO launches my application, it can not find the ini file. Any clues?
I do not want to encode our server path into the acctual program becuase then it can not be moved to a different server or company or customer (unless I recompile it for them each time).
Here is the function that reads ini file.
;This function sets the server_path$ string, and configures the three text lines in the graphics display.
;All based on the appPusher.ini file.
Function Read_ini ()
file = OpenFile("appPusher.ini") ;Open the ini file
If FileType ("appPusher.ini") = 1 ;test to see if the ini file is a file (it could be a folder by mistake, or not exist).
While Not Eof(file)
ini$ = ReadLine(file)
If Instr (ini$, "Server_Path=") <> 0 ;This checks to see if the read line is the server path line.
server_path$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
server_path$ = server_path$ + a$
Next
Else If Instr (ini$, "Message Text Line1") <> 0
graphicsTextLine1$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
graphicsTextLine1$ = graphicsTextLine1$ + a$
Next
Else If Instr (ini$, "Message Text Line2") <> 0
graphicsTextLine2$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
graphicsTextLine2$ = graphicsTextLine2$ + a$
Next
Else If Instr (ini$, "Message Text Line3") <> 0
graphicsTextLine3$ = ""
For i = 13 To Len (ini$)
a$ = Mid (ini$, i, 1)
graphicsTextLine3$ = graphicsTextLine3$ + a$
Next
Else
RuntimeError "The program ini file does not have the correct data in it. (Run the config program.)"
End If
Wend
Else
RuntimeError "The ini file is missing or corrupt. Please run the config program to fix it."
End If
End Function