michaelslamet Posted January 21, 2014 Posted January 21, 2014 Jev, Delete or comment the WinActivate($win[1]) line for now. Does _ArrayDisplay($win) display something? what is that?
jevbrowser Posted January 21, 2014 Author Posted January 21, 2014 Melba, I get "Icon Not Found in System Tray" when i use this: expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $FlingFileTransfer = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here <<<<<<<<<<<<<<<<<<<<<<<<<<< $iSystray_ButtonNumber = Get_Systray_Index($FlingFileTransfer) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc The actual tooltip is "Fling File Transfer", so i assume i use: FlingFileTranfer (with no spaces). Right?
jevbrowser Posted January 21, 2014 Author Posted January 21, 2014 Jev, Delete or comment the WinActivate($win[1]) line for now. Does _ArrayDisplay($win) display something? what is that? Michael, i commented out the WinActivate and just ran with the _Array.............. The script completes with no errors, but nothing shows up at all anywhere. jev
Moderators Melba23 Posted January 21, 2014 Moderators Posted January 21, 2014 jevbrowser,No, you use it just as it appears while leaving the variable name as it was:Global $sToolTipTitle = "Fling File Transfer"Try that and see how you get on. As you are such a complete beginner, I strongly recommend reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References). You should also look at this excellent tutorial - you will find other tutorials in the Wiki (the link is at the top of the page). That will give you a good grounding in AutoIt syntax and structure and make the code look a little less like (Chinese|Cyrillic|Greek|insert non-latin alphabet of choice). 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
jevbrowser Posted January 21, 2014 Author Posted January 21, 2014 Thanks M23! I will read more Help files! For now, i have this and i still get the "Icon not found in system tray" expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "Fling File Tranfer" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here <<<<<<<<<<<<<<<<<<<<<<<<<<< $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc
michaelslamet Posted January 21, 2014 Posted January 21, 2014 Michael, i commented out the WinActivate and just ran with the _Array.............. The script completes with no errors, but nothing shows up at all anywhere. jev Then I afraid the method I proposed doesn't work with application that sit on the tray Please stick with Melba
Moderators Melba23 Posted January 21, 2014 Moderators Posted January 21, 2014 jevbrowser,Try spelling "Transfer" correctly. 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
jevbrowser Posted January 21, 2014 Author Posted January 21, 2014 Wow. Now THAT'S embarrassing!!! But, it was worth it, cuz guess what..........it worked! So, now i just have to add some keystrokes or clicks to Exit ,etc............. Thanks M23! I really appreciate this!!!!!!!!!!!!!! jev
Moderators Melba23 Posted January 21, 2014 Moderators Posted January 21, 2014 jevbrowser, guess what..........it worked!Why so surprised? My examples usually do what they are supposed to do. Anyway, glad I could help. But please do read the tutorial to which I linked and those early Help file sections - that really will help you get to grips with AutoIt. 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
jevbrowser Posted January 21, 2014 Author Posted January 21, 2014 will read help files. just, for the record...................NOT surprised at all! jev
jevbrowser Posted January 25, 2014 Author Posted January 25, 2014 Hey Melba!, Still have a small problem. Your code works perfectly to shut down my app gracefully, which is:: expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "Fling File Transfer" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here <<<<<<<<<<<<<<<<<<<<<<<<<<< $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc Your code above brings up the app menu from the system tray and then i add just a couple of mouse clicks to EXIT the app, and then i relaunch the app right away and it seems to launch ok to the system tray. That code is: MouseClick("left",1386,865,1) ;click EXIT MouseClick("left",1256,639,1) ;click STOP Run("C:\Program Files (x86)\NCH Software\Fling\fling.exe", "", @SW_SHOWMINIMIZED) The problem is that all of the above (your code, followed by my mouse clicks and the relaunch) only works ONCE. After that, I MUST reboot in order for your script to work again. If I do not reboot my Win7 pc, then I get the error: "Icon not found in system tray". EVERYTIME i reboot, the whole process works perfectly. The problem may be in how I am LAUNCHING the app after i run your script to shut it down. So, the steps in the process are: 1.run your script plus my mouse clicks to shut down the app, 2. relaunch the app with my RUN line above. I am trying to launch the app to mimick how win7 launchs it during reboot, which is that it loads and runs at STARTUP and it runs ONLY in the system tray, not in the TASKBAR at all. I think the way that i am launching the app may be the problem, but I am not sure how to launch the app to mimick the way win7 launchs it at reboot. Do you think you could help me out here? thanks, jev
Inverted Posted January 25, 2014 Posted January 25, 2014 (edited) start-run -> msconfig (Run msconfig.exe) Then find the exact command that starts your application at startup. If it's not there then look at the Scheduled Tasks. Edited January 25, 2014 by Inverted
jevbrowser Posted January 25, 2014 Author Posted January 25, 2014 ok Inverted. So, what i have now is this: Run("C:\Program Files (x86)\NCH Software\Fling\fling.exe", "", @SW_SHOWMINIMIZED) What is in msconfig is exactly this: "C:Program Files (x86)NCH SoftwareFlingfling.exe" -logon So, what exactly should my code line be? thanks, jev
Inverted Posted January 25, 2014 Posted January 25, 2014 (edited) ShellExecute("C:Program Files (x86)NCH SoftwareFlingfling.exe", "-logon","C:Program Files (x86)NCH SoftwareFling") You generally should be using ShellExecute instead of Run, unless there is a specific reason. I don't think you need @SW_SHOWMINIMIZED at all since the program will acknowledge the -logon parameter and go in the tray by itself. If it still doesn't work , please post your exact code, all of it. Edited January 25, 2014 by Inverted
BrewManNH Posted January 25, 2014 Posted January 25, 2014 The Run command has been mostly superseded by ShellExecute now that ShellExecute returns a PID since the latest version. Prior to 3.3.10.x it didn't return the PID which made things harder when trying to interact with the programs you started. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
jevbrowser Posted January 26, 2014 Author Posted January 26, 2014 Inverted, Here is what i have total: expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "Fling File Transfer" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here <<<<<<<<<<<<<<<<<<<<<<<<<<< $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit ;............ Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) ;_WinWaitActivate("Fling File Transfer","") MouseClick("left",1388,864,1) ;_WinWaitActivate("Confirm Exit","Background") MouseClick("left",1270,634,1) EndFunc The last _WinWaitActivate Func is all messed up i am sure. I can get the systray app menu to come up, but i can't click on the EXIT menu selection, followed by the STOP window selection in order to make the app close. Not sure what to do next. Thanks for your help jev
Inverted Posted January 26, 2014 Posted January 26, 2014 (edited) I installed the program on a VM to check it out. It seems when you exit/stop the program it stops the service, too. What happens if you do a ShellExecute("C:\Program Files (x86)\NCH Software\Fling\fling.exe", "-scanall","C:\Program Files (x86)\NCH Software\Fling") while the program is already running ? Isn't it doing a forced scan of your stuff ? Adjust your paths properly of course. Check the program's Help section for the command line options, you can update/upload/download etc with the cmdline. Edited January 26, 2014 by Inverted
jevbrowser Posted January 27, 2014 Author Posted January 27, 2014 I have tried to run the -scanall swich in the past with the RUN command, and it did not cause the Fling program to SCAN. I will try it with ShellExecute and let you know. You are right in that it would obviously be preferable not to have to stop and start the app everytime i wanted to force a SCAN. thanks, jev michaelslamet 1
Inverted Posted January 27, 2014 Posted January 27, 2014 I've also seen in the advanced setup options that you can set it to monitor the folders for changes automatically.
jevbrowser Posted January 27, 2014 Author Posted January 27, 2014 Yes, i have it setup to auto-monitor. But i was turning my nic off after work hours, then auto-turning it back on at midnight to run my scripts unattended. i think that was (and still is) causing the auto-monitor to break. Therefore, i have to run the -scanall. Anyway, you will be glad to know that your ShellExecute line FIXED it. It runs good now!!! So, i don't have to RESTART the app. Just run the -scanall via ShellExecute. Thanks a lot for your help!!! jev
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