PDA

View Full Version : Can I get help in plain English? (seriously)



steve02a
06-22-2004, 04:22 PM
I read through all the msg forums here about scripts and all. My situuation is I'm wanting a dialog box to appear (during install) that will prompt the user to input an IP address and maybe a domain name.

That information will be written to an xml file - then the install will take place and the xml file is installed w/other files (this takes away the pain process of the user having to edit the xml file by hand).

Some people have provided me solutions in my previous postings, but it's still wacko-talk to me as I know nothing about scripts (although I am learning to read them from all these posts and playing with ISX all the time these days).

So, I'm curious if there are any tutorial or help me websites that explain scrips, dialog boxes, my situtation - in normal, easy to understand, plain English for the super newbie?

Thanks in advance.

vinodn1
07-01-2004, 10:59 AM
HI Steve,

If you have not found a solution yet, then here is one.

I have included a sample code and project file which would give you a good idea.

Since you mentioned you were a newbie, i hope you are familiar with the flow of the InstallScript functions

OnFirstUIBefore()
OnMoveData()
OnFirstUIAfter() and so on......

I use the AskText function to get the user to input the IP Address in the OnFirstUIBefore function, store it in a global variable. Once the XML file is moved to the target machine during OnMoveData, i then write the IP Address to the file in the OnFirstUIAfter function. I have tested it and it works. You can change the installation path according to your preference. You will also have the installation under the media folder.(Note: project was built using IS Pro 7, but it should be applicable to IS X too)




function OnFirstUIBefore()
....
....
// You can change the TARGETDIR information
TARGETDIR = "C:\\XML\\NewXMLDir";
....
....
//custom code to ask user for IP address
Dlg_AskText:
SetDialogTitle (DLG_ASK_TEXT, "IP address information");
nResult = AskText ("Please enter your IP address here", "", svIP);
if (nResult = BACK) goto Dlg_SdWelcome;




function OnFirstUIAfter()
......
......

//Write your IP address stored in global variable "svIP" into the XML file
//Note: the XML file(sample.xml) will now be on the target machine under TARGETDIR,
// as MoveData has been called.
set oXML = CreateObject("MSXML.DOMDocument");
oXML.Load(TARGETDIR ^ "sample.xml");

if (oXML.parseError.errorCode != 0) then
myErr = oXML.parseError;
MessageBox(myErr, INFORMATION);
else
roots = oXML.documentElement;
newNode = oXML.createElement("IPAddress");
//newNode = oXML.createTextNode("IPAddress");
roots.appendChild(newNode);
roots.lastChild.text = svIP;
endif;

oXML.save(TARGETDIR ^ "sample.xml");


Let me know if you have further questions.

-Vinod

vinodn1
07-01-2004, 11:01 AM
This is the project and media zip file.

jasonVis
07-21-2004, 11:03 AM
Is there a way to set the readonly property after changing the xml file?

vinodn1
07-21-2004, 12:48 PM
Use the "SetFileInfo" method to set the property for the file.

-Vinod

jasonVis
07-21-2004, 01:05 PM
thanks for the quick reply...works great

vinodn1
07-21-2004, 01:11 PM
I am really glad i could help !!

jasonVis
08-17-2004, 02:20 PM
how about setting file security permissions...I want to set the security permissions to modify for a file...any thoughts on this?

vinodn1
08-17-2004, 02:50 PM
To set permissions use the "cacls.exe".

LaunchAppAndWait(WINSYSDIR ^ "cmd.exe", szCmdLine, LAAW_OPTION_WAIT|LAAW_OPTION_HIDDEN);

For "szCmdLine" parameter refer to this website

http://www.networkclue.com/os/Windows/commands/cacls.php

-Vinod