Jump to content

aommaster

Active Members
  • Posts

    140
  • Joined

  • Last visited

Everything posted by aommaster

  1. Oh, I see. So I'm assuming I can't have this line in the for..in loop?$filelist = _filelisttoarray("bgm/"& $folder, "*.mp3", 1) Thanks
  2. Below are two snippets of code, both of which (I believe) should achieve the same thing. #Include <File.au3> #include <array.au3> $folderarray = _FileListToArray("bgm/", "*", 2) for $folder in $folderarray $filelist = _filelisttoarray("bgm/"& $folder, "*.mp3", 1) for $i=1 to ubound($filelist)-1 msgbox(0,0, $fileitem) Next Next And this is the other: #Include <File.au3> #include <array.au3> $folderarray = _FileListToArray("bgm/", "*", 2) for $folder in $folderarray $filelist = _filelisttoarray("bgm/"& $folder, "*.mp3", 1) for $fileitem in $filelist msgbox(0,0, $fileitem) Next Next However, the second snippet doesn't work. Autoit gives me an error: Variable must be of type "Object" for the second nested For..in loop. What is the reason for this?
  3. Hi! Regarding that speed, is it the speed of the RAM chip in MHz? And while we're on the subject of memory, what does the type indiciate? DDR number? So type 2 means DDR2? Thanks again!
  4. Hi! Loving this UDF, you're doing a great job! Is there anyway to add a function to obtain: 1.GPU clock speed (for the core bus and the memory bus) 2.RAM speed Thanks
  5. Awesome. Thanks everyone!
  6. Are they all in the format of: IT Manual ## If so, then just use a stringtrimleft function, strip the whitespace if you need. If you want it to be changed from a string to a number, use the number() function.
  7. Hi guys Does Autoit support pointer variables, ie. variables that contain the memory location of other variables so that they can be used to pass arrays down to functions? I looked at the PTR function, but that doesn't seem to be what I am looking for. Thanks guys
  8. Hi Rasim! Thank you very much for your help! I was wondering if you could help me solve one more problem. My SendToPreviewer function looks like this: func sendtopreviewer() $lines=_filecountlines(@scriptdir & "\Data\Speechorder.tmp") if $lines==0 Then msgbox(0, "Error", "No speeches to send to previewer. Please add speeches") Else $file=fileopen(@scriptdir & "\Data\Speechorder.tmp", 0) for $k=1 to $lines $line=filereadline($file) $filedata=stringsplit($line, "|") $file2=fileopen($filedata[2], 0) ;msgbox(0, "", $filedata[2]) $string=fileread($file2) $check=stringinstr($string, "@@@@@") if $check==0 Then $tag='[color="#008000"][u]Step ' & $k &':[/u][/color]' $initial=guictrlread($message) guictrlsetdata($message, $initial & $tag & @crlf & $string & @CRLF & @CRLF) else $speechtoedit=$string $array=_stringbetween($string, "@@@@@", "@@@@@") $arraysize=ubound($array) $childwindow=$array $arraypointer=$array for $l=0 to $arraysize -1 ;~ $stringtoreplace="@@@@@" & $array[$l] & "@@@@@" $input=getuserinput($filedata[1], $array[$l], $l) ;~ $tag='[color="#008000"][u]Step ' & $k &':[/u][/color]' ;~ $initial=guictrlread($message) ;~ guictrlsetdata($message, $userinput) Next GUISetState(@SW_SHOW, $ChildWindow[0]) EndIf Next ControlCommand ( $windowtitle, "", $tab, "TabLeft") EndIf EndFunc As you can see from the first if statement, there are multiple files that need to be processed by this program. The problem arises when multiple files satisfy the @@@@@ requirement. Multiple windows pop up and it causes a big problem with arrays and variable naming. Any ideas on how to fix this? Thanks again for your help Rasim!
  9. Rasim, I've got a couple of questions regarding this code: 1. If I want to have the values from the edit box read and passed on the parent window, in essence, this function: $userinput = getuserinput("HJT ~ HJT Speech", $array[$l], $l) How would I do it? 2.If multiple files are being read in the loop (the example I gave only has one, but in reality, multiple files will be read), how do I change the loop so that only a window from one file is displayed at a time? 3.The else statement is not yet complete. I still have to add a GUICTRLSetData similar to the first if statement. However, this data is based on the user input in the dialog boxes. Will this have a problem on the loop? Edit: Rasim, if you would like to discuss this over PM, where I can send you the whole script source code + compiled version (because of the fileinstalls), let me know.
  10. Rasim! That is amazing! It actually fixed my problem completely Thanks so much! I noticed you changed the close child function, but were there any other changes made to the script?
  11. Hi Martin! That was the first thing that came to mind when I encountered this problem. I posted another thread with an example code: http://www.autoitscript.com/forum/index.php?showtopic=86781 However, it does seem like all the other predefined functions seem to deactivate. The general form of my code is: #includes Global variables GUIOnEventMode=1 Define the GUI along with the guictrlsetonevent . . . Functions with use gui oneventmode=1 The last function which looks like: { GUIOnEventMode=0 Stuff here GUIOnEventMode=1 } Which was the form you recommended I use, correct? Because if that is the case, then, it doesn't work
  12. Oh okay. Thanks
  13. I'm running a Quad Core, with Vista 64bit and the script seems to run fine for me
  14. Yeah Martin, I know exactly how hard it is but like I've said in many of my other posts, the script is huge and runs on several other files, making it impossible for me to post. Below is some of the code that shoudl allow you to replicate this: #include <GuiComboBoxEx.au3> #include <GuiImageList.au3> #include <GuiConstantsEx.au3> Opt('MustDeclareVars', 1) $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work Global $iMemo _Main() Func _Main() Local $hGUI, $hImage, $hCombo,$bmp, $tab, $tab1, $tab2, $tab3 ; Create GUI $hGUI = GUICreate("ComboBoxEx Set Image List", 400, 300) $tab=GUICtrlCreateTab (10,10,960,720) $tab1=GUICtrlCreateTabitem ("Canned Speech Editor") $hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 50, 394, 100) $hImage = _GUIImageList_Create (20, 12, 5, 3) Local $List[7] = _ [0xFF0000 , _ 0x00FF00 , _ 0x0000FF , _ 0xFFFF00 , _ 0x00FFFF , _ 0xFFFFFF , _ 0x000000] ;Set Image List _GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage) ; Add Items For $i = 0 To UBound($List)-1 $bmp = _IMGListAddColor($hImage,$List[$i],20,12) _GUICtrlComboBoxEx_AddString ($hCombo, "", $bmp, $bmp) Next guisetstate() $tab2=GUICtrlCreateTabitem ("test") $tab3=GUICtrlCreateTabitem ("") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Prog@ndy Func _IMGListAddColor($hImage,$Color,$W=16,$H=16) Local $bmp = _WinAPI_CreateSolidBitMap (_WinAPI_GetDesktopWindow(), $Color,$W,$H) Local $index = _GUIImageList_Add ($hImage,$bmp) _WinAPI_DeleteObject($bmp) Return $index EndFunc
  15. ProgAndy: I took a look at your code for the colored comboboxes, and when I try to implement them on my script, the combobox appears on both tabs. Is there a reason for this? And how do I fix this? I tried using the GUISwitch function, but that doesn't seem to work. Thanks again!
  16. I can't post the whole code, since it's more than 1000 lines. But below is a condensed version from which you should be able to replicate my problem. #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #Include <String.au3> #Include <File.au3> global $windowtitle="Canned Speech Assistant V0.5 by Aommaster" global $childwin=0 Opt("GUIOnEventMode", 1) $window= GUICreate($windowtitle, 400, 300, -1, -1, BitOr($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX)) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $send=guictrlcreatebutton("Send to Post Previewer", 100, 100) GUICtrlSetResizing ( -1, 802) guictrlsetonevent(-1, "sendtopreviewer") guisetstate(@sw_show) while 1 sleep(100) Wend func sendtopreviewer() $file2=fileopen(@scriptdir & "\HJT ~ HJT Speech.txt", 0) $string=fileread($file2) $check=stringinstr($string, "@@@@@") if $check==0 Then msgbox(0, "Check value", $check) else $array=_stringbetween($string, "@@@@@", "@@@@@") $arraysize=ubound($array) for $l=0 to $arraysize -1 $stringtoreplace="@@@@@" & $array[$l] & "@@@@@" $userinput=getuserinput("HJT ~ HJT Speech", $array[$l]) Next EndIf EndFunc func getuserinput($guititle, $defaultvalue) $childWin=GuiCreate($guititle,400,400, -1, -1, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "closechild",$childWin) GuiCtrlCreateEdit($defaultvalue,5,5,390,350,$ES_MULTILINE) $acceptinput=guictrlcreatebutton("Ok", 20, 355) guictrlsetonevent(-1, "acceptinput") $close=guictrlcreatebutton("Cancel", 50, 355) guictrlsetonevent(-1, "closechild") GuiSetState(@sw_show) EndFunc func closechild() guidelete($childwin) Return EndFunc func acceptinput() guidelete($childwin) Return EndFunc func closeclicked() exit EndFunc In addition to this, you'll need one extra file, which I have attached. Place that in the same directory as you are running your script. When you press the button, you'll notice that you get flooded with 4 GUI windows created, one for each of the fields in that text file that need to be editted. I need autoit to wait for the user to either close, press cancel, or press okay on a window before the next one pops up. Thanks! HJT___HJT_Speech.txt
  17. I was condering having the loop manually incremented by the user (my idea was using another GUI button, say an arrow). But is there no other way of completely automating it? I tried WinWaitClose too, but autoit halts my script, which completely disables any functionality
  18. Hey everyone! So I have a program written up and I'm stuck on a part which requires a child GUI window, and I'm not exactly sure how to fix this. The GUIOnEventMode is set to on, so I'm using GUICTRLSetOnEvent functions. My program literally has a structure like this: GUI window created User adds some files Program goes through each file and looks for a required string Program produces another window that prompts for the user input based on each and every instance of the found string The part in red is where I'm having trouble with. I basically add the files, push a button which calls the search function. The search function successfully finds the required strings that require a user prompt, but I'm not sure on how to do the next part. I can produce the GUI, but I have no way for telling Autoit to wait for a user interaction with the dialog before continuing the loop and producing another dialog box. I have tried: *Changing the oneventmode, but it seems that autoit doesn't like that very much *Adding a while 1 sleep(100) loop in the function that displays the box, however, it seems that I cannot call any of the other guifunctions from that box. It looks like that I can't exit the loop to call the other sub-functions that are required to close that box So in summary: I have a child window that will be produced any N times through a loop. How do I tell autoit to wait for the user to either close or press the okay button on that window before continuing the loop that produces this gui again? Thanks everyone!
  19. That is perfect! Thanks
  20. Hi Zedna! I think I may have narrowed my problem down and was wondering whether you could give me a few more pointers (no pun intended). My problem is that I have multiple GUI's on a SetOnEvent mode. How do I handle them using this specific mode, since I've already written more than 1000 lines of code, and changing the mode to getmessage would be a painful task? Thanks a lot for your help!
  21. Yes, I do, but I have this new window coming out as a child window. Does that mean it cannot be done?
  22. Hi Zedna! You didn't understand what I meant The Opt('GUIOnEventMode',1) works for the script that I had posted, so that was all good. But when I put it into the actual code (the one that it more than 1000 lines long), it doesn't work. If you take a look at my post #3, I tried to explain how the main program works.
  23. Hi Zedna! I tried adding that to the start of my actual script, but that doesn't seem to fix the problem (it does for the one I'd posted). I can't really post the script because it's more than 1000 lines of code. Basically, I have a function that's in a loop and after a certain condition is met, it calls getuserinput(). Basically, this is what I want it to do: Open up a window based on the variables that were passed on to it (guititle, and defaultvalue) Wait for the user's input Take the values in the edit box, and pass them back to the function that called it. I decided to write up the functions as follows, but it doesn't seem to work (switch is a global variable): func getuserinput($guititle, $defaultvalue) Opt('GUIOnEventMode',1) $switch=0 $childWin=GuiCreate($guititle,400,400, -1, -1, -1, -1, $window) GUISetOnEvent($GUI_EVENT_CLOSE, "closechild") GuiCtrlCreateEdit($defaultvalue,5,5,390,350,$ES_MULTILINE) $acceptinput=guictrlcreatebutton("Ok", 20, 355) guictrlsetonevent(-1, "acceptinput") $close=guictrlcreatebutton("Cancel", 50, 355) guictrlsetonevent(-1, "closechild") msgbox(0, "", "enter") GuiSetState() while $switch==0 sleep(100) WEnd msgbox(0, "", "exit") guidelete($childwin) EndFunc func closechild() $switch=1 msgbox(0, "", "done") Return EndFunc func acceptinput() $switch=1 msgbox(0, "", "done") Return EndFunc
  24. Hey guys! #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> global $switch=0 $defaultvalue=1 $guititle=" " $childWin=GuiCreate($guititle,400,400, -1, -1, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "closechild") GuiCtrlCreateEdit($defaultvalue,5,5,390,350,$ES_MULTILINE) $acceptinput=guictrlcreatebutton("Ok", 20, 355) guictrlsetonevent(-1, "acceptinput") $close=guictrlcreatebutton("Cancel", 50, 355) guictrlsetonevent(-1, "closechild") msgbox(0, "", "enter") GuiSetState() while $switch==0 sleep(100) WEnd msgbox(0, "", "exit") guidelete($childwin) func closechild() $switch=1 msgbox(0, "", "done") Return EndFunc func acceptinput() $switch=1 msgbox(0, "", "done") Return EndFunc The window above doesn't seem to close. Now, I have made GUI's before and I do know that there is a much simpler way of doing it, however, this is not my whole code, and the code here needs to be as is (ie, setoneventmode on, etc.) What am I doing wrong with this code? Thanks guys
×
×
  • Create New...