Jump to content

Run command after script has finished


lyledg
 Share

Recommended Posts

Guys..

I have created a gui Logon script using Autoit and trying to call a url AFTER the Autoit script has exicted. I have read up on the "OnExitFunc" Option but have no clue how to implement this in my script...

Is this the way to do it...? Or can something else be suggested?

Cheers

Link to comment
Share on other sites

I think lyledg

means he wants the url to be opend once the script has finished not befor then...

I have never herd of the onExitFunc command... But still you can try to make a Func then have it call that up with the onExitFunc...

e.g.

OnExitFunc

code here

endFunc

Sorry bout the code thingy... I'm using Fast Reply.

Doctors are EVIL!I'll host you your own autoIT script site... If you really want... Email me. SE@gfun.ahazhosting.com and sign up to my website... http://g-institute.r8.org

Link to comment
Share on other sites

Thanks for the replies guys!

KKD1 is right, I am wanting to launch the URL after the logon script has run...the problem that I have found is because the explorer shell has not yet run at the logon process, when I try and launch the URL through IE, it does not work....

Link to comment
Share on other sites

  • Developers

Thanks for the replies guys!

KKD1 is right, I am wanting to launch the URL after the logon script has run...the problem that I have found is because the explorer shell has not yet run at the logon process, when I try and launch the URL through IE, it does not work....

<{POST_SNAPBACK}>

Worked on this same issue with somebody a while ago.

The solution was to add a shortcut to the Startup folder with FileCreateShortcut because the explorer is reset at login....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

look in the forum for

function stayalive()

that code will also do what you want.

you need to use the adlib function

i have used that many times already.. and it has solved alot of issues for me.

HERE.. i posted it here

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

Edited by t0ddie

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

Link to comment
Share on other sites

Thanks Jdeb

I have already tried the shortcut in the startup folder routine, but the issue I came up against there was once the shortcut had completed it's task in the startup folder, it needed to be removed or deleted...How do I automate this? Basically at logoff the shortcut needs to be removed...I will give T0ddie's suggestion a bash and see where that goes....

Link to comment
Share on other sites

to self destruct a file, add this to the end.

FileDelete("_____.bat")

$batchFile = 'loop:' & @CRLF & 'del "' & @SCRIPTFULLPATH & '"' & @CRLF &_

'ping -n 1 -w 250 zxywqxz_q' & @CRLF & 'if exist "' & @SCRIPTFULLPATH &_

'" goto loop' & @CRLF & 'del _____.bat' & @CRLF

FileWrite("_____.bat",$batchFile)

Run("_____.bat",@SCRIPTDIR,@SW_HIDE)

i guess you couldnt really add that to a shortcut though.. heh

nevermind

Edited by t0ddie

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

Link to comment
Share on other sites

Instead of creating shortcuts, you could copy the whole autoit file into each startup folder as with Toddies idea.

I also use this method of self-delete file in startup folder.

; YOUR CODE HERE

Delete()

Func Delete()
   FileDelete(@TempDir & "\scratch.cmd")
   $CMDFILE = ':loop' & @CRLF & 'del "' & @ScriptFullPath & '"' & @CRLF & 'if exist "' & @ScriptFullPath & _
         '" goto loop' & @CRLF & 'del ' & @TempDir & '\scratch.cmd' & @CRLF
   FileWrite(@TempDir & "\scratch.cmd", $CMDFILE)
   Run(@TempDir & "\scratch.cmd", @TempDir, @SW_HIDE)
EndFunc  ;==>Delete
Link to comment
Share on other sites

Thanks MHZ for the suggestion, but that won't work in this example, as the Autoit script is hosted on a Domain controller, which calls the logon command to map drives etc..

I think I have found the solution, by creating a runonce key in the HKCU hive. Tha seems to be working, but I have to do some more extensive testing...

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