Sign in to follow this  
Followers 0
Guest BL@(K-R34P3R

Startup Script

22 posts in this topic

StartupFunc()
Func StartupFunc()
   Run('"C:\Program Files\AutoIt3\AutoIt.chm"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt Help")
   WinSetState("AutoIt Help", "", @SW_MAXIMIZE)
   Run('"C:\Program Files\AutoIt3\AU3_Spy.exe"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt v3 Active Window Info")
   WinSetState("AutoIt v3 Active Window Info", "", @SW_MAXIMIZE)
   Run('"C:\Program Files\AutoIt3\SciTe\SciTE.exe"', "C:\Program Files\AutoIt3\SciTe")
   Sleep(500)
   Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"', "C:\Program Files\Internet Explorer")
   Sleep(2000)
   WinSetTitle ( "Dell - Client & Enterprise Solutions, Software, Peripherals, Services - Microsoft Internet Explorer", "", "Internet Explorer" )
   WinSetState("Internet Explorer", "", @SW_MAXIMIZE)
   MouseClick("left", 300, 100, 1)
   Send("http://www.autoitscript.com/forum/index.php?act=idx{ENTER}")
EndFunc

Just a startup script. Gives me a stupid error...

>"C:\Program Files\AutoIt3\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Randall Degges\My Documents\Scripts\Startup.au3"   

C:\Documents and Settings\Randall Degges\My Documents\Scripts\Startup.au3 (32) : ==> Unable to execute the external program.:

Run('"C:\Program Files\AutoIt3\AutoIt.chm"', "C:\Program Files\AutoIt3")

>Exit code: 0    Time: 0.219

Why isn't it working???

Share this post


Link to post
Share on other sites



One more thing to add:

Is it possible to assign that function to a variable? Or can you not assign functions to variables?

Share this post


Link to post
Share on other sites

CHM files are not executables, they do not work with the run command. You need to associate them with something.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

you can run .exe with run, but to open another program such as .txt files.. you need to run notepad.

i dont know what you need to run .chm.. but see what program opens that.. and then run that.

EDIT: ahahaaa matt you beat me by like 2 seconds

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

a variable stores information.

you cannot assign a function to it.


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

So the helpfile is obsolete? That sucks =/. Also, I wanted to make an inputbox, if 1, then run script, if 0, then do not run script.

Share this post


Link to post
Share on other sites

i have no idea what you are trying to do...

but the help file opens.. it is more advanced format than a simple .txt file

so, just doubleclick it

or right click run. why are you trying to open the help file from a script?


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

A startup script, so when you start the computer it automatically runs all the scripting tools, helpfile, scite, winspy, etc... and also opens up the autoit forums. How would I open the help file through Start->Run?

Share this post


Link to post
Share on other sites

I wanted to do:

IF the user inputs 1, then run the script

IF the user inputs 0, then do not run the script

Share this post


Link to post
Share on other sites

Fixed! I now know the problem, needed to add a few sleeps. Here is new script:

StartupFunc()
Func StartupFunc()
   Send("{LWIN}{ENTER}")
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Program Files\AutoIt3\AutoIt.chm{ENTER}")
  ;Run('"C:\Program Files\AutoIt3\AutoIt.chm"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt Help")
   WinSetState("AutoIt Help", "", @SW_MAXIMIZE)
   WinSetState("AutoIt Help", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\AutoIt3\AU3_Spy.exe"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt v3 Active Window Info")
   WinSetState("AutoIt v3 Active Window Info", "", @SW_MINIMIZE)
   Sleep(500)
   Send("{LWIN}{ENTER}")
   Sleep(500)
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Documents and Settings\Randall Degges\My Documents\Scripts{ENTER}")
   WinWaitActive("Scripts")
   WinSetState("Scripts", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"', "C:\Program Files\Internet Explorer")
   Sleep(2000)
   WinSetTitle ( "Dell - Client & Enterprise Solutions, Software, Peripherals, Services - Microsoft Internet Explorer", "", "Internet Explorer" )
   WinSetState("Internet Explorer", "", @SW_MAXIMIZE)
   Sleep(500)
   MouseClick("left", 300, 100, 1)
   Send("http://www.autoitscript.com/forum/index.php?act=idx{ENTER}")
EndFunc

Question:

How can I make this script into a yes or no script. So that the user can enter either yes, to start it, or no, to no start it...

Share this post


Link to post
Share on other sites

Read documentation on MsgBox... HINT: Flags.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

MsgBox(4, "AutoIt Startup Script -  Black Reaper", "Press either yes to run the script, or no to cancel it... The default is no.")
If 6 then
   Return
EndIf
If 7 then
   
StartupFunc()
Func StartupFunc()
   Send("{LWIN}{ENTER}")
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Program Files\AutoIt3\AutoIt.chm{ENTER}")
  ;Run('"C:\Program Files\AutoIt3\AutoIt.chm"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt Help")
   WinSetState("AutoIt Help", "", @SW_MAXIMIZE)
   WinSetState("AutoIt Help", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\AutoIt3\AU3_Spy.exe"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt v3 Active Window Info")
   WinSetState("AutoIt v3 Active Window Info", "", @SW_MINIMIZE)
   Sleep(500)
   Send("{LWIN}{ENTER}")
   Sleep(500)
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Documents and Settings\Randall Degges\My Documents\Scripts{ENTER}")
   WinWaitActive("Scripts")
   WinSetState("Scripts", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"', "C:\Program Files\Internet Explorer")
   Sleep(2000)
   WinSetTitle ( "Dell - Client & Enterprise Solutions, Software, Peripherals, Services - Microsoft Internet Explorer", "", "Internet Explorer" )
   WinSetState("Internet Explorer", "", @SW_MAXIMIZE)
   Sleep(500)
   MouseClick("left", 300, 100, 1)
   Send("http://www.autoitscript.com/forum/index.php?act=idx{ENTER}")
EndFunc

I added that part to the top. Problem is, I know that Return continues the script... But, if they pick 7, "No", then how do I stop it from performing the rest of the script?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

If MsgBox(4, "AutoIt Startup Script - Black Reaper", "Press either yes to run the script, or no to cancel it... The default is no.")=7 then exit

Edited by magaf

Share this post


Link to post
Share on other sites

MsgBox(4, "AutoIt Startup Script -  Black Reaper", "Press either yes to run the script, or no to cancel it... The default is no.")
If 6 then
   Return
EndIf
If 7 then
   
StartupFunc()
Func StartupFunc()
   Send("{LWIN}{ENTER}")
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Program Files\AutoIt3\AutoIt.chm{ENTER}")
  ;Run('"C:\Program Files\AutoIt3\AutoIt.chm"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt Help")
   WinSetState("AutoIt Help", "", @SW_MAXIMIZE)
   WinSetState("AutoIt Help", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\AutoIt3\AU3_Spy.exe"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt v3 Active Window Info")
   WinSetState("AutoIt v3 Active Window Info", "", @SW_MINIMIZE)
   Sleep(500)
   Send("{LWIN}{ENTER}")
   Sleep(500)
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Documents and Settings\Randall Degges\My Documents\Scripts{ENTER}")
   WinWaitActive("Scripts")
   WinSetState("Scripts", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"', "C:\Program Files\Internet Explorer")
   Sleep(2000)
   WinSetTitle ( "Dell - Client & Enterprise Solutions, Software, Peripherals, Services - Microsoft Internet Explorer", "", "Internet Explorer" )
   WinSetState("Internet Explorer", "", @SW_MAXIMIZE)
   Sleep(500)
   MouseClick("left", 300, 100, 1)
   Send("http://www.autoitscript.com/forum/index.php?act=idx{ENTER}")
EndFunc

I added that part to the top. Problem is, I know that Return continues the script... But, if they pick 7, "No", then how do I stop it from performing the rest of the script?

<{POST_SNAPBACK}>

Return doesn't continue the script. just do a return 0.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

if MsgBox(4, "Title", "Startup Script") = 7 then
     Exit
EndIf

This will only run the code if Yes is pressed.

Share this post


Link to post
Share on other sites

I have this:

;Starts up AutoIt scripting tools on startup with a yes or no option.
$start = InputBox("AutoIt Startup Script - B1@(K-R34P3R", "Enter 1 to start, or 0 to abort. Default is 0.", 0)
If $start = 1 Then
  ;What Do i put here to make it continue running script...
EndIf
If $start = 0 Then
   Exit
StartupFunc()
Func StartupFunc()
   Send("{LWIN}{ENTER}")
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Program Files\AutoIt3\AutoIt.chm{ENTER}")
  ;Run('"C:\Program Files\AutoIt3\AutoIt.chm"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt Help")
   WinSetState("AutoIt Help", "", @SW_MAXIMIZE)
   WinSetState("AutoIt Help", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\AutoIt3\AU3_Spy.exe"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt v3 Active Window Info")
   WinSetState("AutoIt v3 Active Window Info", "", @SW_MINIMIZE)
   Sleep(500)
   Send("{LWIN}{ENTER}")
   Sleep(500)
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Documents and Settings\Randall Degges\My Documents\Scripts{ENTER}")
   WinWaitActive("Scripts")
   WinSetState("Scripts", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"', "C:\Program Files\Internet Explorer")
   Sleep(2000)
   WinSetTitle ( "Dell - Client & Enterprise Solutions, Software, Peripherals, Services - Microsoft Internet Explorer", "", "Internet Explorer" )
   WinSetState("Internet Explorer", "", @SW_MAXIMIZE)
   Sleep(500)
   MouseClick("left", 300, 100, 1)
   Send("http://www.autoitscript.com/forum/index.php?act=idx{ENTER}")
EndFunc

What do I insert after If $start = 1 to make it run the script?

Share this post


Link to post
Share on other sites

;Starts up AutoIt scripting tools on startup with a yes or no option.
$start = InputBox("AutoIt Startup Script - B1@(K-R34P3R", "Enter 1 to start, or 0 to abort. Default is 0.", 0)
If $start = 0 Then
   Exit
EndIf
If $start = 1 Then
   StartupFunc()
Func StartupFunc()
   Send("{LWIN}{ENTER}")
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Program Files\AutoIt3\AutoIt.chm{ENTER}")
   WinWaitActive("AutoIt Help")
   WinSetState("AutoIt Help", "", @SW_MAXIMIZE)
   WinSetState("AutoIt Help", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\AutoIt3\AU3_Spy.exe"', "C:\Program Files\AutoIt3")
   WinWaitActive("AutoIt v3 Active Window Info")
   WinSetState("AutoIt v3 Active Window Info", "", @SW_MINIMIZE)
   Sleep(500)
   Send("{LWIN}{ENTER}")
   Sleep(500)
   MouseClick("left", 237, 875, 1)
   Sleep(500)
   Send("C:\Documents and Settings\Randall Degges\My Documents\Scripts{ENTER}")
   WinWaitActive("Scripts")
   WinSetState("Scripts", "", @SW_MINIMIZE)
   Sleep(500)
   Run('"C:\Program Files\Internet Explorer\IEXPLORE.EXE"', "C:\Program Files\Internet Explorer")
   Sleep(2000)
   WinSetTitle ( "Dell - Client & Enterprise Solutions, Software, Peripherals, Services - Microsoft Internet Explorer", "", "Internet Explorer" )
   WinSetState("Internet Explorer", "", @SW_MAXIMIZE)
   Sleep(500)
   MouseClick("left", 300, 100, 1)
   Send("http://www.autoitscript.com/forum/index.php?act=idx{ENTER}")
EndFunc
EndIf

Edited: BUT, now it's giving me an error. Ideas?

>"C:\Program Files\AutoIt3\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\Randall Degges\My Documents\Scripts\Startup.au3"   

C:\Documents and Settings\Randall Degges\My Documents\Scripts\Startup.au3 (36) : ==> "If" statement has no matching "EndIf" statement.:

Func StartupFunc()

>Exit code: 1    Time: 0.214

Share this post


Link to post
Share on other sites

Thanks JdeB, I never even thought of it like that.

Share this post


Link to post
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
Sign in to follow this  
Followers 0