Sign in to follow this  
Followers 0
doxx12

script after restart run

16 posts in this topic

#1 ·  Posted (edited)

I'm looking for a script that launches my program after resetting the computer.But when the user resets the computer.

example: 1.run my aplication.

2.there is nothing

3.I'm resetting the computer

4.When you turn on your computer

5.show hello message

6.that every time you turn on the computer says hello message

sorry for bad english :x

Edited by doxx12

Share this post


Link to post
Share on other sites



Can you not just stick the script in the "start-up" folder? and if this doesn't work, you can always write a registry key for it.

Here is the 2 common ones:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]

Thanks,

Ilmaestro.


Hello, World!... LAME lol

Share this post


Link to post
Share on other sites

First Welcolme to the Forum !

and you can create a tray item for choose if your soft will restart with windows like this ! Posted Image

#include <Constants.au3>
Global $_StartItem, $_RegTitleKey = 'YourSoftName'
Opt ( "TrayOnEventMode", 1 ) 
;Opt ( "TrayMenuMode", 1 )

;GUICreate ( "My GUI" ) 
;GUISetState ( )
$_StartItem = TrayCreateItem ( "Start With Windows" ) 
$_RegRead = RegRead ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $_RegTitleKey )
If $_RegRead <> '' Then TrayItemSetState ( $_StartItem, $TRAY_CHECKED )
TrayItemSetOnEvent ( $_StartItem, "_StartWithWindows" )

MsgBox ( 0, 'message', 'hello !' )

While 1 
    Sleep ( 30 )
WEnd    

Func _StartWithWindows ( )
    If @Compiled Then 
        $_ItemGetState = TrayItemGetState ( $_StartItem ) 
        If $_ItemGetState = 64+1 Then
            RegWrite ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $_RegTitleKey, "REG_SZ", @ScriptFullPath )
        Else
            RegDelete ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", $_RegTitleKey )
        EndIf
    EndIf
EndFunc ;==> _StartWithWindows ( )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

MsgBox should run only after the restart. Not when the run immediately exe. MY english is bad sorry

Share this post


Link to post
Share on other sites

MsgBox should run only after the restart. Not when the run immediately exe.

1. Have it check if a file exist.

2. If it doesn't exist, don't MsgBox yet, create the file now.

3. If it does, MsgBox.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I did not intentionally :S

Share this post


Link to post
Share on other sites

I saved the old akaunt in mozzila, and was I went to google chrome so I opened dooxx12 sry.Sorry for my english is bed

Share this post


Link to post
Share on other sites

ok,whether you can delete these posts that do not spoil the topic?

Share this post


Link to post
Share on other sites

I'm looking for a script that launches my program after resetting the computer.But when the user resets the computer.

example: 1.run my aplication.

2.there is nothing

3.I'm resetting the computer

4.When you turn on your computer

5.show hello message

6.that every time you turn on the computer says hello message

sorry for bad english :P

If you are running Windows Vista you may consider a Scheduler Task found in Control Panel/Admin/Scheduler Task. Scheduler Tasks allow you to run a script based on an event. The only issue then would be to display a Hello message which you can script Ant.. :x

Share this post


Link to post
Share on other sites

ok,whether you can delete these posts that do not spoil the topic?

you spoiled your own topic ... not me..

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

ok,help me

May be, this way...

_Date_Time_GetTickCount ( ) Function Returns a Number of milliseconds that have elapsed since Windows was started

#include <Date.au3>

If @Compiled Then RegWrite ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", 'hello', "REG_SZ", @ScriptFullPath )
$_SecondSinceWindowsStarted = Round ( _Date_Time_GetTickCount ( )/1000 )
; ConsoleWrite ( " : " & $_SecondSinceWindowsStarted & @Crlf ) 
If $_SecondSinceWindowsStarted < 70 Then MsgBox ( 0, 'message', $_SecondSinceWindowsStarted & ' sec' & @Crlf & 'hello !' )
Exit

70 is 1m10sec, change it like you want...

Compil it, run it one time for the regwrite part and restart...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

May be, this way...

_Date_Time_GetTickCount ( ) Function Returns a Number of milliseconds that have elapsed since Windows was started

#include <Date.au3>

If @Compiled Then RegWrite ( "HKCU\Software\Microsoft\Windows\CurrentVersion\Run", 'hello', "REG_SZ", @ScriptFullPath )
$_SecondSinceWindowsStarted = Round ( _Date_Time_GetTickCount ( )/1000 )
; ConsoleWrite ( " : " & $_SecondSinceWindowsStarted & @Crlf ) 
If $_SecondSinceWindowsStarted < 70 Then MsgBox ( 0, 'message', $_SecondSinceWindowsStarted & ' sec' & @Crlf & 'hello !' )
Exit

70 is 1m10sec, change it like you want...

Compil it, run it one time for the regwrite part and restart...

Thanks bro.works

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