Jump to content

Travis

Active Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by Travis

  1. I am on WIndows 10. If you have a system and user environment variable of the same name, in my case, PATH, when calling EnvGet("PATH") The return is the system PATH with the user PATH at the end. No indicator of which ends where. Is it not possible to specify the scope of the variable I am trying to access?
  2. I know this is an old thread, but could somebody please tell me what the difference is here. I use windows 7 ftp to connect to my server on port 21, and although I can receive messages from my server (like '220 connection okay') I can not type anything to send to my server. but yet when I use telnet I can freely type. how do I set up my autoit server so that when I connect with FTP I accept input? Something tells me there is a lot more to TCP/FTP I do not understand.
  3. I'm considering writing a small FTP server, for practice/fun. I know it's been um, like, 13 years, but if you haven't gotten around to doing it yourself yet, I will post it when I finish. Will probably write a client to match, depending on how frustrating this turns out to be. cheers
  4. Okay so I've produced a model of my application in photoshop because I think it best clearly defines what I am trying to do and the questions I am asking. Shown in the picture is a GUI running on my desktop. I wished to create a window with a thin black border, and allow the background colour to be defined by the user as well as the transparency. I've used The POPUP windowstyle to accomplish this, and simply use GUISetBkColor and WinSetTrans for the latter (respectively) Now I have encountered an issue because I did not realize AutoIt's implementation of this functionality is more sophisticated than I had presumed. In the picture above I illustrate a Control I wish to create on the GUI. The control can be clicked by the user as if it were a button. Initially I simply planned to use GUICtrlCreatePic to point to a graphic I created for the control. The problem is, when the window is created it is set to an immediate default transparency and colour. Then the Pic control is created. This, in effect, causes the window to lose it's transparency and become solid. The picture control, then has its background set as transparent (which I believe it is defined by the top left pixel). So I result in a solid colour filled window, with a transparent square around my "Let's play" button graphic (ie, showing the desktop behind it in complete transparency). Now, if in the script I define the control first and then set transparency and color after (the exact same effect occurs if the control is defined after and the user then changes the transparency within the running application...) it results in the ENTIRE GUI including my picture control to become transparent. I know this is not a bug but simply the result of using WinSetTrans. I wish to have, as illustrated in the model picture here, the control to be transparent relative to the GUI, not the desktop. I do not wish to create a Button control and then define it's style to display a bitmap. I don't think that will allow me to program in the various visual effects that I later wish to add. I am looking at a control I was unaware of before, GUICtrlCreateGraphic (and ...SetGraphic). My ultimate question is where will I find the functionality I am seeking, is it in the ...CreateGraphic functions or CreatePic, or am I going to have to handle window transparency in my own way (without using WinSetTrans and or GUISetBkColor). Or are there other functions that I am unaware of that I should be looking into. I apologize for the lengthy and wordy post on what I feel the image can more or less simply describe what I am trying to do. But I find that achieving by desired outcome is not as obvious and I thought and simply referring to the documentation is not providing me an obvious solution for my task....
  5. jcpetu, Cute app And, Thanks for the kind feedback everybody, I'm kinda surprised this even got a response I thought it would just be dismissed as a silly project that anyone could have started. But then again I'm not very familiar with the AutoIt Forum community even though I've been using AutoIt for years. Lately I've become aware of just how capable AutoIt is in terms of creating functional GUI based applications. I'm definitely inspired to start creating more of my own re makes and interpretations of existing applications in this fun but powerful language!
  6. I started this project because of a simple little annoyance with Microsoft's own desktop notes application (Sticky Notes). The little peeve was how it always stayed in the taskbar, one for each note! I find it cluttered my taskbar. So I've worked on this for the past few hours, excuse me should you encounter any issues as while I wrote this I was on prescription pain meds and sedatives. But hey, I'm having fun. Would absolutely love it if anybody decides to check this out and discovers any bugs, everything seems to work fine so far, it's really fairly simple. It is a project that has just begun and I am definitely not finished although I think I have the bulk of the functionality down. What is left to do? Well, I want to make the interface a little prettier for one. I also want to add a Settings window and have various functionality settings that you could configure to your taste. I was thinking (for starts) the ability to resize the notes, to change fonts and text color, the ability to save notes. There's lots of things I wish to add, but I want a lot of these to be transparent in the sense that when you first open the application, it is not overly complicated. After all I intended to use it for myself to replace MS's sticky notes. But I would like to add a bunch more features should I or someone else be inclined to get that kind of functionality out of a simple notes application. To run and build this properly, ensure that the two resource files are in the same directory as the script (icon and background bitmaps). Ohh! A bug I have just noticed is that, when you open the first instance of this app it will create a tray icon so that you can bring focus to the notes. Any instances opened after will not show this icon. However, if you close the first instance that created the tray icon before you close other instances, you lose the icon :-( oh well, I will get around to fixing that (when you read the script, I'm sure you will become aware there is a better/different way I could have implemented this, I'm not sure which direction I wish to go with that just yet). trav1085_stickyenotes.zip
  7. Thank you, water! I feel quite silly now. Now that I carefully look at the documentation for GUICtrlRead you are indeed correct. It does not say anything about returning an array. This helps a lot.
  8. Use INetGet to retrieve specific web pages, and then use StringRegExp to find the data you want in the web page. I use this to say, for example, you paste in a link to a web page containing thumbnails (and download links) to pages of a comic book, it will then find all of the download links that are connected to the thumbnails and then download all of the images in a folder for me. (instead of using my browser and right clicking-->save file as for dozens of images). I took a quick look at the source for the website you gave and it should be doable. You will notice the price for each provider is contained within <td class="column-price"> $###.## </td class="column-price". You could use StringRegExp to extract the names of each provider, their prices, description, limits, payment method, etc Hope this helps
  9. guicreate("test",300,300) $TreeView=guictrlcreatetreeview(20,20,200,200,0x100) $TV_Item1=guictrlcreatetreeviewitem("hello",$TreeView) $TV_Item2=guictrlcreatetreeviewitem("world",$TreeView) $Button=guictrlcreatebutton("ok",10,280) global $data1[2] guisetstate(@SW_SHOW) while 1 $msg = guigetmsg() Select case $msg=$b $data1=guictrlread($TreeView,1) ; Should be returning extended information $q=isarray($data1) ; Is returning 0, $data1 is not an array msgbox(0,"IsArray return",$q) msgbox(0,"",$data1[0]) ; crashes script msgbox(0,"",$data1[1]) ; crashes script EndSelect WEnd So I am trying to incorporate a TreeView into this script I am writing, so in a separate file here I have been playing with TreeView to see if it will give me the functionality I am looking for. After consulting the help file, it seems that using GUICtrlRead($control_id, Advanced = 1) should give me the data I need. However, after some debugging I've found that for some reason, GUICtrlRead is NOT returning an array value at all. I'm stumped here. I have re-read the documentation and do not believe I am using these functions incorrectly. Why am I not getting an array return from GUICtrlRead? It simply gives me a variable containing the text of the item selected
  10. Hello I am scripting a simple application using TCP functionality. I encountered a problem that I thought I could I fix by switching to GUI OnEvent mode, however, I still have the same issue. I can walk you through how my script works: Upon starting the program, the user is presented with a dialog box and asked to choose to start the server or client mode. I'm working on the server mode at the moment so I choose to start the Server mode. The selection dialog is then hidden and my main GUI comes up. I have some text labels that show me the status, it starts with "Program started, attempting to run as server." Then I go through the process of setting up my TCP sockets and such. Then, I get to a Do...While loop to get the server to wait for a client to connect. GUICtrlSetData($dev_connection_status_text,"Awaiting client connection...") Do $socketB = TCPAccept($socketA) Until $socketB <> - 1 Now the problem is here. While I am waiting for a client to connect, I noticed that I cannot close the program using the Close button on the menu. It seems that my gui is no longer listening for $GUI_EVENT_CLOSE? I had thought switching to OnEvent mode would fix this. But how can I still have my GUI respond to user input while awaiting this connection?
  11. I have a problem here with Regex, If I were to use this expression $arr = StringRegExp("STARTblablablaaENDblabSTARTlabENDlabSTARTblablaEND","START([a-z|A-Z]*)END",3) Regex will return only one match, which will contain everything between the first "START" and the last "END" I do not know how (if it is possible) to tell regex what I know: That between "START" and "END" there will never be the phrase "START" or "END"! but it doesn't know that, because it's only matching any alphabetical character..... I need to return an array that would have each match separate like this: "blablablaa", "lab", "blabla". The above expression was just an example, in my actual string it would be all uppercase. But I have tested this above expression and it performs exactly as my program does... Is there any possible way to tell it to match everything except a certain phrase?
  12. lopolop, indeed is the right ascii code. But it doesn't want to capture the a character for some reason. The capital A character captures fine on both codes (like, the correct code and 097). But I just used Hotkeyset("a","randomfumc") and it worked fine. Maybe the help file was not updated since an older version of autoit or something like that.
  13. OK I will try that in a few minutes. I just followed the help file and it said to use a three number ascii code for letters in the format {ASC 123}, etc.
  14. So i use the following function in this program I am writing Hotkeyset("{ASC 097},"randomfunc") For some reason, the ascii character 097 (which corresponds to the lower-case alphabet character "a") only wants to work when I type a CAPITAL A (shift + A) If I change the ascii code to the proper code for a capital A, it works fine just like it should. But in this case I can't seem to capture a lowercase letter. Here is the program that I have so far, you can run it and I would be interested in what results you get. Hotkeyset("{ASC 097}","randomfunc") While 1 Sleep(100) WEnd Func randomfunc() msgbox(0,"","detected a stroke") ;$file = fileopen("c:\users\travis\desktop\test.txt",1) ;filewriteline($file,"a")a EndFunc Note that I've commented-out the lines that involve writing a file to your (likely) non-existant desktop for user: Travis.
  15. Hi all, I've worked on this for awhile (well started awhile ago, then got around to bug killing now) and just wanted to put it out here for anybody who is interested to see what one can do in AutoIt. I see it is a powerful programming language and am always writing something in it. This program is a GUI for Google Suggest. If you are not familiar with that, go to www.google.com and suggest should automatically be on and try it out. Then try out my application . I don't know how practical this is for any use, I just wrote it for fun and because I think the best way for myself to learn a programming language to immerse myself into the language from the beginning. (Which is by I waited until now to release it, the first version was terrible!) Anyways I might put some more programs on here later when I finished them (currently working on an HTTP server that will later become a bittorrent tracker, and also a bittorrent client). -Travis Google_Suggest_API.au3
  16. #include <Misc.au3> While 1 If _IsPressed("01") then Blockinput(1) Shutdown(5) ;Force = 4, Shutdown = 1, your option (6) means force reboot. You wanted shutdown right. Endif Wend I would recommend reading up on your autoit it. EDIT: I apologize for the incorrect code, but I couldn't update fast as I tested out my script and it shut off my computer.
  17. I'm trying to write a simple basis for an HTTP server that I will be using in a future project. So far, my host uses a simple code that will reply to an HTTP connection. However, I don't know how to send data back to the browser I am requesting data with. TCPStartup() $socket = TCPListen("192.168.2.2",80,10) $data = -1 MsgBox(0,"","socket created") Do $data = TCPAccept($socket) Until $data <> -1 MsgBox(0,"","connected!") While 1 $data1 = TCPRecv($data,9999) If @error then ExitLoop If $data1 <> "" and StringInStr($data1,"GET") = 1 then ;eventually it will only reply to specific requests MsgBox(0,"RECEIVED TRANSMISSION",$data1) EndIf WEnd How simple is it to implement a response? Thank you in advance
  18. Hi all, I'm writing this program that involves selecting a file to then be sent to another command line utility. The format is like this: msvsplit.exe -vag $file Where $file would be like (with quotes) "c:\programs\input.imf" For some weird reason, I am unable to use the complete path as returned by FileOpenDialog(). I have tried writing the exact same output I get directly into the function (That is, Run()) and it works fine! Here is my code that produces problems: #include <Constants.au3> $openfile = FileOpenDialog("",@ScriptDir,"(*.imf)") $fline = Chr(34) & $openfile & Chr(34) ConsoleWrite($fline) ; for debugging $cmd = Run("msvsplit.exe -vag " & $fline,@ScriptDir,@SW_HIDE,$STDOUT_CHILD) While 1 $out = Stdoutread($cmd) If @error then Exitloop ConsoleWrite($out) WEnd $openfile would = "c:\programs\input.imf", yet it does not work when that variable is called with Run() as I said above. But if I change the Run() to $cmd = Run("msvsplit.exe -vag " & '"c:\programs\input.imf"',@ScriptDir,@SW_HIDE,$STDOUT_CHILD) It will work fine! Why does this keep happening? I have even gone to the extend of ensuring there were no invalid characters in the path, so ran StringStripWS but not dice. Any help will be appreciated
  19. Thank you very much. I tried the first and third already, but did not think of the second and that is what got it to work.
  20. I have a program that will open another window when a button is pressed. I manged to get it to close only that window if the X button is pressed, but whenever I create my own buttons on that Window it says the variable is not defined. Here is my example Case $msg[0] = $egg Global $lol MsgBox(0,"oh noes","you fund the egg!") $lol = GUICreate("Très bien!",310,400) GUISetState(@SW_SHOW,$lol) GUICtrlCreatePic(@ScriptDir & "\cake.GIF",1,1,307,370) $cegg = GUICtrlCreateButton("Ok, fun's over!",105,375,100,25) Case $msg[0] = $cegg GUIDelete($lol) EndSelect WEnd However, I get this error when trying to compile C:\Documents and Settings\Travis\My Documents\Google Suggest API.au3 (60) : ==> Variable used without being declared.: Case $msg[0] = $cegg Case $msg[0] = ^ ERROR Now my question is, how can I get the GUI to respond to those clicks? It seems the variable for the button is isolated to just that one Case, eventhough I manged to get the $GUI_EVENT_CLOSE to work for _both_ of my window, with this Case $msg[0] = $GUI_EVENT_CLOSE If $msg[1] = $main Then FileDelete(@ScriptDir & "\output.file") Exit Else GUIDelete($lol) EndIf Can anybody clear this up, I looked on the online documentation too. Thanks in advance.
  21. Thank you both for you replies!
  22. Hi, I've just started learning to write Autoscript (having some "experience" with visual basic and liberty basic, if you consider the latter a "programming language"). I'm writing this little program that has a dialog with an input field, and when the user presses a button it will scan if the user has entered anything in the input and then a) create a msgbox and tell the user what they wrote just end if they entered nothing C) have it end if they just entered a space or multiple spaces. However, I have not worked out the code on the even that they enter spaces _and_ any other character. This is what I have If GUICTRLRead($input) >= Chr(32) Then The reason for >= is because I found out with just = it will only want to understand _1_ space :/ so >= is working for me. But if the user enters something before or after spaces it will run with this code. How could I fix this? I could probably spend all night writing spaghetti code but decided to ask here >_> Thanks in advance.. here is the so far code if you need it for reference. ;program demonstrates input boxes and msgboxes #include <GUIConstantsEx.au3> GUICreate("MsgBox Mkr",300,400) $button = GUICtrlCreateButton("Close",20,350,60) $input = GUICtrlCreateInput("",20,100,100,50) GUISetState(@SW_SHOW) While 1 dim $msg = GUIGetMsg() Select Case $msg = $button If GUICTRLRead($input) <> "" then If GUICTRLRead($input) >= Chr(32) Then MsgBox(0,"Hi","You said space, hehehe") Exit Else MsgBox(0,"Hi",GUICtrlRead($input)) Exit EndIf EndIf Exit Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd
×
×
  • Create New...