PcExpert Posted April 14, 2006 Posted April 14, 2006 Hello, How to do sonething once? For example: You want that the program you made displays a messagebox at the first time, but after the first time it doesn't appear anymore.
Infinitex0 Posted April 14, 2006 Posted April 14, 2006 Perhaps something with a .ini The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]
NightGaunt Posted April 14, 2006 Posted April 14, 2006 Or set a HKCU regkey if you don't like ini files... "I have discovered that all human evil comes from this, man's being unable to sit still in a room. " - Blaise Pascal
PcExpert Posted April 14, 2006 Author Posted April 14, 2006 (edited) Can someone make a example of that with notepad, that there's popping up a msgbox once? at first startup Edited April 14, 2006 by PcExpert
herewasplato Posted April 14, 2006 Posted April 14, 2006 (edited) Run("notepad") WinWait("Untitled - Notepad") For $i = 1 To 3 If $i = 1 Then MsgBox(0, "", "First time thru the loop") Else ControlSend("Untitled - Notepad", _ "", "Edit1", _ "This is loop number " _ & $i & @CR) EndIf NextorRun("notepad") WinWait("Untitled - Notepad") For $i = 1 To 3 If $i = 1 Then MsgBox(0, "", "First time thru the loop") ControlSend("Untitled - Notepad", _ "", "Edit1", _ "This is loop number " _ & $i & @CR) Next Edited April 14, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Jango Posted April 14, 2006 Posted April 14, 2006 Can someone make a example of that with notepad, that there's popping up a msgbox once? at first startup Hi, Here is a very simple thing we do in our login.bat batch file: CD %userprofile% If Exist Client.txt Goto EndClient \\x_server\Update\Client\xyz.exe /s echo Client installed >>Client.txt attrib Client.txt +R +H :EndClient The CD place the working dir in the user profile and create a file .txt in it then hide it. next time it starts the file exists and nothing is don anymore... you can easily do it with AutoIt in the @TempDir for example...
PcExpert Posted April 14, 2006 Author Posted April 14, 2006 But if I run the last script again it still displays the msgbox
herewasplato Posted April 14, 2006 Posted April 14, 2006 But if I run the last script again it still displays the msgboxWell now I know for sure what you want... maybe NightGaunt will be willing to post an example of "Or set a HKCU regkey if you don't like ini files..." [size="1"][font="Arial"].[u].[/u][/font][/size]
Simucal Posted April 14, 2006 Posted April 14, 2006 The registry functions here seem useful:http://www.autoitscript.com/forum/index.ph...545&hl=registry AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
NightGaunt Posted April 14, 2006 Posted April 14, 2006 Well now I know for sure what you want... maybe NightGaunt will be willing to post an example of "Or set a HKCU regkey if you don't like ini files..."Dim $Registry = "HKCU\AutoItRo\" Dim $RegKey = "Start" Dim $RegCheck ;Dim $RegValue (Not Used, I was going to use this to increment) $RegCheck = RegRead ($Registry, $Regkey) if @error = 1 Then regwrite ($Registry, $Regkey, "Reg_SZ", "0");(Basically if it doesn't exist create and set to 0) $RegCheck = RegRead ($Registry, $Regkey) if $RegCheck = 0 then msgbox (0x10, "Fight Club", "You do not talk about fight club.") regwrite ($Registry, $Regkey, "REG_SZ", "1") EndIf if $RegCheck = 1 Then msgbox (0x10, "Fight Club", "Tyler Durden Says: Use Soap") regwrite ($Registry, $Regkey, "REG_SZ", "2") EndIf If I was really doing this I may set a numerical key for the "2" and "1" and then increment it. But this "quick and dirty" method should clear it up. "I have discovered that all human evil comes from this, man's being unable to sit still in a room. " - Blaise Pascal
MHz Posted April 14, 2006 Posted April 14, 2006 Or, as mentioned by Infinitex0, an ini file. $file_ini = @AppDataDir & '\MyProgram\Settings.ini' If Not FileExists($file_ini) Or Not Int(IniRead($file_ini, 'section', 'intro', 0)) Then MsgBox(0, '', 'This program has not been used yet') DirCreate(@AppDataDir & '\MyProgram') IniWrite($file_ini, 'section', 'intro', 1) EndIf
JerryD Posted April 15, 2006 Posted April 15, 2006 ThanksThere's also the registry keys:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnceandHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceYou can create a key with a string value of the command you want to run.If you put it in HKCU, it will run the next time that user logs in, and then the key self deletes.If you use HKLM, it will run for the next person that logs in and then self delete.Typically you use HKLM unless you're setting up an image which will be SysPrep'd in which case you'd want to put an entry in the key:HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\RunOnceand then the first time a new user logs in, whatever is in that key will run once for that user.See:Using RunOnce TechnologyJ
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now