
Vadersapien
Active Members-
Posts
130 -
Joined
-
Last visited
Everything posted by Vadersapien
-
Ok, that works, and I figured out a crude way to let in work in TabItems(hide and show when needed). My redraw function: Func Redraw($hWnd, $msg, $wParam, $lParam) If GUICtrlRead($LiveControlCommandsTab) = 1 Then _WinAPI_RedrawWindow($hWnd, '', '', $RDW_UPDATENOW) _WinAPI_DrawRotatedText($hGUI, 'Test', 5, 50) _WinAPI_DrawRotatedText($hGUI, 'Test', 25, 50) _WinAPI_DrawRotatedText($hGUI, 'Test', 45, 50) _WinAPI_DrawRotatedText($hGUI, 'Test', 65, 50) Else _WinAPI_RedrawWindow($hWnd) EndIf Return $GUI_RUNDEFMSG EndFunc Is there a better way to do it?
-
Thanks, your bottom one works perfect when using it more than once. I found out the top one didn't because of the _WinAPI_RedrawWindow(). However now I am faced with another problem: The text will disappear when the windows is hidden, then shown again, or even after a minimize and restore. Any way to fix this? EDIT: What about drawing the text in a TabItem? I haven't been able to find to do so.
-
One prob with the WinAPI method though. I managed to put it all in a function, but it only allows me to draw one lot of text at a time.
-
I think I've just about searched the whole forum for this and haven't found anything(correct me if I'm wrong). Is there a way to have a label control displays text vertically? Or maybe rotate the control? Would it be possible to achieve this with GDI+ maybe?
-
Just an example of a simple crash detector: Only disadvantage is that you must call CleanUp() every time before you use Exit. #include <GUIConstants.au3> Opt('TrayIconHide', True) $AppCrash = IniRead('CrashData.ini', 'CrashData', 'appcrash', 'Unknown') If $AppCrash = 'true' Then MsgBox(-1, 'Info', 'The script crashed last time it was used') EndIf IniWrite('CrashData.ini', 'CrashData', 'AppCrash', 'true') GUICreate('Crash Detector', 250, 40) $CrashSim = GUICtrlCreateButton('Simulate Crash', 5, 5, 115, 30) $Exit = GUICtrlCreateButton('Exit', 130, 5, 115, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE CleanUp() Case $Exit CleanUp() Case $CrashSim Exit EndSwitch WEnd Func CleanUp() GUIDelete() IniWrite('CrashData.ini', 'CrashData', 'AppCrash', 'false') Exit EndFunc
-
Download files with progress
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Tested it on 7 and and only the 2nd and 4th progress bars work. The others don't budge. According to the console they aren't being downloaded either... The small ones seem to work fine though. Maybe a queue would be more suitable(the general idea would be to push the files into an array and read off that, wouldn't it?). Another thing I'd like to do is fire off a function to manipulate those files once downloaded(in this case extracting, I should be able to do that with the ZLib UDF) -
Download files with progress
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
I had read the help for InetGet prior to posting this thread. Tried to implement it in my code, but it didn't work. Tried again from a fresh script. It worked. Here's how far I got: #include <GUIConstants.au3> Local $hGUI = GUICreate('Download File', 800, 70) Local $Progress = GUICtrlCreateProgress(10, 10, 780, 20) DirCreate(@TempDir & '\RS Media Manager\') GUISetState() _RSMWare_GetData('http://10.0.0.5/rsmware/rsmware.ini', @TempDir & '\RS Media Manager\rsmware.ini') GUICtrlCreateButton('Button', 10, 40, 780, 20) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() DirRemove(@TempDir & '\RS Media Manager', 1) Exit EndSwitch WEnd Func _RSMWare_GetData($url, $target) $hDownload = InetGet($url, $target, 1, 1) Do GUICtrlSetData($Progress, Ceiling((InetGetInfo($hDownload, 0)/InetGetInfo($hDownload, 1))*100)) Until InetGetInfo($hDownload, 2) InetClose($hDownload) MsgBox(Default, '', IniRead(@TempDir & '\RS Media Manager\rsmware.ini', 'Alarm Clock', 'Author', 'Unknown')) EndFunc Because of the Do...Until loop in the function it "removes" the entire "background downloading" feature...is there a way to fix this? Also I haven't been able to figure out a way to download multiple files at once...could anyone help with this -
Hi, I know this is probably quite simple, but I'd like to know how to download a file(in the background) and put the amount downloaded in the progress bar. I'd like to be able execute a function when the download finishes, as well as allowing the script to continue while downloading the files. It is a folder of files that will change quite contantly, so a file list can't be hardcoded.
-
Not a simple as I though it'd be. I my original idea was to just set the window style to $WS_POPUP with this code: If WinExists('GIMP Startup') Then _WinAPI_SetWindowLong(WinGetHandle('GIMP Startup'), $GWL_STYLE, $WS_POPUP) however that doesn't work properly(I'll get double progress bars, a white title bar or I completely white window). By the way, this is GIMP 2.7 Any Suggestions?
-
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
I solved my problem(finally) The ini file had to be uploaded in binary mode for it to parse correctly...though I find it weird how the section names still read when uploaded in text mode Is there a way I can mark the thread resolved at all? -
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Oh that's because I've been adding code all over the place since it's a test environment I was gonna clean all that up once I merged it into my actual program. If you saw how I MsgBoxed the contents of the local and downloaded ini, both return the exact same contents...maybe I'm just gonna have to download it first... -
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Well, here is my entire code: #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <IniString.au3> #include <WindowsConstants.au3> Local $var = IniStringReadSectionNames(BinaryToString(InetRead('http://10.0.0.5/rsmware/rsmware.ini'))) Local $listview, $hImage $inet = BinaryToString(InetRead('http://10.0.0.5/rsmware/rsmware.ini')) MsgBox(-1, '', FileRead(FileOpen("rsmware.ini", 0))) MsgBox(-1, '', $inet) GUICreate('Test GUI', 800, 600) MsgBox(-1, '', IniStringRead($inet, 'Alarm Clock', 'Author', 'Error')) $appname = GUICtrlCreateLabel('', 250, 10, 450, 20) $appauthor = GUICtrlCreateLabel('', 250, 30, 450, 20) $appver = GUICtrlCreateLabel('', 250, 50, 450, 20) $appinfo = GUICtrlCreateLabel('', 250, 70, 450, 500) $listview = GUICtrlCreateListView('', 0, 0, 200, 600, BitOr($LVS_SORTASCENDING, $LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $LVS_NOCOLUMNHEADER)) GUISetState() GUIRegisterMsg($WM_NOTIFY, '_WM_NOTIFY') _GUICtrlListView_AddColumn($listview, 'Column 1', 196) _GUICtrlListView_BeginUpdate($listview) For $i = 1 To $var[0] _GUICtrlListView_AddItem($listview, $var[$i], $i-1) Next _GUICtrlListView_EndUpdate($listview) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndListView $hWndListView = $listview If Not IsHWnd($listview) Then $hWndListView = GUICtrlGetHandle($listview) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) Switch HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Case $hWndListView Switch DllStructGetData($tNMHDR, "Code") Case $NM_CLICK $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $SelectedIndices = _GUICtrlListView_GetSelectedIndices($listview, True) If UBound($SelectedIndices) = 2 Then $SelectedApp = _GUICtrlListView_GetItemText($listview, $SelectedIndices[1]) GUICtrlSetData($appname, $SelectedApp) MsgBox(-1, '', IniStringRead($inet, 'Alarm Clock', 'Author', 'Error')) GUICtrlSetData($appver, 'Version ' & IniStringRead($inet, $SelectedApp, 'Version', '')) GUICtrlSetData($appinfo, IniStringRead($inet, $SelectedApp, 'Description', '')) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Don't bother testing the code, it won't work since I'm using local IP addresses. Figured out how to address detecting if there's no internet or the server is down, all I had to do was ping the server and check the result. Still don't know why it locks up while downloading though. Also found out that using _InetGetSource() with the AutoIt update.dat works fine too... -
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Hmm...another problem...I can only parse files off the hard disk(via fileread) with _IniString_Read(). Ones from the internet(via _InetGetSource() or InetRead) won't work for some reason... -
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Thanks! Nice UDF too. It's exactly what I was looking for...I did quite a thorough search of the forums, yet it didn't show up...maybe I was just the wrong keywords Functionality like this should be included in AutoIt! EDIT: One problem: The script locks up while downloading the file, or if there is no internet access. Any idea how to avoid that? -
Hi, Just wondering if you can use icons larger than 32x32px in an imagelist. Even with $fLarge set to True it still only extracts the 32x32px icon, even though the file has resolutions all the way up to 256x256...
-
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
I'm going to have to agree on that one...I think it would be much easier than manually parsing the ini... -
[Solved] Read .ini file from internet
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
_INetGetSource() and InetRead will both successfully get the contents of the ini file into a string, but then how do I parse the contents? IniRead doesn't seem to accept the contents of an ini file, only a path to the ini... -
Hi again, I'm trying to read an ini file from the internet, preferably without downloading the file to a temporary location. I've had a play around with InetRead with no success. Does anyone have any ideas?
-
Problem getting selected item from listview...
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
I made a small function to test if an item is selected. However it doesn't always work... Func _GUICtrlListView_ItemSelected($hGUI, $hListview) $ListviewPos = ControlGetPos($hGUI, '', $hListview) $CursorInfo = GUIGetCursorInfo($hGUI) If GUIGetMsg() = $GUI_EVENT_PRIMARYDOWN And $CursorInfo[0] > $ListviewPos[0] And $CursorInfo[0] < ($ListviewPos[0] + $ListviewPos[2]) And _ $CursorInfo[1] > $ListviewPos[1] And $CursorInfo[1] < ($ListviewPos[1] + $ListviewPos[3]) And _GUICtrlListView_GetSelectedIndices($hListview) <> '' Then Return True Else Return False EndIf EndFunc I have a feeling it has to do with the GUIGetMsg() = $GUI_EVENT_PRIMARYDOWN bit... I could have used $CursorInfo[2] to see if the mouse button was down but it wouldn't work...it just returned false all the time(anyone know why?)... -
Problem getting selected item from listview...
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
@Picaxe - Thanks for the suggestion. I like your method, it's a fair bit simpler to work with..I can't really decide between the two, especially when it comes to having two listviews(what then?) -
Problem getting selected item from listview...
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Alright...managed to simplify that WM_NOTIFY function mentioned in the help file: Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView ;~ Local $tBuffer $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ConsoleWrite('Clicked') EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY It works perfect, but can it be simplified any further? -
Hi, I while back I asked about the "Tab in Tab" situation, and was given the method of creating a child GUI to house the "tab in a tab". It works, except there is one problem: When you click another tab in the "parent" tab, the child GUI hides, yet no controls show where the child GUI was...here is my complete code: #AutoIt3Wrapper_icon=dev-icon.ico #NoAutoIt3Execute #include <COM.au3> #include <GUIConstantsEx.au3> #Include <GUIStatusBar.au3> #include <Icons.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> ;Set AutoIt Specific Options AutoItSetOption('GUICloseOnESC', False) AutoItSetOption('MustDeclareVars', True) AutoItSetOption('TrayIconHide', True) ;Declare Variables Local $ParentTab, $hParentTab Local $PersonalitiesTab, $FileListPC, $FileListRobot, $PerPic, $hChildGUI Local $LiveControlTab Local $EditorTab Local $MediaTab Local $ApplicationsTab, $ApplicationsCatList Local $JavaTab Local $TimeTab Local $StatusBar, $ProgressBar, $StatusBarParts[2] = [650, 150] ;Create GUI Global $hGUI = GUICreate('RS Media Manager', 800, 600) ;Create GUI Content $ParentTab = GUICtrlCreateTab(5, 5, 792, 568) $hParentTab = GUICtrlGetHandle($ParentTab) ;Create 'Personalities' Tab Content $PersonalitiesTab = GUICtrlCreateTabItem('Personalities') GUICtrlCreateLabel('Computer', 10, 43) $FileListPC = GUICtrlCreateList('', 10, 60, 320, 263, $LVS_SINGLESEL) $PerPic = GUICtrlCreatePic('perpic.jpg', 334, 32, 132, 176) GUICtrlCreateLabel('Robot', 470, 43) $FileListRobot = GUICtrlCreateList('', 470, 60, 320, 263, $LVS_SINGLESEL) $hChildGUI = GUICreate('', 780, 253, 5, 310, $WS_CHILD, -1, $hParentTab) GUICtrlCreateTab(0, 0, 782, 253) GUICtrlCreateTabItem('All') GUICtrlCreateListView('Name|Description|Path', 5, 27, 770, 220) GUICtrlCreateTabItem('Common') GUICtrlCreateTabItem('Control Mode') GUICtrlCreateTabItem('Arm Mode') GUICtrlCreateTabItem('Bodycon') GUICtrlCreateTabItem('') GUISetState() ;Switch back to main GUI GUISwitch($hGUI) ;Create 'Macro Editor' Tab Content $LiveControlTab = GUICtrlCreateTabItem('Live Control') ;Create 'Macro Editor' Tab Content $EditorTab = GUICtrlCreateTabItem('Editor') ;Create 'Media' Tab Content $MediaTab = GUICtrlCreateTabItem('Media') ;Create 'Personalities' Tab Content $ApplicationsTab = GUICtrlCreateTabItem('Applications') $ApplicationsCatList = GUICtrlCreateListView(-1, 10, 31, 200, 536, $LVS_NOCOLUMNHEADER) ;Create 'Personalities' Tab Content $JavaTab = GUICtrlCreateTabItem('Java') ;Create 'Time' Tab Content $TimeTab = GUICtrlCreateTabItem('Time') ;End Tab GUICtrlCreateTabItem('') ;Create Statusbar $StatusBar = _GUICtrlStatusBar_Create($hGUI) _GUICtrlStatusBar_SetParts($StatusBar, $StatusBarParts) _GUICtrlStatusBar_SetText($StatusBar, ' ' & 'Robot not connected', 0) $ProgressBar = GUICtrlCreateProgress(0, 0) GuiCtrlSetData($ProgressBar, 50) _GUICtrlStatusBar_EmbedControl($StatusBar, 1, GUICtrlGetHandle($ProgressBar)) ;Show main GUI GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $GUI_EVENT_RESTORE _GUICtrlStatusBar_EmbedControl($StatusBar, 1, GUICtrlGetHandle($ProgressBar)) Case $ParentTab Switch GUICtrlRead($ParentTab, 1) Case $PersonalitiesTab GUISetState(@SW_SHOW, $hChildGUI) Case Else GUISetState(@SW_HIDE, $hChildGUI) EndSwitch EndSwitch WEnd Try clicking on the "Applications" tab. You'll see what I mean...
-
Problem getting selected item from listview...
Vadersapien replied to Vadersapien's topic in AutoIt General Help and Support
Oh! So GUICtrlListView_GetSelectedIndices() (with $fArray set to false) returns a string, not a number. I hadn't noticed this since I was using my listview with $LVS_SINGLECEL(or whatever it is)... So instead of creating reading an array (another variable!), I just converted the string to an integer: _GUICtrlListView_GetItemText($hListView, Int(_GUICtrlListView_GetSelectedIndices($hListView)))And it works perfect now. Thanks for pointing out that fact, I probably would have never noticed it! EDIT: Now how do I tell when an item is clicked on? GUIGetMsg() doesn't seem to work...