Jump to content

Noobie needs some help


tym
 Share

Recommended Posts

Ok so I have decided to learn the ins and outs of autoit. The reason I do so is for nlite. I have a program I want to install with windows. I need to run a autoit script. The problem is with installing. I somehow need to stop other programs from trying to install, to give my program time to install itsself. My program starts to install, then other programs continue while its trying to install. Hope that makes sense. :P

Still super new to this, and I will learn it. For now I have to use the automated script maker. I get to choices, Use WinExists in a Loop and Use WinWaits in a sequence. I have googled and looked. What are the diffrences in the 2 Choices??

2nd I guessd and used the "Use Winwaits in a sequence" The program install fine with the script, I just need to edit it like explained in the first paragraph. Here it is. What do I need to change? Also using this as a self learning tool. I thank you all and be ready for more questions as time goes by. :(

#Region - setup install script - (Automated with WinWait functions)

Opt('TrayIconDebug', 1)

Opt('WinDetectHiddenText', 1)

Opt('WinTitleMatchMode', 4)

; Installer.

$executable = 'setup.exe'

; Show progess.

$splash = 0

; Default catagory folder in startmenu.

$group = ''

; New catagory to move the default folder into.

$catagory = ''

; Installation folder in Program Files.

$directory = ''

; Run the installer.

$pid = _Install()

If WinWait('', '', 60) Then

ControlClick('', '', '')

WinWait('', '')

ControlClick('', '', '')

WinWait('', '')

ControlClick('', '', '')

WinWait('', '')

ControlClick('', '', '')

WinWait('', '')

ControlClick('', '', '')

Else

_Abort()

EndIf

ProcessWaitClose($pid)

; Remove shortcuts.

If _MainShortcut('?.lnk') Then

; Relative to shortcut directories

; Remove Startmenu shortcuts

FileDelete('?.lnk')

FileDelete('?.lnk')

FileDelete('?.lnk')

FileDelete('?.lnk')

FileDelete('?.lnk')

; Remove other shortcuts

_Desktop('?.lnk')

_QuickLaunch('?.lnk')

EndIf

#EndRegion - setup install script - (Automated with WinWait functions)

Exit

#cs - Exitcodes

1 = _Install(): Installer not found

2 = _Abort(): Installer process closed and then Abort

3 = _Abort(): Abort only

-1 = _ProcessBlock(): Blocked processes not unblocked

#ce

Func _Install($path = 'Default')

; Run the installer in Default Script directory.

Dim $splash, $processblock

If $path = 'Default' Then $path = @ScriptDir

If StringRight($path, 1) <> '\' Then $path = $path & '\'

If StringInStr($executable, '\') Then $path = ''

If Not FileExists($path & $executable) Then Exit 1

If $processblock <> '' Then Call('_' & 'ProcessBlock')

If $splash Then _Splash('Installing:' & StringTrimRight(StringReplace(@ScriptName, '_', ' '), 4))

If StringRight($executable, 3) = 'msi' Then

Return Run(@SystemDir & '\msiexec /i "' & $path & $executable & '"')

Else

Return Run($path & $executable)

EndIf

EndFunc ;==>_Install

Func _Abort()

; close process if exists then exit.

Dim $pid

If ProcessExists($pid) Then

ProcessClose($pid)

Exit 2

Else

Exit 3

EndIf

EndFunc ;==>_Abort

Func _Desktop($shortcut)

; Delete a Desktop shortcut.

If FileExists(@DesktopDir & '\' & $shortcut) Then

Return FileDelete(@DesktopDir & '\' & $shortcut)

ElseIf FileExists(@DesktopCommonDir & '\' & $shortcut) Then

Return FileDelete(@DesktopCommonDir & '\' & $shortcut)

EndIf

EndFunc ;==>_Desktop

Func _MainShortcut($shortcut, $rename = '')

; Change working directory to correct StartMenu\Group directory.

Dim $group, $catagory, $splash

If $group = '' Then Return 0

If FileExists(@ProgramsDir & '\' & $group) Then

FileChangeDir(@ProgramsDir & '\' & $group)

ElseIf FileExists(@ProgramsCommonDir & '\' & $group) Then

FileChangeDir(@ProgramsCommonDir & '\' & $group)

Else

Return 0

EndIf

; Wait for main shortcut.

If $splash Then _Splash('Waiting for shortcuts')

For $i = 1 To 20

If FileExists($shortcut) Then ExitLoop

Sleep(500)

Next

If $splash Then _Splash('Cleaning up:' & StringTrimRight(StringReplace(@ScriptName, '_', ' '), 4))

; If catagory not assigned anything, then return.

If $catagory = '' Then Return 1

; Move the group folder into the catagory folder.

If FileChangeDir('..') And DirCopy($group, $catagory & '\' & $group, 1) Then

If DirRemove($group, 1) Then

; If optional rename parameter is used, then rename the group folder.

If $rename <> '' And FileChangeDir($catagory) Then

If DirCopy($group, $rename, 1) And DirRemove($group, 1) Then

Return FileChangeDir($rename)

EndIf

Else

Return FileChangeDir($catagory & '\' & $group)

EndIf

EndIf

EndIf

EndFunc ;==>_MainShortcut

Func _QuickLaunch($shortcut)

; Delete a Quicklaunch shortcut.

Local $subdirs = 'Microsoft\Internet Explorer\Quick Launch'

If FileExists(@AppDataDir & '\' & $subdirs & '\' & $shortcut) Then

Return FileDelete(@AppDataDir & '\' & $subdirs & '\' & $shortcut)

ElseIf FileExists(@AppDataCommonDir & '\' & $subdirs & '\' & $shortcut) Then

Return FileDelete(@AppDataCommonDir & '\' & $subdirs & '\' & $shortcut)

EndIf

EndFunc ;==>_QuickLaunch

Func _Splash($text = '')

; Shows a small borderless splash message.

Dim $splash

If $splash Then

If $text Then

SplashTextOn('', $text, 500, 25, -1, 5, 1, '', 14)

Else

SplashOff()

EndIf

EndIf

EndFunc ;==>_Splash

Func _WinClose($title, $text = '')

; Close a window with further attempts.

For $i = 1 To 10

WinClose($title, $text)

If Not WinExists($title) Then Return 1

Sleep(500)

Next

EndFunc ;==>_WinClose

Func OnAutoItStart()

; A 2nd script instance will exit.

If StringInStr($CMDLINERAW, '/dummy') Then Exit

If WinExists(@ScriptName & '_Interpreter') Then Exit

AutoItWinSetTitle(@ScriptName & '_Interpreter')

EndFunc ;==>OnAutoItStart

Link to comment
Share on other sites

What is the program you are trying to automate?

Its a install of norton ghost 2003 with nlite. So the program can be slipstreamed into my xp install. If I need to reload windows, Most my software I use is already slipstreamed into my xp setup. Got the entire process, install a fresh copy of xp with all my programs, I am up and running and my computer is setup the way I want it to Under a hour and 30 min. My Xp is a no touch install, Pick the partition and Go eat a sandwhich and 30 min later its done with all my programs installed.

This is why I use nlite and learning autoit. Just another option to slipstream programs into xp that can be kinda hard.

Edited by tym
Link to comment
Share on other sites

I don't see a need to interact with any windows when Ghost 2003 can be installed silently.

http://www.appdeploy.com/packages/detail.asp?id=75

Those instructions are for 7.0 but they should work the same.

Yes I know how to install it silently. Problem is like I said before, When deploying with a nlite setup it needs to hestitate to install. Surely someone can help me edit this script?

Edited by tym
Link to comment
Share on other sites

How have you setup Nlite to kick off your script? Are you using a separate script for each program?

To me it sounds like you are putting multiple installation handlers into the RunOnce area of Nlite and they are all getting kicked off at once. If you would just put one script in there that handles all of your other scripts sequentially you should be okay.

Edited by weaponx
Link to comment
Share on other sites

How have you setup Nlite to kick off your script? Are you using a separate script for each program?

To me it sounds like you are putting multiple installation handlers into the RunOnce area of Nlite and they are all getting kicked off at once. If you would just put one script in there that handles all of your other scripts sequentially you should be okay.

I am trying to be nice. But man what is with all the questions. I am just asking someone to help with script and help me edit It. I don't need to play 20 questions about how I am using nlite and what I did or did not do.

IF you can help with edit, cool, If you cant then let it go man. I explaind why I needed the script, I explained why I needed to edit it. Your being no help what so ever dude. Just asking pointless questions about what I have already explained. I am here to learn autoit. I am hear to get help with a script. I am NOT here to play 20 questions that have nothing to do with the subject.

When I was learning nlite, I posted in a forum just for that reason. I am posting in this forum to get help with scripting and understanding it. I know the ins and outs of nlite. I Don't know the ins and outs of scripting. Thats why I am here. I Don't need help with installing nortons silently, If I did I would post in a forum for nortons ghost. So Lets stay on the subject, Either you can help, Or you can't help. Let me worry about nlite, My addons, My programs and installing them silently. Either you can help or you can't and lets stay on the subject. Its just that simple.

Link to comment
Share on other sites

That seemed out of place. He is trying to help but we need more information of what is going on to figure out why the issue occurs. I am a little confused myself. It sounds like what weaponx said, that you have multiple installers going off at once, and there are different ways that could happen. Are you having nlite run these installers all separately? If so, then why not script them all, and have nlite just call a single autoit script that does them each in turn?

Also according to the autoit help file:

WinExists = Checks to see if a specified window exists.

WinWait = Pauses execution of the script until the requested window exists.

One checks to see if a window is there at all then just moves on, the other pauses and waits for a window to appear, then continues after a timeout.

"Human kind cannot gain anything without first giving something in return, to obtain; something of equal value must be lost."The Help File is truly your friend.

Link to comment
Share on other sites

I am trying to be nice. But man what is with all the questions. I am just asking someone to help with script and help me edit It. I don't need to play 20 questions about how I am using nlite and what I did or did not do.

Let me worry about nlite, My addons, My programs and installing them silently. Either you can help or you can't and lets stay on the subject. Its just that simple.

When you go to the doctors office do you just strip down and get X-Rayed or does your doctor ask qualifying questions first?

In your first post you say this:

I somehow need to stop other programs from trying to install, to give my program time to install itsself.

So if I ask you questions about how your scripts are started you would do well to tell us. You can't just suppress every process so your script can run.

FYI - WinWait() is the same thing as Do...Until WinExists()

Edited by weaponx
Link to comment
Share on other sites

That seemed out of place. He is trying to help but we need more information of what is going on to figure out why the issue occurs. I am a little confused myself. It sounds like what weaponx said, that you have multiple installers going off at once, and there are different ways that could happen. Are you having nlite run these installers all separately? If so, then why not script them all, and have nlite just call a single autoit script that does them each in turn?

Also according to the autoit help file:

WinExists = Checks to see if a specified window exists.

WinWait = Pauses execution of the script until the requested window exists.

One checks to see if a window is there at all then just moves on, the other pauses and waits for a window to appear, then continues after a timeout.

Now thats a simple answer to one of my questions and I thank you. I guess I am missing something. I am simply hear for the script. Not my nlite, Not my programs. And Just to clear the air. Yes I know nlite. You asked "why not script them all"?? Um I can not even get one done yet how in the world could I do all of them? All of them install just fine. I am here to learn scripting, I am hear to learn how to edit the script. I need it to stall the program or make the program wait till it finishes the install. I really dont know how to explain it more clear.

It would be the same if you were to ask a simple queston about nlite and I would go on 20 questions about your software. It would be the same if you were to ask for a nlite switch and I go on a 20 questions about why not script it. That has nothing to do with the question.

Being a geek for over 10 years and helping others tons the kind of responce I have gotten so far drives me crazy. Its a simiple question about scripts, has nothing to do with nlite or my programs. Its way off the subject.

All I am asking is what line needs to be edited to make the program hesitate while the install finishes. This gets any more frustrating to find a simple answer to a simple question I will just use a bat file and find a script geek someplace else.

To me its the same as you asking me, "hey man how do I edit my boot file in xp" and I go off on how windows must have a problem for you need to do that. Whats that got to do with the question? You are all just getting away from the reason I am here. The script. Reminds me of my frustration with lynux geeks. Man most thoes guys have no clue how to help others and keep it simple.

To truly help others right. Just answer the question at hand. This is the line you want to edit, this is how you edit it, and this is why you want to edit it that way. Always rember the term "kiss" Keep it simple silly man.

Finally to prove my point. To install ghost 2003 silently. Create a folder on your desktop call it whatever want. Insert the ghost cd in your drive. Open my computer "the little icon that says my computer" Go to your cd or dvd drive. Right click on it. Go to explore, Now select all the folders and drag them to that folder you made on the desktop. Now remove the disk, If the disk trys to run when you insert it just hit exit. Now take out the cd. Find the" install folder" in the folder on your desktop you made. Drag it to your desktop and save it. The folder I had you made can now be deleted. Now the install folder is the biggie. Open it and find the setup.ini file. Looks like a notebook. If it will not open, right click and open with notepad. Now see the line that says. "CmdLine=" ? Now right after the =create one space with the space bar the put /qn. Thats your complete silent install. You will see nothing while it installs. If you want to see a progrss bar then replace qn with passive.

It should look like this, Or to make it even more simple remove the Cmdline= and copy and paste this CmdLine= /qn CmdLine= /passive if you wanna see the progess bar.

Now close and save it. Burn that entire "install file" to cd or save it someplace. Then when you want to install nortons ghost open that folder hit the "setup.exe" icon and your all done. That link that was given for the silent install was no help. Now I am done with this thread until someone can help with the script edit I need. Thanks.

Link to comment
Share on other sites

I was merely trying to see if there was a flaw in other parts of the process that could eliminate the need for extraneous scripting. I've been around awhile and helped a lot of people with similar problems. Don't get so offended, the more information we have the better.

Some examples:

http://www.autoitscript.com/forum/index.php?showtopic=66930

http://www.autoitscript.com/forum/index.php?showtopic=66263

http://www.autoitscript.com/forum/index.php?showtopic=66209

http://www.autoitscript.com/forum/index.php?showtopic=65689

http://www.autoitscript.com/forum/index.php?showtopic=64547

http://www.autoitscript.com/forum/index.php?showtopic=63234

http://www.autoitscript.com/forum/index.php?showtopic=58912

Link to comment
Share on other sites

I was merely trying to see if there was a flaw in other parts of the process that could eliminate the need for extraneous scripting. I've been around awhile and helped a lot of people with similar problems. Don't get so offended, the more information we have the better.

Some examples:

http://www.autoitscript.com/forum/index.php?showtopic=66930

http://www.autoitscript.com/forum/index.php?showtopic=66263

http://www.autoitscript.com/forum/index.php?showtopic=66209

http://www.autoitscript.com/forum/index.php?showtopic=65689

http://www.autoitscript.com/forum/index.php?showtopic=64547

http://www.autoitscript.com/forum/index.php?showtopic=63234

http://www.autoitscript.com/forum/index.php?showtopic=58912

There is no doubt weaponx has helped many, many people here and has a great understanding of what needs to be done.

Look... You have a free program, a free forum and free professional/experienced help....

So, answering a just few questions can't be that hard.

8)

NEWHeader1.png

Link to comment
Share on other sites

There is no doubt weaponx has helped many, many people here and has a great understanding of what needs to be done.

Look... You have a free program, a free forum and free professional/experienced help....

So, answering a just few questions can't be that hard.

8)

I am outa here. Can not seem to get the information I want so I am off to find it someplace else. You guys were 100 percent no help. Thanks for nothing.

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...