Jump to content

JSunn

Active Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by JSunn

  1. How does this not solve what you want? Perhaps I'm not understanding what you need. I thought you wanted to prevent the selection in the combo box from becoming highlighted? The line below does that. You will need to find a way to trap the event that occurs when a user selects something from the dropdown list and then when that event occurs, use the line below. Can you please post more code so I can get an better idea of what you are trying to do? _GUICtrlComboBox_SetEditSel($hCombo, 0, 0)
  2. You may be better utilizing a combination of single and double-quotes for your string, like this: $cmd &= '"D:\Screenshots\ExampleScreenshot_10x10_tile_0' & $x & '_0' & $y & '.bmp" ' instead of this: $cmd&= """D:\Screenshots\ExampleScreenshot_10x10_tile_0" & $x & "_0" & $y & ".bmp"" " Makes building the string with double-quotes a little less confusing as the double quotes are what you actually want to appear in the output string, and the singles are invisible. - John
  3. $hGUI = GUICreate("(External) ComboBox Create", 400, 296) $hCombo = _GUICtrlComboBox_Create ($hGUI, "Hello", 2, 2, 396, 296) GUICtrlSetFont ($hCombo,9, 400, 4, "ARIAL") ;This will set your cursor to the first character, changeable of course. _GUICtrlComboBox_SetEditSel($hCombo, 0, 0) WHile 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE then Exit Wend Hope this helps John
  4. Well, Ive had a look at your example and I can't say I have a clue about how to implement it. I think its safe to say I'm pretty much lost. My knowledge of C/C++ along with DLLStructCreate / DLLCall etc. is non-existent although I would like to learn. Let me say thanks again for the help.. Here is what I changed it to, needless to say it doesn't work: #include <Resources.au3> Func CreateThumb($pic, $ht, $wd, $outPath, $filename, $Ext) ;Start up GDIPlus _GDIPlus_Startup () ;Create canvas to put the resized image onto $hBMP = _CreateBitmap($wd, $ht) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) ;Load an image file that you want to resize $hImage2 = _GDIPlus_ImageLoadFromFile($pic) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage1) ;Put 2nd image onto the canvas at the desired size _GDIPLus_GraphicsDrawImageRect($hGraphics, $hImage2, 0, 0, $wd, $ht) ;The encoder to use for the output image $CLSID = _GDIPlus_EncodersGetCLSID(StringUpper($Ext)) ;Convert the resized image to binary data. $binarydata = _ResourceGetAsBytes($hImage1); $RT_RCDATA = 10$hImage1 ;No longer using this to save to file ;_GDIPlus_ImageSaveToFileEx($hImage1, $outPath & $filename & '.' & StringLower($Ext), $CLSID) ;Save binary data (string) to database field (Example only) DBAddRecord($tablename, $fieldname, $binarydata) ;Clean up resources _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_DeleteObject($hBMP) ;Shut down GDIPlus _GDIPlus_Shutdown() Return
  5. http://developer.apple.com/sdk/itunescomsdk.html Everything you can do manually with iTunes by pointing and clicking, you can pretty much write a script to do. Have a look at the SDK link above, search this forum, and search the internet. Regardless of the language used to automate, the methods will be sthe same and you should eb ale to adapt any other language to Autoit with a bit of research. Mind if I ask what you're writing? -John
  6. Yeah I noticed that just after posting. Good Stuff.
  7. #include <WinAPI.au3> ;Close existing process with the same, but not the parent. $parent = _WinAPI_GetCurrentProcessID();get the parent process ID $procArr = ProcessList (@Scriptname) ;Loop through and kill any processes of the same name but without the same PID as the parent. For $i = 1 to Ubound($procArr) - 1 If $procArr[$i][1] <> $parent then ProcessClose($procArr[$i][0]) Next By the way, no one here is required to offer you help. Especially if you're rude. Think about that the next time you ask. -John
  8. I just wanted to take a moment to thank both of you for the help on this one. I wish I fully understood how it works! I have a question for either of you, hopefully a simple one. Is there a way (using GDI or some other method) to read a picture file (bmp, jpg, or gif), resize it to a thumbnail size then convert it to binary to store in the database field? Currently I am using an inefficient method to save the image to the database field. The function below creates a thumbnail and then saves it to a file. I am then reading this file into the database field, but Im sure there has to be a way to skip saving it to a file and just send the resized picture data straight to the db field. I think instead of using _GDIPlus_SaveImageToFileEx it should convert the picture data to binary so I could then save to the database. Take a look below. CreateThumb('C:\picture.jpg', 120,160, 'C:\thumbnails\', 'picturename','jpg');this function creates a resized thumbnail of the original. Func CreateThumb($pic, $ht, $wd, $outPath, $filename, $Ext) ;Start up GDIPlus _GDIPlus_Startup () ;Create canvas to put the resized image onto $hBMP = _CreateBitmap($wd, $ht) $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) ;Load an image file that you want to resize $hImage2 = _GDIPlus_ImageLoadFromFile($pic) $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage1) ;Put 2nd image onto the canvas at the desired size _GDIPLus_GraphicsDrawImageRect($hGraphics, $hImage2, 0, 0, $wd, $ht) ;The encoder to use for the output image $CLSID = _GDIPlus_EncodersGetCLSID(StringUpper($Ext)) ;Save the new image to a temporary jpeg file. I think this part can be changed to ;save the new image straight to database rather than a file. ;I have the code in place to save to database. I just need to understand how ;to get the resized image data into binary format for sending to the database. _GDIPlus_ImageSaveToFileEx($hImage1, $outPath & $filename & '.' & StringLower($Ext), $CLSID) _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose($hGraphics) _WinAPI_DeleteObject($hBMP) ;Shut down GDIPlus _GDIPlus_Shutdown() Return EndFunc Thanks again for all the help guys. Regards, John
  9. Thanks for responding Zedna. DBQueryLike is just running a select statement retrieving the data from a field in a database. It should'nt be relevant to the problem. DBQueryLike returns an array with one element and six dimensions. Essentially one db row with six columns. The six column (dimension) is where the picdata is stored. I get the picture data by doing this: $picbox = GUICtrlCreatePic("", 100,100,160,120,BitOR($WS_BORDER,$WS_CLIPSIBLINGS)) ;$list is the array that was returned by DBQueryLike() $pic = Binary($list[0][6]);$pic is the variable that holds the picture data as retrieved from the array, column 6. ;The next thing would be to send the picture to the ;picture box control. This is where your function would come in.. ;but im not sure how to implement it. Help? _ResourceSetImageToCtrl($picbox, $pic, $RT_BITMAP) Thanks again for having a look. John
  10. Hi Guys, Im writing a script that would store small thumbnail pictures into a database field and I have a specific question on how to read the pic from the database field directly into a GUI picture control of some sort. Thanks in advance! The code below reads a small thumbnail and stores into a database field $jpg = FileOPen('c:\picture.jpg', 16) $jpgfile = FileRead($jpg) DBStore($jpgfile);Example The code below would retrieve it from the database field and display it in a picture control somehow. This is what I can't figure out. I am able to read it from the dbfield and write to a jpeg picture file and the picture opens fine. I want to skip writing it to a file just read direct from the database field into some sort of a picture control. Any ideas? There may be some GDI method of doing this. -John ; example 1 #include <GUIConstants.au3> #include <GUIConstants.au3> GUICreate("My GUI") ; will create a dialog box that when displayed is centered $picbox = GUICtrlCreatePic("", 100,100,160,120,BitOR($WS_BORDER,$WS_CLIPSIBLINGS)) $button = GUICtrlCreateButton("Read Pic",20,20,50,50) GUISetState (@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Switch $msg Case $button $ado = databaseOpen(@ScriptDir & '\PICDB.mdb') $searchcol = "Location" $searchterm = "picture1.jpg" $list = dbQueryLike("Pictures", $searchcol,$searchterm,1);Returns multidimensional array - dimension 6 is the field the pic thumbnail was read into. If IsArray($list) then $pic = Binary($list[0][6]) ;GuiCtrlSetimage doesn;t work. Need to find a way to read directly from database into picture control. ;Maybe GDI ?? GUICtrlSetImage($picbox,$pic) Else Msgbox(0,"", "Not array" & $List) Endif databaseClose($ado) Case $GUI_EVENT_CLOSE EXit EndSwitch Wend
  11. Thanks gesller! - I've uploaded the updated code with your compatibility fixes to the original post for download - I posted credit to you in the code as well as on the first post - . Thanks again for taking the time and updating it! I've been pretty busy.. Thanks, -John
  12. I have also seen this behaviour and have had to stop testing some of my scripts (ones using winwaitactive, winexists, etc) on virtual. Same thing as above, they all run flawlessly outside of VMWare workstation. John
  13. Thanks for pointing out the problems. Its been a while since I've looked at the code, and I definitely haven't tried it on the latest version of AI. Let me have a look. Thanks, John
  14. Hi, Can you give a more detailed explanation of exactly how this works? I have a similar program that works by renaming and moving the files according to what is in the ID3 tag, I'd like to see how you've done it. Thanks, John
  15. Good catch Smoke... Guess I was wondering to myself what a REG_RESOURCE_LIST was anyway. It was taken from the constants.au3 file, although I've never heard of such a thing. -John
  16. Hi, I was working on this for something else and thought maybe it would come in handy for someone. You provide a source key (to search / copy from) and a destination key that does not yet exist to copy to and this script will search through and copy all keys / values and subkeys from the source to the destination. I used it for copying Outlook profiles. Thanks, -John CODECopies all keys in the source key to the destination key. ;Author:JSunn Dim $valArr[1] ;Source key to copy (along with all subkeys) Global $SourceKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Default Outlook Profile" ;Destination key to copy to. Global $DestKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\NewUser" RegSearch($SourceKey) Func RegSearch($current) $k = 1 While 1 $CurrKey = RegEnumKey($current, $k) If @error = 0 then WriteVal($current & "\" & $currKey) $recKey = RegEnumKey($Current & "\" & $currkey, 1) If @error = 0 then regSearch($current & "\" & $currKey) Else Endif Else ExitLoop Endif $k = $k + 1 Wend EndFunc Func WriteVal($key) $nKey = Stringreplace($key, $SourceKey, $DestKey) $v = 1 While 1 $CurrVal = RegEnumVal($key, $v) If @error = 0 then $val = RegRead ($key, $CurrVal) Switch @extended Case 0 $type = "REG_NONE" Case 1 $type = "REG_SZ" Case 2 $type = "REG_EXPAND_SZ" Case 3 $type = "REG_BINARY" Case 4 $type = "REG_DWORD" Case 5 $type = "REG_DWORD_BIG_ENDIAN" Case 6 $type = "REG_LINK" Case 7 $type = "REG_MULTI_SZ" Case 8 $type = "REG_RESOURCE_LIST" Case 9 $type = "REG_FULL_RESOURCE_DESCRIPTOR" Case 10 $type = "REG_RESOURCE_REQUIREMENTS_LIST" EndSwitch ;Write the new key and values Regwrite($nKey, $CurrVal, $type, $val) Else ExitLoop Endif $v = $v + 1 Wend Endfunc
  17. Did you get this figured out? -John
  18. Hi, Can you give an explanation about what you are building here? What is the start button meant to do? -John
  19. Okay I've gotten around to fixing most of the interface bugs (not all) in the latest (1.5.0.22) version but I didn't have much time to implement some of the features I wanted to. - Just the "Run at Windows startup" feature. Have a look if you get a chance, I'd appreciate the feedback! -John
  20. Well, I suppose this program must only be for your personal usage, because if you give this script to others you have no idea on how they plan to use it. Maybe on a shared school PC? A system that others use and have admin rights on? You can't be sure. The one thing you can be pretty sure of is that if someone has physical access to the system they can find out where this file is. Did you read the part where I mentioned that anyone who is looking for your password file will find it VERY easily by using any filesystem scanning utility like FILEMON? It's as easy as running filemon while you have your password utility open. Filemon will record every read and write your program makes to your "hidden" dll file, laying bare any attempts to hide the password file on the system in some obscure directory. Like I said, you are better off to forget about trying to hide your password file and focus on encrypting it's contents better. Trust me. Thanks, John
  21. Sharness Quotient? ha! Are you an authority on intelligence? Statistics point to the fact that you probably are not... Give this up and write a more useful script.
  22. I have to say that its a great start. Hope you don't mind if I give a few suggestions. If somebody is looking for the location of the password file, they will find it no matter where you hide it, and it will be easy. Its as simple as running filemon and watching where the program executable is reading from / writing to. So with that in mind, the only way to keep things safe is to put as much security into the actual encryption mechanism as you can. Like Valuator mentioned, encrypt everything! Section names, whatever, NOTHING should be readable by the human eye. If I can't see the user / pass, but I CAN see its for Bank of America, now I have incentive to keep hacking because I now know there is money on the other end of this hack, versus grandmas hotmail account credentials. Again, encrypt everything! All of the above depends on how serious you are taking this script, and if you are using for your personal passwords, (I hope you are not, RC4 is too weak for bank accounts), then restrict it to test passwords. All in all - GREAT START, keep it small and simple. My 2 cents. -John
  23. Dont know why, but I can't extract the zip file.... corrupt is what WinRAR tells me.
  24. Very nice work!
×
×
  • Create New...