rdwray Posted December 19, 2010 Share Posted December 19, 2010 I looked and either I missed it or it isn't there - why do scripts go into pause and how do I prevent it? Thanks... “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
yucatan Posted December 19, 2010 Share Posted December 19, 2010 sleep() ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 19, 2010 Moderators Share Posted December 19, 2010 rdwray,Not a very helpful description. If you are referring to the script pausing when you click on the tray icon, then using Opt("TrayAutoPause", 0) will prevent that. You can alsO prevent it by removing the default tray icon menu items using Opt("TrayMenuMode", 1).If not, please can we have a few more clues? 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...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 I don't know, it just quits working. The last time it quit and restarted by itself. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2010 Developers Share Posted December 19, 2010 I don't know, it just quits working. The last time it quit and restarted by itself.Seriously: What on earth do you expect to hear from us after given no information at all here? 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...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 (edited) Seriously: What on earth do you expect to hear from us after given no information at all here? Here is all the information I have. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=..\..\Images\ico\Bible48.ico #AutoIt3Wrapper_outfile=ShortCutBar.exe #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #Include <ButtonConstants.au3> #Include <Misc.au3> #Include <WinAPI.au3> #include <WindowsConstants.au3> #Include <GuiButton.au3> Opt("TrayAutoPause",0) Opt("MustDeclareVars", 0) ; Variables Global $ASSOCF_VERIFY = 0x00000040 Global $ASSOCSTR_EXECUTABLE = 2 Global $dll = DllOpen("user32.dll") ; _IsKeypressed events. Global $i, $x, $y, $str, $WinPos ; Generic values Global $ID, $hGuiBar, $bCtrl[27], $sc[27][3], $wOrt, $wLeft, $wTop ; GuiBar window. Global $hGuiOpt, $file, $alias, $key, $showbar, $clear, $orient, $Save, $close, $exit ; Options window. Global $moved, $bID, $teststr ; Misc. HotKeySet("!{F1}", "Help") ;=====================Read in data.===================== LoadData() Func LoadData() For $i = 1 to 26 ; Must have same value as control ID or tooltip crashes program. $sc[$i][1] = IniRead(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Program" & $i, "") $sc[$i][2] = IniRead(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Alias" & $i, "") Next $wOrt = IniRead(@ScriptDir & "\ShortCuts.ini", "Orientation", "Orient", "") $wLeft = IniRead(@ScriptDir & "\ShortCuts.ini", "Position", "Left", "") $wTop = IniRead(@ScriptDir & "\ShortCuts.ini", "Position", "Top", "") EndFunc ;=====================Create bar.===================== CreateBar() Func CreateBar() $x = 0 $y = 0 If $wOrt = "" Then $wOrt = 4 ; In case .ini is not found. .ini is generated on first save or exit. If $wOrt = 4 Then ; Horizontal. $GUI_SS_DEFAULT_GUI, $WS_EX_TOOLWINDOW $hGuiBar = GUICreate("ShortCutBar", 24 * 26, 24, $wLeft, $wTop, $WS_POPUP, $WS_EX_TOOLWINDOW) ; GUICtrlSetDefBkColor (0xff0000, $hGuiBar ) ; Keeps icons from appearing. GUISetFont(11, 400, 0, "Algerian") For $i = 1 to 26 $bCtrl[$i] = GUICtrlCreateButton("", $x, 0, 24, 24, $BS_ICON) ; GUICtrlSetBkColor( $bCtrl[$i], 0xff0000) ; Keeps icons from appearing. LoadIcon($i) $x += 24 Next Else ; Verical. $hGuiBar = GUICreate("ShortCutBar", 24, 24 * 26,$wLeft, $wTop, $WS_POPUP ,$WS_EX_TOOLWINDOW) GUISetFont(11, 400, 0, "Algerian") For $i = 1 to 26 $bCtrl[$i] = GUICtrlCreateButton("", 0, $y, 24, 24, $BS_ICON + $BS_DEFPUSHBUTTON) LoadIcon($i) $y += 24 Next EndIf GUISetState(@SW_SHOW, $hGuiBar) EndFunc ; CreateBar() Func LoadIcon($i) Local $prog, $iconfound, $int ; Full internet string: ".ac",".af",".al",".am",".as",".at",".au",".az",".be",".biz",".bt",".ca",".cc",".ch",".cn",".coop",".cx",".cz",".de",".dk",".dz",".ec",".edu",".ee",".eg",".es",".fo",".fr",".ga",".gf",".gl",".gov",".gr",".gs",".hk",".il",".in",".info",".io",".is",".it",".jp",".kr",".kz",".li",".lu",".ly",".mc",".mil",".mm",".ms",".mx",".net",".nl",".no",".nu",".nz",".org",".pl",".pt",".ro",".ru",".se",".sg",".sg",566".tc",".st",".tc",".tf",".th",".tj",".tm",".to",".uk",".us", Local $http[9] = [".com",".net",".org",".edu",".info",".us",".biz",".gov",".mil"] ; Executable If $sc[$i][1] = "" Then ; No data. GUICtrlSetData($bCtrl[$i], Chr($i + 64)) ElseIf StringRight($sc[$i][1], 4) = ".exe" then ; Executable. GUICtrlSetImage($bCtrl[$i], $sc[$i][1], 1, 0) ElseIf StringMid($sc[$i][1], Stringlen($sc[$i][1]) -3, 1) = "." Then ; Misc files $prog = _FileAssociation(StringRight($sc[$i][1], 4)) ; Get associated program for file type. If $prog ="" Then $prog = "Shell32.dll" ; Generic icon used when program not found. GUICtrlSetImage($bCtrl[$i], $prog, 1, 0) ElseIf StringLeft($sc[$i][1], 6) = "mailto" then ; Mail $var = RegRead("HKEY_CLASSES_ROOT\mailto\DefaultIcon", "") $var = StringLeft($var, Stringlen($var) -2) GUICtrlSetImage($bCtrl[$i], $var, 1, 0) ElseIf StringMid($sc[$i][1], 2, 2) = ":\" And StringMid($sc[$i][1], Stringlen($sc[$i][1]) -3, 1) <> "." Then ; Folders GUICtrlSetImage($bCtrl[$i], "Shell32.dll", 4, 0) ; Folder icon. EndIf ; Internet For $int = 0 to 8 If StringRight($sc[$i][1], StringLen($http[$int])) = $http[$int] Then GUICtrlSetImage($bCtrl[$i], @ProgramFilesDir & "\Internet Explorer\iexplore.exe", 1, 0) EndIf Next EndFunc ; LoadIcon($i) ; _FileAssociation By WideBoyDixon ; http://www.autoitscript.com/forum/topic/96988-winapi-findexecutable-replacement/page__p__697477__hl__assocquerystringw__fromsearch__1#entry697477 Func _FileAssociation($sExt) Local $aCall Local $aCall = DllCall("shlwapi.dll", "int", "AssocQueryStringW", _ "dword", $ASSOCF_VERIFY, _ "dword", $ASSOCSTR_EXECUTABLE, _ "wstr", $sExt, _ "ptr", 0, _ "wstr", "", _ "dword*", 65536) If @error Then Return SetError(1, 0, ""); call failed EndIf If Not $aCall[0] Then Return SetError(0, 0, $aCall[5]) ElseIf $aCall[0] = 0x80070002 Then Return SetError(0, 0, "{unknown}"); COM Error 0x80070002, ?The system cannot find the file specified.' ElseIf $aCall[0] = 0x80004005 Then Return SetError(0, 0, "{fail}"); E_FAIL Else Return SetError(2, $aCall[0], ""); EndIf EndFunc ; _FileAssociation() ;=====================Create Options.===================== $hGuiOpt = GUICreate("Options", 500, 350, (@DesktopWidth / 2) -250, (@DesktopHeight / 2) - 150, $WS_BORDER ) GUISetFont(11, 400, 0, "Tahoma") GUICtrlCreateLabel("Press Alt+F1 for help...", 20, 10) GUICtrlCreateLabel("Enter program path or:", 90, 40) $browse = GUICtrlCreateButton("Browse", 280, 30) $file = GUICtrlCreateInput("", 90, 70, 390, 30) GUICtrlSetData($file, $sc[1][1]) GUICtrlCreateLabel("Enter name for shortcut:", 90, 110) $alias = GUICtrlCreateInput("", 90, 140, 390, 30) $Clear = GUICtrlCreateButton("&Clear", 200, 180, 120) GUICtrlSetData($alias, $sc[1][2]) GUICtrlCreateLabel("Select" & @CRLF & "Key", 20, 45) $key = GUICtrlCreateList("A", 20, 90, 50, 150) For $i = 66 to 89 $str &= Chr($i) & "|" Next $str &= "Z" GUICtrlSetData($key, $str, "A") $orient = GUICtrlCreateCheckbox("Checked = Verticle; Uncheck = Horizontal", 90, 220, 390) GUICtrlSetState($orient, $wOrt) GUICtrlCreateLabel("Save after each change!", 150, 250) $Save = GUICtrlCreateButton("&Save", 65, 280, 120) $close = GUICtrlCreateButton("&Close Options", 189, 280, 120) $exit = GUICtrlCreateButton("&Exit Program", 313, 280, 120) ; ExtractAssociatedIcon Main() Func Main() Local $tPOINT, $hWnd Local $oldBut, $oldkey $moved = False While 1 $ID = GUIGetCursorInfo($hGuiBar) $tPOINT = _WinApi_GetMousePos() $hWnd = _WinApi_WindowFromPoint($tPOINT) $hParent = _WinApi_GetParent($hWnd) If _IsPressed("01", $dll) And WinActive($hGuiBar) Then RunProg() If _IsPressed("02", $dll) And WinActive($hGuiBar) Then MoveBar($hGuiBar) If $moved = False And $ID[4] > 2 Then ; If $moved = true the bar was moved - don't open options. GUICtrlSetData($key, Chr($ID[4] + 62)) GUICtrlSetData($file, $sc[$ID[4]-2][1]) GUICtrlSetData($alias, $sc[$ID[4]-2][2]) $bID = $ID[4] ; Open different window, save ID of button selected. GUISetState(@SW_SHOW, $hGuiOpt) ; Open options window if the shortcur bar has not been moved. _WinAPI_SetFocus($save) EndIf EndIf If $hParent = $hGuiBar And $ID[4] > 2 And $ID[4] <> $oldBut Then If $sc[$ID[4]-2][2] <> "" Then Tooltip($sc[$ID[4]-2][2]) else ToolTip("Press Alt+F1 for help." & @CRLF _ & "Right click to open options." & @CRLF _ & "Right click and hold to move.") EndIf $oldBut = $ID[4] EndIf If $hParent <> $hGuiBar Then ToolTip("") Switch GUIGetMsg(0) Case $browse GUICtrlSetData($file, FileOpenDialog("Select file for shortcut", @HomeDrive, "All (*.*)", 1 )) Case $clear GUICtrlSetData($file, "") GUICtrlSetData($alias, "") Case $key ; Load data based on key value. If GUICtrlRead($key) <> $oldkey Then $oldkey = (Asc(GUICtrlRead($key))-64) GUICtrlSetData($file, $sc[$oldkey][1]) GUICtrlSetData($alias, $sc[$oldkey][2]) $bID = $oldkey + 2 ; Update in case of concurrent save. EndIf Case $orient WriteFile() GUIDelete($hGuiBar) LoadData() CreateBar() Case $save $sc[$bID -2][1] = GUICtrlRead($file) $sc[$bID -2][2] = GUICtrlRead($alias) WriteFile() GUIDelete($hGuiBar) LoadData() CreateBar() Case $close GUISetState(@SW_HIDE, $hGuiOpt) Case $exit WriteFile() ; Save position of window. GUIDelete($hGuiOpt) ; Delete Options window. GUIDelete($hGuiBar) ; Delete Shortcut window. Exit EndSwitch Wend EndFunc ;<<--Main() Func MoveBar($hWnd) Local $PosDiff[2], $WinPos2 While 1 Local $MousePos = MouseGetPos () $WinPos = WinGetPos ($hWnd,"") $PosDiff[0] = $WinPos[0] - $MousePos[0] $PosDiff[1] = $WinPos[1] - $MousePos[1] While _IsPressed ("02", $dll) $MousePos = MouseGetPos () WinMove ($hWnd, "", $MousePos[0] + $PosDiff[0], $MousePos[1] + $PosDiff[1]) WEnd Sleep (10) ExitLoop WEnd $WinPos2 = WinGetPos ($hWnd,"") If $WinPos2[0] < 0 Then WinMove("ShortCutBar", "", 0, $WinPos2[1]) If $WinPos2[1] < 0 Then WinMove("ShortCutBar", "", $WinPos2[0], 0) ; +-3 allows for some movement error when trying to run program. If ($WinPos[0] < $WinPos2[0] - 3) Or ($WinPos[1] < $WinPos2[1] - 3) Or _ ($WinPos[0] > $WinPos2[0] + 3) Or ($WinPos[1] > $WinPos2[1] + 3)Then $moved = True ; If the window was moved, don't run program on return. Else $moved = False EndIf Sleep (10) EndFunc Func WriteFile() For $i = 1 to 26 IniWrite(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Key" & $i, Chr($i + 64)) IniWrite(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Program" & $i, $sc[$i][1]) IniWrite(@ScriptDir & "\ShortCuts.ini", "ShortCuts" & $i, "Alias" & $i, $sc[$i][2]) Next IniWrite(@ScriptDir & "\ShortCuts.ini", "Orientation", "Orient", GUICtrlRead($orient)) $WinPos = WinGetPos("ShortCutBar") If $WinPos[0] = "" then $WinPos[0] = 0 If $WinPos[1] = "" then $WinPos[1] = 0 IniWrite(@ScriptDir & "\ShortCuts.ini", "Position", "Left", $WinPos[0]) IniWrite(@ScriptDir & "\ShortCuts.ini", "Position", "Top", $WinPos[1]) EndFunc Func RunProg() If $ID[4] > 2 And $sc[$ID[4]-2][1] <> "" then ShellExecuteWait ($sc[$ID[4]-2][1]) Sleep(100) ; Got to give enough time for program to open or more copies will be ran. EndFunc Func Help() Local $help = "Enter entire program path or button will may be blank." & @CRLF & @CRLF _ & "If program does not have an icon and the full path is entered the button will not be changed." & @CRLF & @CRLF _ & "If a file's full is entered in the program box, the associated program's icon will be on the button." & @CRLF & @CRLF _ & "if a website is entered, it must be complete; your browser's icon will be on the button." & @CRLF & @CRLF _ & "Enter anything in the name for shortcut box, it will show up in the tooltip." & @CRLF & @CRLF _ & "Bar can be placed anywhere and it will be remembered."& @CRLF & @CRLF _ & "Right click to open options." & @CRLF & @CRLF _ & "Right click and hold to move bar." MsgBox(0, "Shortcut Bar Help", $help) EndFunc BTW: As far as I know all AutoIt scripts will shut down if let to sit. Edited December 19, 2010 by rdwray “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2010 Developers Share Posted December 19, 2010 Ok so we now have a script, so what exactly is your problem and when does it happen? When your script stalls you probably want to add the Opt("TrayIconDebug", 1) option which could help you determine at what location in the script is is hanging. Jos 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...
Developers Jos Posted December 19, 2010 Developers Share Posted December 19, 2010 BTW: As far as I know all AutoIt scripts will shut down if let to sit.Nope. 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...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 Ok so we now have a script, so what exactly is your problem and when does it happen?When your script stalls you probably want to add the Opt("TrayIconDebug", 1) option which could help you determine at what location in the script is is hanging.JosAdding Opt("TrayIconDebug", 1). It happened last time when I had several (maybe 5) IE8 windows open. After I got done and closed the IE8 windows, it started working. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 Nope.All the ones I have created do... Not one stays running all the time. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
toonboon Posted December 19, 2010 Share Posted December 19, 2010 Obviously a script that ends will stop running, if you want it to keep running add in an endless loop somewhere. while 1 sleep(10) wend [right]~What can I say, I'm a Simplistic person[/right] Link to comment Share on other sites More sharing options...
Developers Jos Posted December 19, 2010 Developers Share Posted December 19, 2010 All the ones I have created do... Not one stays running all the time.This says something about your scripts, not AutoIt3 itself 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...
Moderators Melba23 Posted December 19, 2010 Moderators Share Posted December 19, 2010 rdwray,I have several scripts that run on my machine from bootup to shutdown and I have never had one "shut down" unless I command it or there is an internal error which I have not managed correctly - which still happens every now and again, Are you saying that all your AutoIt scripts shut down at some point with no error indicated? If so, do you have a periodic scan by some form of AV which might flag them as a problem? 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...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 (edited) Obviously a script that ends will stop running, if you want it to keep running add in an endless loop somewhere. while 1 sleep(10) wend toonboon, I understand what you are saying, but I have a loop that feeds tooltips all the time based on the cursors position starting at line 161 and ending at line 231. If this is not correct, I will be more than happy to fix it. Edited December 19, 2010 by rdwray “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 rdwray,I have several scripts that run on my machine from bootup to shutdown and I have never had one "shut down" unless I command it or there is an internal error which I have not managed correctly - which still happens every now and again, Are you saying that all your AutoIt scripts shut down at some point with no error indicated? If so, do you have a periodic scan by some form of AV which might flag them as a problem? M23Yep, I have had them all to shut down. I am running MS security, Comodo firewall on MS OS 64bit. I am sure that MS Security is looking at every bit that is running on the machine. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 (edited) I really didn't take a good enought look, but it shuts down any time IE8 has a window open and it doesn't make any difference if it minimized or not. I set the cursor up to change and that works, but nothing else including tooltips. Edit: One more thing; if I set window to Always On Top, it works. New Edit: I tried with Excel and it also takes presense over script. If I open another window like Explorer or Thunderbird or even another script after IE8 or Excel, the script starts working again. Edited December 19, 2010 by rdwray “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 Look at all the edits in my last post - this problem only occurs with compiled script. “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther Link to comment Share on other sites More sharing options...
rdwray Posted December 19, 2010 Author Share Posted December 19, 2010 The problem was "ShellExecuteWait". Changed to "ShellExecute" and "Sleep(100)" and everything is working now. Thanks for the help... “No other God have I but Thee; born in a manger, died on a tree.” Martin Luther 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