SorryButImaNewbie Posted April 9, 2015 Share Posted April 9, 2015 (edited) I wanted to make a script of mine, to "remember" the path, selected by a user and start the application without the user need to show it the path everytime, but the function causes the script to exit and give an error. I was able to achive this by makin an ini file in the directory. my function goes like this: expandcollapse popupFunc UD_uszi_belepes() If WinExists("UDUsziMainForm") Then ;Check if the program is already running MsgBox(0, "Üzenet", "Az UD_üszi már fut!") $UD_uszi_belepesRun = False Return EndIf If FileExists(@ScriptDir &"\PathToUszi.ini") = 1 Then ;Check if ini exists $iniRead = IniRead(@ScriptDir &"\PathToUszi.ini", "Folder", "Location", "") Run($iniRead & "\UD_uszi.exe") Sleep(2000) ControlSetText("TLoginForm", "UD ÜSZI", "TEdit2", "BALAZSGE") Send("{TAB}BALAZSGE") Sleep(50) Send("{ENTER}") $UD_uszi_belepesRun = False Return EndIf Local $StartFileSelectFolder = FileSelectFolder("Adja meg az UD_uszi.exe helyét!", "") If @error = 1 Then MsgBox(0, "Üzenet", "Nem választott ki mappát") $UD_uszi_belepesRun = False Return EndIf Run($StartFileSelectFolder & "\UD_uszi.exe") Local $UD_usziBelepes = WinWaitActive("UD ÜSZI", "", 15) If $UD_usziBelepes = 0 Then MsgBox(0, "Üzenet", "A kérés feldolgozási ideje magas!" & @CRLF & "Kérem próbálja újra, vagy nyissa meg manuálisan.") $UD_uszi_belepesRun = False Return Else Local $WhereisFolder = IniWrite (@ScriptDir &"\PathToUszi.ini", "Folder", "Location", $sFileSelectFolder) ControlSetText("TLoginForm", "UD ÜSZI", "TEdit2", "BALAZSGE") Send("{TAB}BALAZSGE") Sleep(50) Send("{ENTER}") EndIf $UD_uszi_belepesRun = False EndFunc ;==>UD_uszi_belepes I have some problems with my debugging and I can't figure out why my script do what it does Edited April 9, 2015 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
MikahS Posted April 9, 2015 Share Posted April 9, 2015 Can you post the error that you receive from the console? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
caramen Posted April 9, 2015 Share Posted April 9, 2015 (edited) lol Re I am gonna help you too let me see... Let us know the console error msg Also for ppls like me it whould be apreciate to get english translation for your text. Edited April 9, 2015 by caramen SorryButImaNewbie 1 My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 Posting error massage: >"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "D:régi gép mentésDesktopAutomata TesztelésUD - uszi új BÉTAud_uszi 3.0.1 teszter.au3" >Exit code: 0 Time: 3.913 Sorry Link to comment Share on other sites More sharing options...
SadBunny Posted April 9, 2015 Share Posted April 9, 2015 I don't see an error. That first line is just the command used to run your script, and that exit code 0 means the script completed without problems. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
caramen Posted April 9, 2015 Share Posted April 9, 2015 To let us know the console error message open your AU3 script file and run it from hitting F5 key that will debug the line causing the problem. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
SadBunny Posted April 9, 2015 Share Posted April 9, 2015 If you think the problem may be related to the ini reading, try writing a reproducer, like: test() Func test() If FileExists(@ScriptDir &"\PathToUszi.ini") = 1 Then ;Check if ini exists $iniRead = IniRead(@ScriptDir &"\PathToUszi.ini", "Folder", "Location", "") MsgBox(0,0,"Read: " & $iniRead) EndIf EndFunc ;==>UD_uszi_belepes ... and work from there. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 I run my script with f5, when I click on the button initilizing this functin it exit Link to comment Share on other sites More sharing options...
MikahS Posted April 9, 2015 Share Posted April 9, 2015 Well, if it has something to do with how you are calling a function from the button event in a messageloop or onevent mode. Then, that could be pertinent information. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
caramen Posted April 9, 2015 Share Posted April 9, 2015 (edited) Can you send the full code plz ? I tryed your code and the ini is not maked Also i need translation Edited April 9, 2015 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 I usually call my functions with a "Runflag" ($UD_uszi_belepesRun in this case). When the button is clicked it change that variable to true, and in my while 1 loop after 100 millisec sleep it checks all the function flags, if it find one as true it execute it. Then the run flag is changed back to false when the function finishes. This works well in every other instances in the script (for some reason I can't make my script to run in debug mode, which is quite a problem, I already have a thread aboutthat... , if you wonder why I cant give more accurate information about the error) Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 Can you send the full code plz ? I tryed your code and the ini is not maked Also i need translation I translate anything you want I can't give you the full code (the whole script isn't that big only 40+k long but my boss doesn't like if I post the whole code of a company software to the net. I try to geather everything that can be related to this function and post it! Link to comment Share on other sites More sharing options...
MikahS Posted April 9, 2015 Share Posted April 9, 2015 (edited) I can't give you the full code (the whole script isn't that big only 40+k long but my boss doesn't like if I post the whole code of a company software to the net. I try to geather everything that can be related to this function and post it! How about posting the messageloop code (or however you use a button to call it) that deals with this function? Edited April 9, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 expandcollapse popupOpt("TrayIconDebug", 1) Opt("GUIOnEventMode", 1) ;trying to use debug mode, latters are colored black, not red, debug isn't show in the console, dont know why #AutoIt3Wrapper_Run_Debug_Mode = Y ;(Y/N) Run Script with console debugging. Default=N #AutoIt3Wrapper_Run_Debug = On ;(On/Off) Switch debugging on/off ;RunAutoitDebug #include <MsgBoxConstants.au3> #include <GuiStatusBar.au3> #include <GuiEdit.au3> #include <ScreenCapture.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <File.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #include <ud_uszi 3.0.1 GUI.isf> #include <GuiConstants.au3> #include <Debug.au3> GUISetState(@SW_SHOW, $GUIform) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $GUIform) ;Global variabels and arrays Global $fTestRun = False Global $fExitRun = False Global $UD_uszi_belepesRun = False Global $UD_uszi_kilepesRun = False Global $KP_VJ_vasarlasRun = False Global $KP_VJ_vasarlas_sztorno_mentRun = False Global $EURO_VJ_vasarlasRun = False Global $EURO_VJ_vasarlas_sztorno_mentRun = False Global $EuroShell_VJ_vasarlasRun = False Global $EuroShell_VJ_vasarlas_sztorno_mentRun = False Global $TopUp_KP_HUFRun = False Global $TopUp_KP_HUF_sztornoRun = False Global $TopUp_KP_EURORun = False Global $TopUp_KP_EURO_sztornoRun = False Global $TopUp_EuroShellRun = False Global $TopUp_EuroShell_sztornoRun = False Global $Uj_PostPaidRun = False Global $AllinUD_usziRun = False Idle() ;Functions ;Run functions (like $TopUp_EuroShell_sztornoRun = True) Func Idle() While 1 Sleep(200) If $fTestRun Then ;Test() EndIf If $fExitRun Then _Exit() EndIf If $UD_uszi_belepesRun Then UD_uszi_belepes() EndIf If $UD_uszi_kilepesRun Then UD_uszi_kilepes() EndIf If $KP_VJ_vasarlasRun Then KP_VJ_vasarlas() EndIf If $KP_VJ_vasarlas_sztorno_mentRun Then KP_VJ_vasarlas_sztorno_ment() EndIf If $EURO_VJ_vasarlasRun Then ;EURO_VJ_vasarlas() EndIf If $EURO_VJ_vasarlas_sztorno_mentRun Then ;EURO_VJ_vasarlas_sztorno_ment() EndIf If $EuroShell_VJ_vasarlasRun Then EuroShell_VJ_vasarlas() EndIf If $EuroShell_VJ_vasarlas_sztorno_mentRun Then EuroShell_VJ_vasarlas_sztorno_ment() EndIf If $TopUp_KP_HUFRun Then TopUp_KP_HUF() EndIf If $TopUp_KP_HUF_sztornoRun Then TopUp_KP_HUF_sztorno() EndIf If $TopUp_KP_EURORun Then TopUp_KP_EURO() EndIf If $TopUp_KP_EURO_sztornoRun Then TopUp_KP_EURO_sztorno() EndIf If $TopUp_EuroShellRun Then TopUp_EuroShell() EndIf If $TopUp_EuroShell_sztornoRun Then TopUp_EuroShell_sztorno() EndIf If $Uj_PostPaidRun Then ;Uj_PostPaid() EndIf If $AllinUD_usziRun Then AllinUD_uszi() EndIf WEnd EndFunc ;==>Idle ;Functions that has no runflags, used in other functions I think these are all the thing that can somehow be connected to this, also this should shed some light on the structure of my script Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 How about posting the messageloop code (or however you use a button to call it) that deals with this function? Thought the same Thank you guys/girls for the help! Link to comment Share on other sites More sharing options...
SadBunny Posted April 9, 2015 Share Posted April 9, 2015 I tryed your code and the ini is not maked Also i need translation The irony Mobius 1 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted April 9, 2015 Author Share Posted April 9, 2015 The irony.... The Path in my ini file was 0, I suspect I made some error creating it during testing, and an error value got saved somewhere, since the ini file existed it tried to open it throught that but didn't go well... Don't know why would it exit from there, but I deleted the ini and everything seems to work fine! Have to look around and try to reproduce that ini file with a zero and make sure that it can't happen again. Thank you for the help guys!!! Really Link to comment Share on other sites More sharing options...
MikahS Posted April 9, 2015 Share Posted April 9, 2015 (edited) Come to think of it, I might have had a similar problem with ini functionality awhile back. Oh well, old age is catching up. Edited April 9, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ 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