Jump to content

cookiemonster

Active Members
  • Posts

    164
  • Joined

  • Last visited

Recent Profile Visitors

746 profile views

cookiemonster's Achievements

  1. Sure and it'll help me understand
  2. Sorry maybe im being stupid but I dont understand, thats not calling any of the functions in Chilkat.au3?
  3. That is true, sorry let me drill down to what I do need as most of it I dont... what I do need is just: "id": "1:1001306455",         "info": {           "name": "banana" each time it occours, if this gives you any ideas?
  4. Im trying to read a JSON file into an array. The JSON looks like this: { "project_info": { "project_number": "123456789", "url": "https://www.website.com", "project_id": "PRJ08", "Bucket": "Buk09" }, "client": [ { "client_info": { "id": "1:1001306455", "info": { "name": "banana" } }, "oauth_client": [ { "client_id": "1001306455694-m3h6v", "client_type": 3 } ], "a_key": [ { "key": "dkldkdkd" } ], "Avail": { "ana": { "status": 1 }, "vit": { "status": 1, "other": [] }, "ad": { "status": 2 } } }, { "client_info": { "id": "1:1838346", "info": { "name": "orange" } }, "oauth_client": [ { "client_id": "2145696315633-dmdhe", "client_type": 3 } ], "a_key": [ { "key": "osikdme" } ], "Avail": { "ana": { "status": 1 }, "vit": { "status": 1, "other": [] }, "ad": { "status": 2 } } }, ], "configuration_version": "1" } What I want to do is read it all into one single large array, can anyone help? All I have so far is: #include "JSON.au3" #include "array.au3" $file = fileread("C:\file.json") JsonToArray($file) Func JsonToArray($JSON) $JSON = StringRegExpReplace($JSON, "[\[\]{}]", "") $sBreak = StringSplit($JSON, ",") For $a = 1 To $sBreak[0] $t = _JSONDecode("{" & $sBreak[$a] & "}") _ArrayDisplay($t, "multi " & $a & " of " & $sBreak[0]) Next EndFunc ;==>JsonToArray
  5. Thats great thanks, can see where I went wrong with both bits now, thanks!
  6. Hi, I have a main window with one button, when i press that button it brings up a loading screen, but I have two problems with the loading screen at the moment: 1) Once I have pressed the button, if i open something else full screen over this autoit project (eg: chrome), then on my task bar click on the autoit project to bring it up to the front, the loading screen does not stay on top of the main window, I tried using $WS_EX_TOPMOST but this makes the loading screen stay on top of all windows, I only want it to stay on top of $Main (my main window GUI) 2) Once the loading screen has been updated to 100%, it should sleep for a further two seconds then close, but at the moment after that 2 seconds, it goes back down to 25% instead of $LoadingWindow being deleted. Has anyone got any thoughts or suggestions? #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <FontConstants.au3> $Main = GUICreate("Main Window", 600, 480, -1, -1, -1, $WS_EX_ACCEPTFILES) Global $button_Load = GUICtrlCreateButton("Loading Screen", 484, 98, 89, 20, $WS_GROUP) GUICtrlCreateTab(8, 16, 585, 424) GUICtrlCreateTabItem("Settings") GUICtrlCreateGroup("Settings", 16, 50, 569, 380) GUISetState(@SW_SHOWNORMAL) Func Load() WinSetState($Main, "", @SW_DISABLE) LoadingScreen("Loading @ 25%") GUICtrlSetData($LoadingPercent, 25) sleep(2000) LoadingScreen("Loading @ 100%") GUICtrlSetData($LoadingPercent, 100) sleep(2000) GUIDelete($LoadingWindow) WinSetState($Main, "", @SW_ENABLE) EndFunc Func LoadingScreen($LoadingText) ;Creates a Splash Text Screen with a progress bar. Global $LoadingWindow = GUICreate("", 500, 184, -1, -1, BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) Global $LoadingPercent = GUICtrlCreateProgress(18, 144, 461, 25, $PBS_SMOOTH) GUICtrlCreateLabel($LoadingText, 2, 44, 494, 88, $SS_CENTER) GUICtrlSetFont(-1, 15, 800, 0, "Calibra", $CLEARTYPE_QUALITY) GUISetState(@SW_SHOW) EndFunc While (1) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button_Load Load() EndSwitch WEnd
  7. Thank you for clarifying, is there anyway i can test that its valid first without having the window freeze? If there is a function available for this whats the info page url for it for me to read up on?
  8. Appolgise for the delay on my response. I am using it with a name rather than URL, so is there no way of getting rid of the freeze when using it with a name rather than a url?
  9. User needs to be able to see the window from the very start, it will later have a refresh button which will call the same function again, and I wouldnt want it freezing when doing the function again after pressing refresh button I have stripped it down to basics, its now using native autoit, but still freezes: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> Local $SERVERADDRESS = "SomeServer" GUICreate("", 395, 532, 598, 0) GUICtrlCreateLabel("IP: ", 24, 56, 20, 17) $JEFF_IP = GUICtrlCreateLabel("", 120, 56, 249, 21) GUISetState(@SW_SHOW) HostToIP($ServerAddress) Func HostToIP($Server) TCPStartup() Local $sIPAddress = TCPNameToIP($Server) If @error Then GUICtrlSetData ($JEFF_IP, "Error code: " & @error) Else GUICtrlSetData ($JEFF_IP, $sIPAddress) EndIf TCPShutdown() EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  10. I downloaded it from: Its version 4.3 i believe
  11. Attached MetroGUI_UDF.au3, however i havnt modified it at all. No func for _sql.au3 at present, it freeze for me as it is in the code above. MetroGUI_UDF.au3
  12. Heres a full working script where it freezes: #NoTrayIcon #include <EditConstants.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <Timers.au3> #include <Sound.au3> #include <MetroGUI-UDF\MetroGUI_UDF.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <_sql.au3> #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe #AutoIt3Wrapper_Res_HiDpi=y _SetTheme("DarkBlueV2") _Metro_EnableHighDPIScaling() Local $ServerAddress = "SomeServer" $GLOBAL_MAIN_GUI = _Metro_CreateGUI("Settings", 347, 532, 950, -1, True) GUISetFont ( 9 , 0 , 0 , "Segoe UI" , $GLOBAL_MAIN_GUI , 5 ) GUICtrlSetDefColor ( $COLOR_WHITE , $GLOBAL_MAIN_GUI ) GUICtrlCreateGroup("", 8, 35, 330, 142) GUICtrlCreateLabel("IP", 24, 80) $IP = GUICtrlCreateLabel("", 130, 80, 193, 21, $SS_RIGHT) $Control_Buttons = _Metro_AddControlButtons(True, False, True, False, True) $GUI_CLOSE_BUTTON = $Control_Buttons[0] GUICtrlSetTip($GUI_CLOSE_BUTTON, "Close") $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] $GUI_MENU_BUTTON = $Control_Buttons[6] Dim $MenuButtonsArray[4] = ["Settings", "About", "Contact", "Exit"] GUISetState(@SW_SHOW) HostToIP($ServerAddress, $IP) While 1 _Metro_HoverCheck_Loop($GLOBAL_MAIN_GUI) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON Exit Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE) Case $GUI_MENU_BUTTON Local $MenuSelect = _Metro_MenuStart($GLOBAL_MAIN_GUI, $GUI_MENU_BUTTON, 150, $MenuButtonsArray, "Segoe UI", 9, 0) Switch $MenuSelect Case "0" MsgBox (4096,"1","2") Case "1" ConsoleWrite("Returned 1 = About button clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = Contact button clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Exit button clicked." & @CRLF) _Metro_GUIDelete($GLOBAL_MAIN_GUI) Exit EndSwitch EndSwitch WEnd Func HostToIP($Host, $Label) TCPStartup() Local $sIPAddress = TCPNameToIP($Host) If @error Then GUICtrlSetData ($Label, "Error code: " & @error) Else GUICtrlSetData ($Label, $sIPAddress) EndIf TCPShutdown() EndFunc
  13. Hi, I have a form which calls this function: Func HostToIP($Host, $Label) TCPStartup() Local $sIPAddress = TCPNameToIP($Host) If @error Then GUICtrlSetData ($Label, "Error code: " & @error) Else GUICtrlSetData ($Label, $sIPAddress) EndIf TCPShutdown() EndFunc But if it cannot resolve the host to an IP, the whole form freezes for a few seconds until the TCPNameToIP times out, how can I stop the form from freezing whilst it waits for the host to ip times out? TCPNameToIP is part of #include <_sql.au3>
  14. I've been having a play about but i cant stop it from going full screen, can anyone help me?. My script is: #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /rm /pe #AutoIt3Wrapper_Res_HiDpi=y #TrayIcon #include "MetroGUI-UDF\MetroGUI_UDF.au3" _SetTheme("DarkBlueV2") ;See MetroThemes.au3 for selectable themes or to add more _Metro_EnableHighDPIScaling() $Form1 = _Metro_CreateGUI("Example", 350, 350, -1, -1) $Control_Buttons = _Metro_AddControlButtons(True, False, False, False, True) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True ;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected. $GUI_CLOSE_BUTTON = $Control_Buttons[0] $GUI_MAXIMIZE_BUTTON = $Control_Buttons[1] $GUI_RESTORE_BUTTON = $Control_Buttons[2] $GUI_MINIMIZE_BUTTON = $Control_Buttons[3] $GUI_FULLSCREEN_BUTTON = $Control_Buttons[4] $GUI_FSRestore_BUTTON = $Control_Buttons[5] $GUI_MENU_BUTTON = $Control_Buttons[6] ;====================================================================================================================================================================== ;Create Buttons $Button1 = _Metro_CreateButton("Button Style 1", 105, 245, 130, 40) $Button2 = _Metro_CreateButtonEx("Button Style 2", 255, 245, 130, 40) ;Create an Array containing menu button names Dim $MenuButtonsArray[4] = ["a", "b", "", "Exit"] GUISetState(@SW_SHOW) While 1 _Metro_HoverCheck_Loop($Form1) ;This hover check has to be added to the main While loop, otherwise the hover effects won't work. $nMsg = GUIGetMsg() Switch $nMsg ;=========================================Control-Buttons=========================================== Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON _Metro_GUIDelete($Form1) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Exit Case $GUI_MAXIMIZE_BUTTON GUISetState(@SW_MAXIMIZE) Case $GUI_RESTORE_BUTTON GUISetState(@SW_RESTORE) Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE) Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON _Metro_FullscreenToggle($Form1, $Control_Buttons) ;=================================================================================================== Case $GUI_MENU_BUTTON Local $MenuSelect = _Metro_MenuStart($Form1, $GUI_MENU_BUTTON, 150, $MenuButtonsArray, "Segoe UI", 9, 0) ; Opens the metro Menu. See decleration of $MenuButtonsArray above. Switch $MenuSelect ;Above function returns the index number of the selected button from the provided buttons array. Case "0" ConsoleWrite("Returned 0 = Settings button clicked." & @CRLF) Case "1" ConsoleWrite("Returned 1 = About button clicked." & @CRLF) Case "2" ConsoleWrite("Returned 2 = Contact button clicked." & @CRLF) Case "3" ConsoleWrite("Returned 3 = Exit button clicked." & @CRLF) _Metro_GUIDelete($Form1) Exit EndSwitch Case $Button2 _GUIDisable($Form1, 0, 30) ;For better visibility of the MsgBox on top of the first GUI. _Metro_MsgBox(0, "Metro MsgBox Example", "Button 2 clicked. (Button with 3 secs timeout)", 400, 11, $Form1, 3) ; with 3 secs timeout _GUIDisable($Form1) Case $Button1 _GUIDisable($Form1, 0, 30) Local $Select_YesNo = _Metro_MsgBox(4, "Metro MsgBox Example", "Select yes to create a second GUI.", 350, 11, $Form1) If $Select_YesNo = "Yes" Then _SecondGUI() _GUIDisable($Form1) EndSwitch WEnd Func _SecondGUI() Local $Form2 = _Metro_CreateGUI("Example2", 600, 400, -1, -1, True) ;Add control buttons Local $Control_Buttons_2 = _Metro_AddControlButtons(True, True, True, True) ;Set variables for control buttons Local $GUI_CLOSE_BUTTON = $Control_Buttons_2[0] Local $GUI_MAXIMIZE_BUTTON = $Control_Buttons_2[1] Local $GUI_RESTORE_BUTTON = $Control_Buttons_2[2] Local $GUI_MINIMIZE_BUTTON = $Control_Buttons_2[3] Local $GUI_FULLSCREEN_BUTTON = $Control_Buttons_2[4] Local $GUI_FSRestore_BUTTON = $Control_Buttons_2[5] Local $Button1 = _Metro_CreateButton("Close", 250, 340, 100, 40) GUICtrlSetResizing($Button1, 768 + 8) GUISetState(@SW_SHOW) While 1 _Metro_HoverCheck_Loop($Form2) ;Add hover check in loop $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON, $Button1 _Metro_GUIDelete($Form2) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs! Return 0 Case $GUI_MAXIMIZE_BUTTON GUISetState(@SW_MAXIMIZE) Case $GUI_RESTORE_BUTTON GUISetState(@SW_RESTORE) Case $GUI_MINIMIZE_BUTTON GUISetState(@SW_MINIMIZE) Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON _Metro_FullscreenToggle($Form2, $Control_Buttons_2) EndSwitch WEnd EndFunc ;==>_SecondGUI
×
×
  • Create New...