Aplication launched via GPO on a domain.

Blitz3D Forums/Blitz3D Programming/Aplication launched via GPO on a domain.

Lord_Troll(Posted 2008) [#1]
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


Lord_Troll(Posted 2008) [#2]
Sorry for the lack of tabs in the above function (they are in blitz, but did not show up).
Also, how do you put your code snipits into the post in Blue with the proper formatting?

Thanks!!!!!


Zethrax(Posted 2008) [#3]
Use [ code]Your code[ /code] or [ codebox]Your code[ /codebox] (for a scrollable codebox) but remove the space after the opening bracket.

The forum codes:-
http://www.blitzbasic.com/faq/faq_entry.php?id=2

The faqs:-
http://www.blitzbasic.com/faq/faq.php


Snarkbait(Posted 2008) [#4]
You know you can easily access INI file info with a userlib? There's code in the archives.

Shouldn't you test if the file exists before you open it?

Can't help with your problem, however, sorry.


Lord_Troll(Posted 2008) [#5]
Thank you Bill, I appriciate the info.

Snarkbait, thank you for the suggestion about the userlib, I will have to look into them. As to the OpenFile command, it returns an integer of zero if the file does not exist. Thus if the file does not exist you get the RuntimeError at the bottom of the function.

I think that I may have solved my problem by using the Commandline$() command. Adding it into my program and the correct parameter into the GPO on the domain seams to work. Wish I had more domains to test it on.


Yo! Wazzup?(Posted 2008) [#6]
And Lord_Troll, you can edit your post if you want to.

Next to the timestamp on the right.