Jump to content

dRsrb

Members
  • Posts

    14
  • Joined

  • Last visited

dRsrb's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Hey Jos & guinness! Yes, you're right! The file is locked and _GDIPlus_ImageDispose() solves the prob - thank you very much! ) Bye
  2. Hi! It took me an hour to find out, that FileMove() doesn't work in _Example1(). But what's the reason? #Include <GDIPlus.au3> $sSource = 'C:\Wallpaper\AnyImage.jpg' $sDest = 'C:\Wallpaper\16_10\AnyImage.jpg' _Example1() ;~ _Example2() Func _Example1() _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sSource) _GDIPlus_ShutDown() FileMove($sSource, $sDest, 1 + 8) EndFunc Func _Example2() FileMove($sSource, $sDest, 1 + 8) EndFunc I wrote a small script to sort wallpapers by their aspect ratio (16:10, 16:9, 4:3, ...), but it doesn't work, because FileMove() doesn't move any images to the desired destination. At least it creates the directory structure.What could be the solution for this problem? _Example2() works as expected. My system: - AutoIt v3.3.6.1 - SciTE v1.79 - Windows 7 Ultimate (64-Bit) Bye
  3. Thank you for the hint. I just edited the "Array.au3" and replaced the vertical line with an other default char. Bye
  4. Me too! Absolutely important tips! Thank you all very much!
  5. Hello! I have two general problems which I don't understand: #include <array.au3> _1_Array_Problem() _2_If_Problem() Func _1_Array_Problem() Local $aTest[3] $aTest[0] = 'Test' $aTest[1] = 'Test|String' $aTest[2] = 'String' _ArrayDisplay($aTest) EndFunc Func _2_If_Problem() Local $vTest If $vTest = '' Then MsgBox(0, '1: $vTest is empty', $vTest) If $vTest == '' Then MsgBox(0, '2: $vTest is empty', $vTest) $vTest = 0 If $vTest = '' Then MsgBox(0, '3: $vTest is empty', $vTest) If $vTest == '' Then MsgBox(0, '4: $vTest is empty', $vTest) $vTest = '' If $vTest = '' Then MsgBox(0, '5: $vTest is empty', $vTest) If $vTest == '' Then MsgBox(0, '6: $vTest is empty', $vTest) EndFunc 1. Why is everything behind the '|'-char cropped? The '|'-char is part of the string, so I don't understand this behavior. Could it be a possible bug or is there a way to escape the vertical line? 'Chr(124)' doesn't work as well. 2. Firstly I used '==' in statements until I noticed, that this method doesn't work with MsgBox(). So I started to use in general only one '=' in my script to not mix them all the time. Today I came across this behavior: If '$vTest' is '0' then 'If $vTest = '' Then ...' evaluates to true. But '$vTest' is zero and not empty. Now I'm forced to mix '==' and '='. And I'm confused. Why does this not work as expected? Why are there two methods at all? Bye
  6. Thank you for your confirmation. Do I need to report it somewhere or is someone from the dev team checking the threads in this forum? Bye
  7. Hi! Please check the example and then check the result. Example() Func Example() DirCreate('C:\New Folder') DirCreate('C:\Test Folder') DirCreate('C:\Test Folder (1)') DirCreate('C:\Test Folder (1.1)') Sleep(1500) DirMove('C:\Test Folder', 'C:\New Folder', 1) DirMove('C:\Test Folder (1)', 'C:\New Folder', 1) DirMove('C:\Test Folder (1.1)', 'C:\New Folder', 1) EndFunc ;==>Example All folders have been moved, but the 3rd folder has been renamed! AutoIt added an extra dot! Other character aren't affected! So this isn't normal? Bye
  8. Hi! I have a few problems regarding sorting a list. As I haven't found any examples that deal with sorting in "GUIOnEventMode" I have big problems to implement it in my app. I read a lot of threads, but all solutions deal with MessageLoop mode. I probably had never choose OnEvent mode. Hmmm... It's my 1st AutoIt app. As you can see in the example, the items of the list aren't sorted just once. The function "_ListViewSort()" is invoked several times (seemingly once for every item in the list). I mean that with dancing. The next thing I noticed is that some items disappear (replaced by other)! Just compare the code with your result after sorting the list for several times. #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <EditConstants.au3> AutoItSetOption('GUIOnEventMode', 1) AutoItSetOption('MustDeclareVars', 1) Global Const $ApplicationTitle = 'Test' Global $Main Global $ListView _Main() Func _Main() $Main = GUICreate($ApplicationTitle, 88, 186, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, '_ExitApplication') $ListView = GUICtrlCreateListView('Text', 0, 0, 88, 186, $ES_READONLY) _GUICtrlListView_SetExtendedListViewStyle($ListView, $LVS_EX_INFOTIP) _GUICtrlListView_SetColumnWidth($ListView, 0, 66) GUICtrlRegisterListViewSort($ListView, '_ListViewSort') _GUICtrlListView_RegisterSortCallBack($ListView) _TestFunc_SetItem() GUISetState(@SW_SHOW) While True Sleep(1000) WEnd EndFunc Func _ExitApplication() If @GUI_WINHANDLE = $Main Then Exit 0 EndIf EndFunc Func _TestFunc_SetItem() GUICtrlCreateListViewItem('Test1', $ListView) GUICtrlCreateListViewItem('Test2', $ListView) GUICtrlCreateListViewItem('Test3', $ListView) GUICtrlCreateListViewItem('TEST1', $ListView) GUICtrlCreateListViewItem('TEST2', $ListView) GUICtrlCreateListViewItem('TEST3', $ListView) GUICtrlCreateListViewItem('Entry1', $ListView) GUICtrlCreateListViewItem('Entry2', $ListView) GUICtrlCreateListViewItem('Entry3', $ListView) EndFunc Func _ListViewSort() _GUICtrlListView_SortItems($ListView, GUICtrlGetState($ListView)) EndFunc Where is my error in reasoning? Should I rewrite my app to work in MessageLoop mode? Hmm... I'm very confused. EDIT: Just realized: It's the wrong forum. Sorry.
  9. Great! Thank you very much! I spent over 3 hs trying to find the problem, but without success. I read the remarks, but it was not clear enough for me (@WorkingDir rather @ScriptDir). Now it is.
  10. Oh, really? This is my result (I can always reproduce it): 1.: Start 2.: Press OK ~Open a file in "FileOpenDialog()" 3.1.: Select and open a file (in my case it's "Öffnen") 4.1.: See the selection 5.1.: "GUICtrlSetImage()" has an error ~Cancel the "FileOpenDialog()" 3.2.: Cancel (in my case it's "Abbrechen") 4.2.: No selection 5.2.: "GUICtrlSetImage()" works fine Always the same. In the test application as in my "real" application! EDIT:
  11. Hi everybody! I'm new to autoit and again I have a problem, that I don't understand. I extract the following code segment out of my application: #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <EditConstants.au3> AutoItSetOption('GUIOnEventMode', 1) AutoItSetOption('MustDeclareVars', 1) Global Const $ApplicationTitle = 'Test' Global $Main Global $ListView _Main() Func _Main() $Main = GUICreate($ApplicationTitle, 118, 62, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, '_ExitApplication') $ListView = GUICtrlCreateListView('Image|Text', 0, 0, 118, 62, $ES_READONLY) _GUICtrlListView_SetExtendedListViewStyle($ListView, $LVS_EX_INFOTIP) _GUICtrlListView_SetColumnWidth($ListView, 0, 46) _GUICtrlListView_SetColumnWidth($ListView, 1, 67) _GUICtrlListView_SetSelectedColumn($ListView, 2) GUICtrlSetResizing($ListView, BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKRIGHT, $GUI_DOCKBOTTOM)) GUISetState(@SW_SHOW) _TestFunc_SetItem() _TestFunc() While True Sleep(1000) WEnd EndFunc Func _ExitApplication() If @GUI_WINHANDLE = $Main Then Exit 0 EndIf EndFunc Func _TestFunc_SetItem() GUICtrlCreateListViewItem('|Test1', $ListView) GUICtrlSetImage(-1, '.\red.ico') GUICtrlCreateListViewItem('|Test2', $ListView) GUICtrlSetImage(-1, '.\red.ico') MsgBox(0, '', 'Items created') EndFunc Func _TestFunc() Local $j, $ListViewItemCount, $ListViewItemText, $ListViewItemAttributes, $Test, $AnyFile $ListViewItemCount = _GUICtrlListView_GetItemCount($ListView) For $j = 0 To $ListViewItemCount - 1 $ListViewItemText = _GUICtrlListView_GetItemTextArray($ListView, $j) $ListViewItemAttributes = _GUICtrlListView_GetItem($ListView, $j) If $ListViewItemText[2] = 'Test1' Then _GUICtrlListView_SetItem($ListView, 'Tested', $j, 1) $Test = GUICtrlSetImage($ListViewItemAttributes[5], '.\green.ico') MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$Test' & @lf & @lf & 'Return:' & @lf & $Test);### Debug MSGBOX ExitLoop EndIf Next $AnyFile = FileOpenDialog('Select any file', 'C:\', 'All (*.*)', 1) MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$AnyFile' & @lf & @lf & 'Return:' & @lf & $AnyFile);### Debug MSGBOX For $j = 0 To $ListViewItemCount - 1 $ListViewItemText = _GUICtrlListView_GetItemTextArray($ListView, $j) $ListViewItemAttributes = _GUICtrlListView_GetItem($ListView, $j) If $ListViewItemText[2] = 'Test2' Then _GUICtrlListView_SetItem($ListView, 'Tested', $j, 1) $Test = GUICtrlSetImage($ListViewItemAttributes[5], '.\green.ico') If $Test = 0 Then _GUICtrlListView_SetItem($ListView, 'Not tested!', $j, 1) EndIf MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$Test' & @lf & @lf & 'Return:' & @lf & $Test);### Debug MSGBOX ExitLoop EndIf Next EndFunc The problem: "GUICtrlSetImage()" doesn't work, if "FileOpenDialog()" is true. This behaviour makes no sense for me. If you cancel the "FileOpenDialog()" "$AnyFile" is false and "GUICtrlSetImage()" works. You can remove the variable "$AnyFile". It makes no difference. The two icons for testing are attached. green.ico red.ico
  12. Thank you martin too! Your UDF sounds interesting. I will definitely check it! Bye dRsrb
  13. Thank you very much guys! So I will need to call a intermediate function to declare and to finally call my '_TestFunc()'! #include <GUIConstantsEx.au3> AutoItSetOption('GUIOnEventMode', 1) ;AutoItSetOption('MustDeclareVars', 1) Global Const $ApplicationTitle = 'Test' Global Const $DefaultTestDirectory = 'C:\' Global $Main Global $TestDirectoryInput, $CurrentTestDirectory _Main() Func _Main() ; GUI: Main window $Main = GUICreate($ApplicationTitle, 681, 48, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, '_ExitApplication') $DirectoriesControlGroup = GUICtrlCreateGroup('Directory', 4, 1, 673, 43) GUICtrlCreateLabel('Test', 17, 19, 38, 17) $TestDirectoryInput = GUICtrlCreateInput($DefaultTestDirectory, 78, 16, 549, 19) GUICtrlSetState($TestDirectoryInput, $GUI_DROPACCEPTED) $TestDirectoryButton = GUICtrlCreateButton('Test', 634, 15, 35, 21, 0) GUICtrlSetOnEvent($TestDirectoryButton, '_TestFunc_Temp') $CurrentTestDirectory = GUICtrlRead($TestDirectoryInput, 1) GUISetState(@SW_SHOW) _TestFunc() While True Sleep(1000) WEnd EndFunc Func _ExitApplication() If @GUI_WINHANDLE = $Main Then Exit 0 EndIf EndFunc Func _TestFunc_Temp() $sTestDirectory = $CurrentTestDirectory _TestFunc(sTestDirectory) EndFunc Func _TestFunc($sTestDirectory = $CurrentTestDirectory) MsgBox(0, '$CurrentTestDirectory', $CurrentTestDirectory) MsgBox(0, '$sTestDirectory', $sTestDirectory) EndFunc Great! Thank you! Bye dRsrb
  14. Hi everybody! I'm new to autoit and I like it VERY much! But I have a problem, that I don't understand. I extract the following code segment out of my application: #include <GUIConstantsEx.au3> AutoItSetOption('GUIOnEventMode', 1) ;AutoItSetOption('MustDeclareVars', 1) Global Const $ApplicationTitle = 'Test' Global Const $DefaultTestDirectory = 'C:\' Global $Main Global $TestDirectoryInput, $CurrentTestDirectory _Main() Func _Main() ; GUI: Main window $Main = GUICreate($ApplicationTitle, 681, 48, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, '_ExitApplication') $DirectoriesControlGroup = GUICtrlCreateGroup('Directory', 4, 1, 673, 43) GUICtrlCreateLabel('Test', 17, 19, 38, 17) $TestDirectoryInput = GUICtrlCreateInput($DefaultTestDirectory, 78, 16, 549, 19) GUICtrlSetState($TestDirectoryInput, $GUI_DROPACCEPTED) $TestDirectoryButton = GUICtrlCreateButton('Test', 634, 15, 35, 21, 0) GUICtrlSetOnEvent($TestDirectoryButton, '_TestFunc') $CurrentTestDirectory = GUICtrlRead($TestDirectoryInput, 1) GUISetState(@SW_SHOW) ; _TestFunc() While True Sleep(1000) WEnd ; GUIDelete() EndFunc Func _ExitApplication() If @GUI_WINHANDLE = $Main Then Exit 0 EndIf EndFunc Func _TestFunc($sTestDirectory = $CurrentTestDirectory) MsgBox(0, '$CurrentTestDirectory', $CurrentTestDirectory) MsgBox(0, '$sTestDirectory', $sTestDirectory) EndFunc The Problem is when I press the 'Test'-Button and call my 'TestFunc'-function I get an AutoIt Error - "Variable used without being declared". But the variable is declared in the signature of the function. Hmmm, so why does 'GUICtrlSetOnEvent' have another behaviour then calling 'TestFunc()' somewhere else? 2nd question: Do I need 'GUIDelete()' when 'AutoItSetOption('GUIOnEventMode', 1)' is? Bye dRsrb
×
×
  • Create New...