bird42 Posted March 2, 2010 Share Posted March 2, 2010 I wrote a really simple tool (noobie XD)and AntiVir marks it as a trojan. Can u tell me why ? (maybe it's the shutdown function) Any other suggestions welcome. expandcollapse popup;time saver v 2.0 by zentral Dim $delay =200 , $set=0 TrayTip("Time saver","Ready !"&@CRLF&"Please choose a time option." , 10, 1) Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) $1item = TrayCreateItem("15 min") TrayItemSetOnEvent(-1,"_15") $1item = TrayCreateItem("30 min") TrayItemSetOnEvent(-1,"_30") $2item = TrayCreateItem("60 min") TrayItemSetOnEvent(-1,"_60") $setitem = TrayCreateItem("Custom") TrayItemSetOnEvent(-1,"_custom") TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayItemSetOnEvent(-1,"_about") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"ExitScript") TraySetState(4) while 1 if $set= 1 then Sleep($delay) _stop() EndIf WEnd Func _15() $delay = 900000 TrayTip("Time saver", "15 minutes."&@CRLF&"Started at"&@HOUR&":"&@MIN&":"&@SEC, 10, 1) TraySetState(8) $set=1 EndFunc Func _30() $delay = 1800000 TrayTip("Time saver", "30 minutes."&@CRLF&"Started at"&@HOUR&":"&@MIN&":"&@SEC, 10, 1) TraySetState(8) $set=1 EndFunc Func _60() $delay = 3600000 TrayTip("Time saver", "60 minutes."&@CRLF&"Started at"&@HOUR&":"&@MIN&":"&@SEC, 10, 1) TraySetState(8) $set=1 EndFunc Func _custom() Do $time= InputBox("Time saver","How much time ? (minutes)") Until $time>0 $delay = $time*60000 TrayTip("Time saver",$time&" minutes"&@CRLF&"Started at"&@HOUR&":"&@MIN&":"&@SEC, 10, 1) TraySetState(8) $set=1 EndFunc func _stop() Beep(500,500) $m=msgbox(276,"Time saver _ WARNING!","Time expired ... system shutdown"&@CRLF&"Are you doing something important?",300000) if $m=7 or $m=-1 then msgbox(64,"Time saver","5 seconds to shutdown...",5) shutdown(0) Exit else msgbox(64,"Time saver","You got 15 more min.") sleep(900000) Beep(500,500) msgbox(16,"Time saver _ WARNING!","Time expired ... system shutdown",5) shutdown(0) Exit EndIf EndFunc Func _about() TrayTip("Time saver", "by "&@CRLF&"Please visit AutoIt website.", 10, 1) EndFunc Func exitscript() Exit EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2010 Moderators Share Posted March 2, 2010 zentral,Please read the Sticky topic "Are my Autoit EXES really infected?" about 2 cms above yours! 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 Link to comment Share on other sites More sharing options...
bird42 Posted March 2, 2010 Author Share Posted March 2, 2010 (edited) zentral,Please read the Sticky topic "Are my Autoit EXES really infected?" about 2 cms above yours! M23Damn i wrote an useless post .i'm really sry... Btw any suggestions about the script? Edited March 2, 2010 by zentral Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 2, 2010 Moderators Share Posted March 2, 2010 zentral,Damn useless postIf you mean yours, I quite agree! As to your script, I would change it to allow for a "Cancel" button in the MsgBox and then only shut down if the user presses OK or the timeout occurs. Otherwise you are a bit stuck if you change your mind at the last second!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 Link to comment Share on other sites More sharing options...
dani Posted March 2, 2010 Share Posted March 2, 2010 (edited) I would change the contents of your While 1 loop. With OnEventMode (or TrayOnEventMode), I only use a loop to keep the script running, but don't execute commands in it. Also, all the different functions are not required and imo not very pretty. I would do it like: $1 = TrayCreateItem("15 min") TrayItemSetOnEvent(-1,"_setDelay") $2 = TrayCreateItem("30 min") TrayItemSetOnEvent(-1,"_setDelay") $3 = TrayCreateItem("60 min") TrayItemSetOnEvent(-1,"_setDelay") While True ; Forever Sleep(100) ; Wait for events WEnd Func _setDelay() Switch @GUI_CTRLID Case $1 ; 15 min $tip = 15 $delay = 900000 Case $2 ; 30 min $tip = 30 $delay = 1800000 Case $3 ; 60 min $tip = 60 $delay = 3600000 EndSwitch TrayTip("Time saver", $tip & " minutes."&@CRLF&"Started at"&@HOUR&":"&@MIN&":"&@SEC, 10, 1) TraySetState(8) Sleep($delay) _stop() EndFunc Edited March 2, 2010 by dani Link to comment Share on other sites More sharing options...
Bert Posted March 2, 2010 Share Posted March 2, 2010 Damn useless post.i'm really sry... Btw any suggestions about the script?Not useless. It answers your question. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
dani Posted March 2, 2010 Share Posted March 2, 2010 Not useless. It answers your question.Clearly he means his own post, not M23's Link to comment Share on other sites More sharing options...
bird42 Posted March 2, 2010 Author Share Posted March 2, 2010 (edited) Yes, i mean my own post Thanks you all. p.s.: dani thx for your script. Obviously i have a lot to learn. Edited March 2, 2010 by zentral Link to comment Share on other sites More sharing options...
Developers Jos Posted March 2, 2010 Developers Share Posted March 2, 2010 Topic closed. Start a new topic with valid title when you still have autoit3 questions SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts