acana007 Posted February 9, 2010 Share Posted February 9, 2010 my issue with this code is: 1. if the user doesn't input the correct password it does it filewrite then it does nothing, ends the func 2. but if the user inputs the correct password it runs a program in the @conspec any help would appreciated expandcollapse popup#NoTrayIcon HotKeySet("+#!p", "pwd") dim $pass dim $var $var = IniRead("C:\Documents and Settings\Administrator\Desktop\test\myfile.ini", "section1", "key", "") While True sleep(1000) if WinExists("Run", "&Open:") Then WinClose("Run", "&Open:") EndIf if WinExists("Network Connections", "Network Connections") Then WinClose("Network Connections", "Network Connections") EndIf if WinExists("Computer Management", "Computer Management (Local)\System Tools\Device Manager") Then WinClose("Computer Management", "Computer Management (Local)\System Tools\Device Manager") EndIf if WinExists("Device Manager", "Device Manager on local computer") Then WinClose("Device Manager", "Device Manager on local computer") EndIf WEnd Func Pwd() $pass = InputBox("", "Please input password and click OK") If @error = 1 Then FileWriteLine("C:\WINDOWS\system32\log.ini", "incorrect" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) Else ; They clicked OK, but did they type the right thing? If $pass <> "123456789" Then FileWriteLine("C:\WINDOWS\system32\log.ini", "incorrect" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) EndFunc EndIf EndIf FileWriteLine("C:\WINDOWS\system32\log.ini", "correct" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) Run(@ComSpec & " /k ping" & $var) EndFunc Link to comment Share on other sites More sharing options...
martin Posted February 9, 2010 Share Posted February 9, 2010 my issue with this code is: 1. if the user doesn't input the correct password it does it filewrite then it does nothing, ends the func 2. but if the user inputs the correct password it runs a program in the @conspec any help would appreciated expandcollapse popup#NoTrayIcon HotKeySet("+#!p", "pwd") dim $pass dim $var $var = IniRead("C:\Documents and Settings\Administrator\Desktop\test\myfile.ini", "section1", "key", "") While True sleep(1000) if WinExists("Run", "&Open:") Then WinClose("Run", "&Open:") EndIf if WinExists("Network Connections", "Network Connections") Then WinClose("Network Connections", "Network Connections") EndIf if WinExists("Computer Management", "Computer Management (Local)\System Tools\Device Manager") Then WinClose("Computer Management", "Computer Management (Local)\System Tools\Device Manager") EndIf if WinExists("Device Manager", "Device Manager on local computer") Then WinClose("Device Manager", "Device Manager on local computer") EndIf WEnd Func Pwd() $pass = InputBox("", "Please input password and click OK") If @error = 1 Then FileWriteLine("C:\WINDOWS\system32\log.ini", "incorrect" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) Else ; They clicked OK, but did they type the right thing? If $pass <> "123456789" Then FileWriteLine("C:\WINDOWS\system32\log.ini", "incorrect" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) EndFunc EndIf EndIf FileWriteLine("C:\WINDOWS\system32\log.ini", "correct" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) Run(@ComSpec & " /k ping" & $var) EndFunc EndFunc is only used to mark the end of your function. If you want to stop executing the function at a certain point then one way is to use Return which would be the way in you case. If $pass <> "123456789" Then FileWriteLine("C:\WINDOWS\system32\log.ini", "incorrect" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) Return; not EndFunc EndIf Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
acana007 Posted February 9, 2010 Author Share Posted February 9, 2010 EndFunc is only used to mark the end of your function. If you want to stop executing the function at a certain point then one way is to use Return which would be the way in you case. If $pass <> "123456789" Then FileWriteLine("C:\WINDOWS\system32\log.ini", "incorrect" & " " & @HOUR & ":" & @MIN & " " & @WDAY & " " & @MON & "/" & @MDAY & "/" & @YEAR) Return; not EndFunc EndIf thank you that did it fixed thank you 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