Sign in to follow this  
Followers 0
forever

functions in a row

9 posts in this topic

func StartCheck()

CheckExplorer()

CheckTaskMgr()

CheckShell()

EndFunc

I found out that, when i run the function StartCheck it only starts CheckExplorer() but how can i do that it continues running (also starting the other 2 functions) ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

you cant do 2 operations at the same time.

you can do one, then the next .. then the next... but not all at the same time without multiple scripts.

you can try adlib.... look at adlibenable in the help file. adlib will skip between them, (do a little here, next.. do a little there, next...

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

I found out that, when i run the function StartCheck it only starts CheckExplorer() but how can i do that it continues running (also starting the other 2 functions) ?

Maybe that's because your function CheckExplorer() never returns or exists the program with the command exit.

The following program works just fine...

StartCheck()

func StartCheck()
 msgbox(0,"", "I'm in StartCheck()")
 CheckExplorer()
 CheckTaskMgr()
 CheckShell()
 msgbox(0,"", "I'm done")
EndFunc

func CheckExplorer()
  msgbox(0,"", "I'm in CheckExplorer()")
endfunc

func CheckTaskMgr()
  msgbox(0,"", "I'm in CheckTaskMgr()")
endfunc

func CheckShell()
  msgbox(0,"", "I'm in CheckShell()")
endfunc

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Maybe that's because your function CheckExplorer() never returns or exists the program with the command exit.

The following program works just fine...

StartCheck()

func StartCheck()
 msgbox(0,"", "I'm in StartCheck()")
 CheckExplorer()
 CheckTaskMgr()
 CheckShell()
 msgbox(0,"", "I'm done")
EndFunc

func CheckExplorer()
  msgbox(0,"", "I'm in CheckExplorer()")
endfunc

func CheckTaskMgr()
  msgbox(0,"", "I'm in CheckTaskMgr()")
endfunc

func CheckShell()
  msgbox(0,"", "I'm in CheckShell()")
endfunc

Cheers

Kurt

<{POST_SNAPBACK}>

yes the functions are permanent (they don't exit/return/stop ..when the ended they restart)..

they are like "while's" they check for windows, if done they check again (winwait) ..it s not ending.

func CheckExplorer() 
if ($access = "0") Then
WinWait("classname=CabinetWClass")
MsgBox (16, "STOP", "You've no access to the action performed.", 4)
Winclose("classname=CabinetWClass")
CheckExplorer()
EndIf
EndFunc

func CheckTaskMgr() 
if ($access = "0") Then
WinWait("classname=#32770")
MsgBox (16, "STOP", "You've no access to the action performed.", 4)
Winclose("classname=#32770")
CheckTaskMgr()
EndIf
EndFunc

func CheckShell() 
if ($access = "0") Then
WinWait("classname=ConsoleWindowClass")
MsgBox (16, "STOP", "You've no access to the action performed.", 4)
Winclose("classname=ConsoleWindowClass")
CheckShell()
EndIf
EndFunc
Edited by forever

Share this post


Link to post
Share on other sites

yes the functions are permanent (they don't exit/return/stop ..when the ended they restart).. they are like "while's" they check for windows, if done they check again (winwait) ..it s not ending.

Well, if your functions never return, why should the other functions ever get called? That's not how funtions calling works.

According to your code, you are trying to implement a tool that prevents opening some special applications. Well, a way to do this would be a loop to check the existence of a window with winexists.

While 1 
  if WinExists("classname=CabinetWClass") then
     MsgBox (16, "STOP", "You've no access to the action performed.", 4)
     Winclose("classname=CabinetWClass")
  endif

  if WinExists(...)
  endif 
 
  ....
wend

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I also thought about that, but i think that would increase the cpu usage/slow down the system, or?

and with a wait(sleep) in the while it would slowdown the script/make it ineffective .. :)

any other ideas?

(there could be something needed like winwait(title1,title2,title3...) (meaning that it matches one of the 3 possible options) ..but there is none ..)

(i also know this is not the meaning of functions .. but as you can see i tried to find some workaround for my problem)

Edited by forever

Share this post


Link to post
Share on other sites

I also thought about that, but i think that would increase the cpu usage/slow down the system, or?

True, you'll have to use sleep() to overcome this problem.

and with a wait(sleep) in the while it would slowdown the script/make it ineffective .. :)

Well, no. Use one sleep(250) at the beginning of the while loop. That's fast enough.

any other ideas?

no.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

thanks, i'll try

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

;SETTINGS
Opt("WinTitleMatchMode", 4)
Opt("TrayIconHide", 1)  
$password = "yourpw"
$access = "0"
HotKeySet ("^!d","Deactivate")
HotKeySet ("^!a","Activate")
activate()


;Functions

;Check Functions
func StartCheck()

While 1 
  if WinExists("classname=CabinetWClass") AND $access = 0 then
     MsgBox (16, "STOP", "You've no access to the action performed.", 3)
     Winclose("classname=CabinetWClass")

  elseif WinExists("classname=ConsoleWindowClass") AND $access = 0 Then
     MsgBox (16, "STOP", "You've no access to the action performed.", 3)
     Winclose("classname=ConsoleWindowClass")

  elseif WinExists("Windows Task-Manager") AND $access = 0 Then
     MsgBox (16, "STOP", "You've no access to the action performed.", 3)
    Winclose("Windows Task-Manager")

  endif 

sleep(300)
wend
EndFunc


;Option Functions
func activate()
MsgBox (64, "Window Security", "Window Security activated.", 3)
$access = "0"
StartCheck()
EndFunc


func Deactivate()
$enteredpw = InputBox ("Window Security", "Please enter password to Deactivate the Window Security:", "", "*", "-1", "-1", "-1", "-1", 10)
if ($enteredpw = $password) Then
 $access = "1" 
 MsgBox (64, "Window Security", "Window Security deactivated.", 3)
 
 Do
  sleep(10000)
 Until $access = 0

Else
 Activate()
EndIf

EndFunc

//edit: it's working now, thanks... if anyone needs it blocks explorer, cmd and windows-taskmanager windows (strg+alt+A activate, strg+alt+D deactivate) .. i think it explains it self.

thanks to all who helped.

Edited by forever

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0