cowsmanaut Posted June 20, 2004 Share Posted June 20, 2004 ; check for messages if fileexists("I:\Au3_test\test.ini") then $message = Iniread("I:\Au3_test\test.ini", "message", "key", "none") if $message = "*" then; if no messages exit first section of code exitloop else endif msgbox (0, "result", $message); if there is a message display it endif filedelete ("I:\Au3_test\test.ini") I've used exitloop and it's worked up to this point.. however, now I want to go back to the begining and start over. However since Exitloop is an end all function I can't go back. to check again for the INI file. the only way I can get it to go again is to make the last line Run("I:\message.exe") which causes then the mouse to be in constant thinking mode. as it waits to see if the file has come back I tried putting it into a (While 1, wend) but that too was exited.. So how do I start over without reloading the EXE or AUT? OR How can I exit that part of the loop without exiting all loops? moo Link to comment Share on other sites More sharing options...
midiaxe Posted June 21, 2004 Share Posted June 21, 2004 From the doc, ExitLoop is used to exit a loop command (While/Do/For). You can have two While..Wend commands and have 2 Exitloops. Something like: ; this is a pseudo code, you need to change the <cond> While 1 While 1 If <cond> Then Exitloop 1; this will exit the inner loop while If <cond> Then Exitloop 2; this will exit the outer loop while Wend Wend Link to comment Share on other sites More sharing options...
Guest Guest Posted June 21, 2004 Share Posted June 21, 2004 thanks.. I guess I just didn't quite get that from reading it.. Though that's what I though... just never considered the idea of exitloop 2...I'll try it out. I guess it works based on order of operations? I don't need to use something like While 1 wend.. while 2 wend.. for two different loops.. the number isn't a label right? it's a value.. moo Link to comment Share on other sites More sharing options...
tutor2000 Posted June 21, 2004 Share Posted June 21, 2004 ; check for messages if fileexists("I:\Au3_test\test.ini") then $message = Iniread("I:\Au3_test\test.ini", "message", "key", "none") if $message = "*" then; if no messages exit first section of code exitloop else endif msgbox (0, "result", $message); if there is a message display it endif filedelete ("I:\Au3_test\test.ini") I've used exitloop and it's worked up to this point.. however, now I want to go back to the begining and start over. However since Exitloop is an end all function I can't go back. to check again for the INI file. the only way I can get it to go again is to make the last line Run("I:\message.exe") which causes then the mouse to be in constant thinking mode. as it waits to see if the file has come back I tried putting it into a (While 1, wend) but that too was exited.. So how do I start over without reloading the EXE or AUT? OR How can I exit that part of the loop without exiting all loops? mooif this is something you may repeat possibly three times by the time you're done wouldn't it be better to make it a function? Rick Link to comment Share on other sites More sharing options...
cowsmanaut Posted June 21, 2004 Author Share Posted June 21, 2004 hi rick an example would be fabulous. I'll be staring at this thing all day otherwise This is what I have so far but I get an error on the run file even though in the INI file I have the [file] key set to = 0. While 1 if fileexists("c:\Au3_test\test.ini") then $message = Iniread("c:\Au3_test\test.ini", "message", "key", "0") $file = Iniread("c:\Au3_test\test.ini", "file", "key", "0") endif do msgbox (0, "result", $message); if there is a message display it $message = 0 do run( $file ); run program specified $file = 0 until $file = 0; unless no file was defined until $message = 0; unless no message was defined filedelete "C:\Au3_test\test.ini") wend INI example : [message] key = can you see this message? [file] key = 0 since it is set to 0 shouldn't it just exit the loop? rather than trying to run it once? to explain what it is I'm doing.. I'm sending commands to a remote computer by sending an INI file with the commands in it.. this way I have a file running always looking for and then reading (if it's there) the INI and carrying out the commands once and then delete the file and start looking all over again moo Link to comment Share on other sites More sharing options...
cowsmanaut Posted June 21, 2004 Author Share Posted June 21, 2004 ok I think I get Func, end func now.. I'll try that one.. (crosses fingers) Link to comment Share on other sites More sharing options...
Nutster Posted June 21, 2004 Share Posted June 21, 2004 If you are in the middle of a loop and want to restart it, not exit it, use ContinueLoop. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
tutor2000 Posted June 21, 2004 Share Posted June 21, 2004 hi rick an example would be fabulous. I'll be staring at this thing all day otherwise This is what I have so far but I get an error on the run file even though in the INI file I have the [file] key set to = 0. While 1 if fileexists("c:\Au3_test\test.ini") then $message = Iniread("c:\Au3_test\test.ini", "message", "key", "0") $file = Iniread("c:\Au3_test\test.ini", "file", "key", "0") endif do msgbox (0, "result", $message); if there is a message display it $message = 0 do run( $file ); run program specified $file = 0 until $file = 0; unless no file was defined until $message = 0; unless no message was defined filedelete "C:\Au3_test\test.ini") wend INI example : [message] key = can you see this message? [file] key = 0 since it is set to 0 shouldn't it just exit the loop? rather than trying to run it once? to explain what it is I'm doing.. I'm sending commands to a remote computer by sending an INI file with the commands in it.. this way I have a file running always looking for and then reading (if it's there) the INI and carrying out the commands once and then delete the file and start looking all over again mooDo will always run at least once because the exit code is set at the end if you are waiting for the file to exist and running a continuous loop all day for this you need a sleep time to to let your computer run other stuff and not use so much of it's resources unless you need it to run right away While 1 if fileexists("c:\Au3_test\test.ini") then runthis() sleep(60000) ; one minute wend func runthis() ; I don't write functions often so maybe one of you guys can check this for me $message = Iniread("c:\Au3_test\test.ini", "message", "key", "0") $file = Iniread("c:\Au3_test\test.ini", "file", "key", "0") if $file="0" then return endif runwait( $file ); run program specified filedelete "C:\Au3_test\test.ini") return endfunc ;Something ladat ;need coffee ;Rick Link to comment Share on other sites More sharing options...
cowsmanaut Posted June 21, 2004 Author Share Posted June 21, 2004 ran into the issue of using "0" for a value that can contain text as a text value comes back as "0".. played around with this more and came up with this: while 1 if fileexists("c:\Au3_test\test.ini") then $message = Iniread("c:\Au3_test\test.ini", "message", "key", "0") $file = Iniread("c:\Au3_test\test.ini", "file", "key", "0") filedelete("c:\Au3_test\test.ini") if $message > -1 then msgbox(0, "notice", $message) endif if $file > -1 then run($file) endif endif wend as long as I don't use negative values.. (not likley for messages or filenames) then it works fine. So now I have my "task manager" for lack of a better name it runs each and every task I add to the INI file.. wonderfull now to finish building my GUI for the interface. I'm making a teacher interface that allows us to do several things on our student machines. Things like shut down internet explorer or ICQ, Send notices, Lock the desktop, send and display text and images, run software (like what we are currently teaching in class), and I think that's all I have at the moment. It also will allow them (the teachers) to pick which machines they want these things to happen on. If anyone has any other ideas I could add to this please let me know. I'll pass on the script when I'm done it. (master and slave scripts) moo Link to comment Share on other sites More sharing options...
tutor2000 Posted June 21, 2004 Share Posted June 21, 2004 ran into the issue of using "0" for a value that can contain text as a text value comes back as "0".. played around with this more and came up with this: while 1 if fileexists("c:\Au3_test\test.ini") then $message = Iniread("c:\Au3_test\test.ini", "message", "key", "0") $file = Iniread("c:\Au3_test\test.ini", "file", "key", "0") filedelete("c:\Au3_test\test.ini") if $message > -1 then msgbox(0, "notice", $message) endif if $file > -1 then run($file) endif endif wend as long as I don't use negative values.. (not likley for messages or filenames) then it works fine. So now I have my "task manager" for lack of a better name it runs each and every task I add to the INI file.. wonderfull now to finish building my GUI for the interface. I'm making a teacher interface that allows us to do several things on our student machines. Things like shut down internet explorer or ICQ, Send notices, Lock the desktop, send and display text and images, run software (like what we are currently teaching in class), and I think that's all I have at the moment. It also will allow them (the teachers) to pick which machines they want these things to happen on. If anyone has any other ideas I could add to this please let me know. I'll pass on the script when I'm done it. (master and slave scripts) mooI like autoitx and hta's for menus You can run a program with the click of a button Rick Link to comment Share on other sites More sharing options...
cowsmanaut Posted June 21, 2004 Author Share Posted June 21, 2004 excuse my ignorance. However, I don't know what HTA's are. It seems the search in the autoit file doesn't turn anything up either. is this unique to the activeX autoit? thanks Link to comment Share on other sites More sharing options...
tutor2000 Posted June 21, 2004 Share Posted June 21, 2004 excuse my ignorance. However, I don't know what HTA's are. It seems the search in the autoit file doesn't turn anything up either. is this unique to the activeX autoit?thanks NoSince you searched I'll explain a bit. HTA stands for hypertext application. It's basically an html page you can use as an appI'll give an example below with autoitx and some hta code lines as well, but you can make any html page an hta page just by renaming the end hta. There are extra advantages to hta's however including security advantagesRick<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252"> <TITLE>Save WebEmail Menu by Kirkham Ver 3</TITLE> </HEAD><BODY LANG="en-US" DIR="LTR"><P STYLE="margin-bottom: 0in">1 <script LANGUAGE="VBScript"> <!--Set oAutoIt = CreateObject("AutoItX.Control")Set oAutoIt3 = CreateObject("AutoItX3.Control")localpath = oAutoIt.IniRead (".\rkcontrol.ini", "Paths", "localpath") 'localpath = "C:\Programs2WorkOn\RicksEmailSaver"'MsgBox "The localpath is " & localpath'oAutoIt3.IniWrite localpath&"\modules\rkcontrol.ini", "textpath", "ChangeSavePaths","No"oAutoIt3.IniWrite localpath&"\modules\rkcontrol.ini", "textpath", "Run","Blank"'savepath = oAutoIt.IniRead (localpath&"\modules\rkcontrol.ini", "textpath", "Command",TheForm.textpath.Value) var=oAutoIt3.WinSetOnTop ( "Save WebEmail Menu by Kirkham Ver 3", "", 1)Sub Submit_onclick Dim TheForm dim textpath Set TheForm = document.ValidForm'var=oAutoIt.Iniwrite(mainpath&"\modules\rkcontrol.ini", "Time", "SecondsTarget",TheForm.sec.Value)'MsgBox "The mainpath is " & localpath & TheForm.textpath.Valuefor each x in document.ValidForm("textpath")if x.checked thenoAutoIt3.IniWrite localpath&"\modules\rkcontrol.ini", "textpath", "Run",x.valueexit forend ifnext' oAutoIt.Iniwrite localpath&"\modules\rkcontrol.ini", "textpath", "Run",TheForm.textpath.Value savepath=oAutoIt3.IniRead (localpath&"\modules\rkcontrol.ini", "textpath", "Run","Blank") changepaths = oAutoIt3.IniRead (localpath&"\modules\rkcontrol.ini", "textpath", "ChangeSavePaths","" ) if not (savepath = "Blank" or savepath ="") then if not (changepaths="Yes") then 'MsgBox "The savepath is " & savepath oldtitle = oAutoIt.WinGetActiveTitle() var=oAutoIt.WinSetTitle(oldtitle, "", "Get Path by Kirkham "&savepath) oldtitle = oAutoIt.WinGetActiveTitle() oAutoIt.WinMinimize oldtitle, "" 'oAutoIt.sleep 2000 oAutoIt.ClipPut "" 'oAutoIt.Send "^a" 'oAutoIt.sleep 1000 'oAutoIt.Send "^c" oAutoit3.runwait localpath&"\modules\GetText.exe","" oAutoIt.WinRestore oldtitle, "" var=oAutoIt.WinSetTitle(oldtitle, "","Save WebEmail Menu by Kirkham Ver 3") 'winwait("Save WebEmail Menu by Kirkham Ver 3","") 'winactivate("Save WebEmail Menu by Kirkham Ver 3","") 'oAutoit3.send("{f5}") end if end if End Subsub DeletePaths_onclickoAutoit.ClipPut("")oAutoit.sleep 1000oAutoit.ClipPut(document.PathForm.SavePathsFile.Value)oAutoIt3.IniWrite localpath&"\modules\rkcontrol.ini", "textpath", "ChangeSavePaths","Yes"changepaths = oAutoIt3.Iniread (localpath&"\modules\rkcontrol.ini", "textpath", "ChangeSavePaths","No")'MsgBox "Changepaths is " & changepathsoAutoit3.runwait localpath&"\modules\DeletePaths.exe",""'oAutoit.sleep 3000'oAutoit.winclose "Save WebEmail Menu by Kirkham Ver 3",""'oAutoit.winwaitclose "Save WebEmail Menu by Kirkham Ver 3",""end subsub NewPath_onclick'oAutoit3.WinMinimizeAll ( )oldtitle = oAutoIt.WinGetActiveTitle() var=oAutoIt.WinSetTitle(oldtitle, "", "Get Path by Kirkham") oldtitle = oAutoIt.WinGetActiveTitle() oAutoIt.WinMinimize oldtitle, "" oAutoit3.runwait localpath&"\modules\MakeDir.exe","" oAutoIt.WinRestore oldtitle, "" var=oAutoIt.WinSetTitle(oldtitle, "","Save WebEmail Menu by Kirkham Ver 3") 'winwait("Save WebEmail Menu by Kirkham Ver 3","") 'winactivate("Save WebEmail Menu by Kirkham Ver 3","") 'oAutoit3.send("{f5}")'oAutoit3.WinMinimizeAllUndo ( )end sub --></SCRIPT>;Watch word wrap Link to comment Share on other sites More sharing options...
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