Jump to content

iAmNewbe

Active Members
  • Posts

    212
  • Joined

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

iAmNewbe's Achievements

Polymath

Polymath (5/7)

15

Reputation

  1. Basically you just put two controls next to each other and color one, one color and another something else. I was writing a question about this on HOW to do this and in the process I figured it out. Since I wrote most of it already I just finished it into a little tutorial for those not already in the know on this. I am sure I will forget this and will need at sometime to rediscover so this is also a tutorial for my future self when I forget. There used to be a tutorial or scripts section in the forums, I am not able to find it or would put it there instead of here. Since it is GUI related I posted to the GUI Help and Support section.
  2. Full Code Sample #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. HotKeySet("{ESC}", "close") Example() Func Example() Global $hGui = GUICreate("Example", 200, 120, -1, -1) GUISetState(@SW_SHOW, $hGui) #Region ;~ Vertical Separator GUICtrlCreateLabel("", 30, 20, 1, 90) ; L T W H GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", 31, 20, 1, 90) ; L T W H GUICtrlSetBKColor(-1, 0xFFFFFF) #EndRegion #Region ;~ Horizontal Separator GUICtrlCreateLabel("", 32, 40, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", 32, 41, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xFFFFFF) #EndRegion GUICtrlCreateLabel("Separator Lines Example", 32, 55, 150, 20, $SS_CENTER) ; L T W H Style StyleEX #Region ;~ Horizontal Separator GUICtrlCreateLabel("", 32, 81, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xD5DFE5) GUICtrlCreateLabel("", 32, 82, 150, 1) ; L T W H GUICtrlSetBKColor(-1, 0xFFFFFF) #EndRegion #Region ;~ Tray Menu TrayCreateItem("") ; Create a separator line. TrayCreateItem("Separator Lines Example") TrayCreateItem("") ; Create a separator line. #EndRegion Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE close() EndSwitch Switch TrayGetMsg() Case $idExit ; Exit the loop. close() EndSwitch WEnd EndFunc ;==>Example Func close() GUIDelete($hGui) Exit EndFunc
  3. This may or may not be useful and comes in play if you are not using a UDF or the built-in methods or 3rd party code for creating menus and layouts. I wrote this with the assumption the reader is new to the language and doesn't have a lot of experience yet. Possible Reasons 1: You are writing Gui elements yourself from scratch. Why? because you just desire to. 2: Need for something to work a specific way that the built-in methods do not allow for. 3: You just want a learning exercise. I was trying to figure out how to recreate the separators you see in tray menus with that same style inside a GUI using Label Controls. You know those single lines that separate menu items when you use TrayCreateItem("") ; Create a separator line. See Attached Image Either there is no single GUI control to allow for the exact styling of separator lines seen in the Tray Menu OR I haven't discovered it yet. My solution: The color codes in RGB HEX 0xD5DFE5  ;~  A light blue grey color 0xFFFFFF  ;~  Color white When you insert your Label Control leave the "text" part empty and do not use any option flags. Some of the Style and Ex Style options prevent coloring and sizing the control. GUICtrlCreateLabel("", LEFT, TOP, WIDTH, HEIGHT) You need TWO controls and TWO background color settings Horizontal Separator - White Color goes on bottom GUICtrlCreateLabel("", LEFT, TOP, WIDTH, HEIGHT)         ;~  Empty Label Control GUICtrlSetBKColor(-1, 0xD5DFE5)                          ;~  Background Color Setting for previous Label Control GUICtrlCreateLabel("", LEFT, TOP + 1, WIDTH, HEIGHT) ;~ Second Label Control needs to be distanced one away from previous Label Control GUICtrlSetBKColor(-1, 0xFFFFFF) Vertical Separator - White Color is on INSIDE or to the Right of the grey line GUICtrlCreateLabel("", LEFT, TOP, HEIGHT, WIDTH)         ;~ Reverse Width and Height GUICtrlSetBKColor(-1, 0xD5DFE5)                           GUICtrlCreateLabel("", LEFT + 1, TOP, HEIGHT, WIDTH)     ;~ Add ONE to the LEFT not the TOP GUICtrlSetBKColor(-1, 0xFFFFFF) This will MATCH the Tray Menu separators in color and look.
  4. Thank you for the suggestion. I tried it and it does not work, I am not able to get control of any application that is launched via a chain as described previously. The applications run and operate normally I just can't gain control of them when launched deeper than a first child process. The only solution I have come up with that does work is using a scheduled task to run manually that launches app2.exe. Instead of linking the executable directly from App1, I run the task. It's a work around until some magic happens that I don't have to do that. If these were console applications I would like to try the Run option to start the console app in it's own process but these are not currently. If the parent process MUST also be a console application then it won't work for me anyway.
  5. In same situation but NOT web browser I open NotePad++ and try to inject log data into window control with same 3rd party application. Same issue, it won't paste into the text window. When chain loading. I don't know... I wanted to have everything accessible via ONE location, if i run them manually it all works. I just have to click three to four shortcut links. I wanted to click one via my development helper app.
  6. App1 runApp2() Func runApp2() ShellExecute('app2.exe') EndFunc While 1 Sleep(30000) Exit WEnd App2 runExe() Func runExe() ShellExecute('chrome.exe', 'https://www.autoitscript.com/forum/topic/208655-is-it-possible-to-start-an-application-in-own-process') EndFunc Exit I don't have an AutoIT script for accessing a text editor or manipulating html, javascript for web development. I use something else. The forum rules from my understanding prevent sharing those things in code, manipulating web pages, forms, drop down options etc... The examples above just duplicate the chaining opening of applications. On my end this application runs until I exit the application but the samples above I just timed App1 to close after 30 seconds. App2 runs then closes. My problem is with access of applications opened by App2 when chain opened by App1 App1 runs App2 App2 runs browser or ide or image editor etc... 3rd Party program fails to access in example above chrome but can also be notepad++ or any other application If I just run App2 by itself this works The "fix" in this situation is to run App2 via a sheduled task set to manual run only Then App1 runs the task task runs App2 I don't know why I have to do this... it shouldn't matter but one way works, one way doesn't.
  7. I was able to get it to work by creating a scheduled task and then running that task Run(@ComSpec & " /c " & 'C:\Windows\System32\schtasks.exe /run /tn "runApp2"', "", @SW_HIDE) Hope to find an alternative to this method.
  8. Is this for internal use where you work or for yourself? Does it need to be part of an application that is distributed to users? If this is something you use yourself then you need to create a plugin for chrome and then access that plugin via your autoIT app to inject javascript into the page to make any changes. This is ONE way. Chrome has or did have a developer tool that allowed you to take control of chrome but I think they stopped developing it. You should be able to do an internet search and you will either find the tool in an archive some place or it could still be developed or an alternative to it. When it comes to Chrome or any browser you need a helper to access the internals that you then access in some way externally to command the browser.
  9. You are asking the best way to return values from a function? The best way depends on what you are intending to do with the values after the function does whatever it does. Do you intend to display the value? Insert it into a database or external file of some sort to be used later? Use the output of the function to complete an operation or algorithm? Or you may not even need to return a value and instead just export it within the function. If you are going to pass it to another function for processing or return back to a calling function then you do need to use 'return.' Usually if you are concerned with best practices then modular thinking needs to be used and keep functions to ONE purpose and one purpose only. Not do something THEN also do something else. You do one thing then return the data to somewhere or send the data to another function to do the next thing. You can RETURN or use Global variables when passing values out of a function or send directly to an external file or database. Pretty much what I can think of to answer your question. The variables can be string, numeric, array etc... the type matters to what you are doing with the processing of the value within your application.
  10. These are NOT console applications so the Run option of "$RUN_CREATE_NEW_CONSOLE (0x10000)" will not work. Just to be clear I am asking about how to open an executable in it's own process from within AutoIT app.
  11. AutoIT 3.3.14.5 / 3.3.15 ------------------------------------- I need to open a chain of applications where one application opens the next one without these becoming child processes. I have looked in the manual but can't find a ready solution. None of these are console applications. The applications open fine but the ability to control or access controls does not seem to work correctly for some 3rd party applications I use. app 1  |-> executable ; Works app 1    | - >  app 2        | - >  executable  ; No access to window controls I have tried running app 2 from app 1 using ShellExecute($app2) ShellExecute($app2) ShellExecute($app2, '', '', 'open') Run($app2) Run(@ComSpec & " /c " & $app2, "", @SW_HIDE) ; Command Prompt All of these open app2 into a child process of app1 and then the final executable is a grand child of app 1. I guess this is what is going on. I just want to open app2 from app1 and have it be it's own thing running in it's own process exactly if it were run by clicking directly on the application exectuable file or shortcut. This chaining of opening applications seems to some how lock or prevent access to controls, via 3rd party applications. I do not know why or how. I just know NOT chaining like this it works and chaining the opening of these executables when one opens another that opens another, access to application controls stop working. It is specific to what I am doing and does not seem to prevent any normal operation. Ideas how to start an application from within an AutoIT application as it's own process without being a child of the parent? -- Due to possible rules violation with description of the exact situation I find things not working I have rewrote this post to be generic.
  12. I created a new compiler directive. It works though the color in the au3 file is not changing in Scite. I have looked in every file having to do with this and I can not find where the coloring occurs. How can I associate this new directive to the same color as the rest of the directives? The new directive temporarily removes some console writes from the normal output to minimize scrolling and adds spacing lines for easy reading of output my scripts create. The color is not being matched though, I am not sure where this occurs. I just want the color to match the built-in directives. Anyone that can share how to do this? I am using the full AutoIT version of Scite 4.12 with AutoIT 3.3.14.5
  13. I created a Toggle switch to turn on and off the screen capture via the space bar. Doesn't solve the problem but allows for opting to not run or "pause" the screen capture. Global $toggle = 0 HotKeySet("{SPACE}","toggleScreenCap") While 1 If $toggle = 0 Then capture() ;Sleep(40) WEnd Func toggleScreenCap() If $toggle = 1 Then $toggle = 0 ElseIf $toggle = 0 Then $toggle = 1 EndIf EndFunc
  14. GUICtrlSetBkColor($color_block0, '0x00' & $originalColor) GUICtrlSetBkColor($color_block0, '0x' & $originalColor) In the last code above I see no difference in sending the above to the Label Control for the colors. The first two digits are for the transparency but I see no difference with either version above. I should though, technically. In other code I have written it is important to add the first two 00's.. some controls you have to use FF's I guess the transparency values are reversed on some controls? But if you do this GUICtrlSetBkColor($color_block0, $originalColor) Color is WAY off. Interesting experiment results.
  15. $shadeV = 0.15 works well Nice!
×
×
  • Create New...