NiceBoy1234 Posted December 28, 2015 Posted December 28, 2015 I got these function but somehow only the first one gets called. expandcollapse popuptest01() test02() test03() test04() test05() Func test01() While 1 ConsoleWrite("01") WEnd EndFunc Func test02() While 1 ConsoleWrite("02") WEnd EndFunc Func test03() While 1 ConsoleWrite("03") WEnd EndFunc Func test04() While 1 ConsoleWrite("04") WEnd EndFuncIs there a way to accomplish this this way?
Moderators Melba23 Posted December 28, 2015 Moderators Posted December 28, 2015 NiceBoy1234,Of course only the first is called - how do you expect to escape the While...WEnd loop within it?M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
TheSaint Posted December 28, 2015 Posted December 28, 2015 Also, what are you trying to accomplish, what is your end game? Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
NiceBoy1234 Posted December 28, 2015 Author Posted December 28, 2015 I have several functions with different while loops.I would like to call them seperate or together, the code above was just a sample
Moderators Melba23 Posted December 28, 2015 Moderators Posted December 28, 2015 NiceBoy1234,If you want the chained functions to repeat indefinitely then you could do something like this:While test01() test02() test03() test04() WEnd Func test01() ConsoleWrite("01") EndFunc Func test02() ConsoleWrite("02") EndFunc Func test03() ConsoleWrite("03") EndFunc Func test04() ConsoleWrite("04") EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
NiceBoy1234 Posted December 28, 2015 Author Posted December 28, 2015 (edited) Hmm that sample worked, I think I have probably something wrong in my code could you have a look please=) expandcollapse popup#include <AutoItConstants.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <FileConstants.au3> Local $sPath = "C:\Program Files (x86)\xxx\xxx.exe"; Local $bFpExists = False; Local $aDrives = DriveGetDrive($DT_REMOVABLE) ; usbs Local $sUsername = "xxx" Local $sPassword = "xxx" Local $sLockdown = "C:\Users\xxx\Desktop\xxx.exe" While 1 disableTaskbar() hiddenShortcut() searchForDrives() startApplicationConstantly() WEnd Func startApplicationConstantly() Local $bxxfExe = RunWait("C:\Users\xxx\xxx\xxx\xxx.exe") If WinExists("[CLASS:#32770]") Then ProcessWaitClose("C:\Users\xxx\xxx\xxx\xxx.exe") EndIf EndFunc Func searchForDrives() If @error Then ConsoleWrite("error.") Else For $i = 1 To $aDrives[0] ConsoleWrite(StringUpper($aDrives[$i]) & "Drive " & $i & "/" & $aDrives[0] & @CRLF) ConsoleWrite($aDrives[$i]) If($aDrives[$i] == "f:") Then DirCopy("F:\xxx\xxx", "C:\Users\xxx\Desktop\CC", $FC_OVERWRITE) Sleep(10000) Else ConsoleWrite("couldnt find f drive") EndIf Next EndIf EndFunc Func hiddenShortcut() If _IsPressed("43") And _IsPressed("59") And _IsPressed("58") Then While _IsPressed("43") And _IsPressed("59") And _IsPressed("58") Sleep(250) WEnd Local $sAnswer = InputBox("Password", "Password to unlock", "put pw", "", 0, 0, 0, 0) If($sAnswer == $sPassword) Then ShellExecute($sLockdown) ableTaskbar() Else ConsoleWrite("wrong pw" & @CRLF) EndIf If ProcessExists("Lockdown.exe") Then ConsoleWrite("xxx.exe exist" & @CRLF) Else ConsoleWrite("xxx.exe does not exist" & @CRLF) EndIf EndIf Sleep(250) EndFunc Func disableTaskbar() Opt('WINTITLEMATCHMODE', 4) ControlHide('classname=Shell_TrayWnd', '', '') EndFunc Func ableTaskbar() Opt('WINTITLEMATCHMODE', 4) ControlShow('classname=Shell_TrayWnd', '', '') EndFuncI used for privacy issues the letter X a few times Edited December 28, 2015 by NiceBoy1234
BrewManNH Posted December 28, 2015 Posted December 28, 2015 Your WinExists might get stuck because there might be a dozen windows using that class open, then the code will wait until you close the program and not do anything else as long as it is still running. NiceBoy1234 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
NiceBoy1234 Posted December 28, 2015 Author Posted December 28, 2015 Ty for the reply I delete that line a check it give me a minute
NiceBoy1234 Posted December 28, 2015 Author Posted December 28, 2015 Thanks that was one issue now following functions do work:disableTaskbar()searchForDrives()startApplicationConstantlyjust the function hiddenShortcut remains and does not work
TheSaint Posted December 28, 2015 Posted December 28, 2015 (edited) That is a really weird key combination to have held down all at once - c + x + yOpen Notepad, and attempt to do that combo, and you will find that only one key repeats, so the combo will never may not work.If you are going to repeat _IsPressed you should be using the DllOpen method as per the Example anyway.https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htmHowever, your key combo will never may not work and so your code in that function will may never happen. Edited December 28, 2015 by Santa I may have learnt something Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
mikell Posted December 28, 2015 Posted December 28, 2015 (edited) Hmmm sorry Santa However I agree with DllOpen#include <Misc.au3> Local $hDLL = DllOpen("user32.dll") $n = 0 While 1 If _IsPressed("43", $hDLL) And _IsPressed("59", $hDLL) And _IsPressed("58", $hDLL) Then While _IsPressed("43", $hDLL) And _IsPressed("59", $hDLL) And _IsPressed("58", $hDLL) Sleep(10) WEnd $n += 1 Tooltip("test " & $n, 0, 0) ConsoleWrite("test " & $n & @CRLF) EndIf Wend DllClose($hDLL) Edited December 28, 2015 by mikell
TheSaint Posted December 28, 2015 Posted December 28, 2015 (edited) Well if that works, then I have learnt something new. Other than the Notepad method, I had no AutoIt facility to try the combo, so I went for what seemed obvious ... no doubt a mistake. Still seems like an awful combo to me anyway ... I'd throw in a CTRL and or SHIFT and just use one letter ... if that. Edited December 29, 2015 by Santa Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
mikell Posted December 28, 2015 Posted December 28, 2015 Hey, it was only matter of a code which works or not, even if the combo is awful indeed TheSaint 1
guinness Posted December 28, 2015 Posted December 28, 2015 Just to make it clear, you can't do this with native AutoIt functions, because that's what "chaining" functions means.Function Example1() Return "First" EndFunc Function Example2() Return "Second" EndFunc Example1().Example2() UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
NiceBoy1234 Posted December 29, 2015 Author Posted December 29, 2015 (edited) Dll seemed to solved the problem, it works now thanks.I got one more little question, since I deleted the WinExists Method, what would be a better way to close the windows error window like "program does not work wait or close".I tried to check with WinExists if that windows appears to close it immediately. Edited December 29, 2015 by NiceBoy1234
mikell Posted December 29, 2015 Posted December 29, 2015 WinExist can be used but the check must be more precise (window title or text)Func test() Local $w = WinList("[CLASS:#32770]") For $i = 1 to $w[0][0] If StringInStr(WinGetText($w[$i][1]), "some text") Then WinClose($w[$i][1]) Next EndFunc Xandy 1
NiceBoy1234 Posted December 29, 2015 Author Posted December 29, 2015 hiddenShortcut() function does not work anymore strange:(
NiceBoy1234 Posted December 29, 2015 Author Posted December 29, 2015 (edited) does this have to have excatly this name ?user32.dllThus the window which I create with the shortcut does have same classname as the error window Edited December 29, 2015 by NiceBoy1234
NiceBoy1234 Posted December 29, 2015 Author Posted December 29, 2015 My While Loop looks like this now: ... Local $hDLL = DllOpen("user32.dll") While 1 ableTaskbar() hiddenShortcut() searchForDrives() startApplicationConstantly() WEnd DllClose($hDLL) ...
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