
kra55
Active Members-
Posts
35 -
Joined
-
Last visited
Everything posted by kra55
-
how would one use this for mouse button 4 - i tried putting 04 instead of 01 but it did not work - sorry to open an old thread. and 5 i guess
-
Took your advise - its now working when a single file is added. But when multiple files are added the file is not created and obviously no information is added. Please please assist driving me crazy even tho i feel i am moving forward again . #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=C:\Documents and Settings\kris\My Documents\Scripts\gui\Forms\backupform.kxf $Form1 = GUICreate("Backup Util", 627, 412, 192, 124) $afileBut = GUICtrlCreateButton("Add File", 56, 304, 89, 25) GUICtrlSetOnEvent($afileBut, "addfiletolist") $afoldBut = GUICtrlCreateButton("Add Folder", 160, 304, 83, 25) GUICtrlSetOnEvent($afoldBut, "addfoldtolist") $remBut = GUICtrlCreateButton("Remove", 256, 304, 75, 25) $Label1 = GUICtrlCreateLabel("Insert 'To' Folder:", 360, 264, 91, 17) $desInput = GUICtrlCreateInput("c:\backup\", 456, 264, 121, 21) $browBut = GUICtrlCreateButton("Browse", 408, 296, 121, 25) $Label2 = GUICtrlCreateLabel("Overwrite with no prompt?:", 16, 344, 130, 17) $overCom = GUICtrlCreateCombo("yes", 160, 344, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "no") $Label3 = GUICtrlCreateLabel("", 32, 384, 4, 4) $Label4 = GUICtrlCreateLabel("Backup Backup File?", 32, 376, 106, 17) $bbCom = GUICtrlCreateCombo("no", 160, 368, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "yes") $startBut = GUICtrlCreateButton("Start Backup", 464, 352, 139, 41) GUICtrlSetOnEvent($startBut, "copyfiles") $savBut = GUICtrlCreateButton("Save Settings", 296, 352, 147, 41) GUICtrlSetOnEvent($savBut, "ssettings") $File = GUICtrlCreateTab(8, 24, 609, 225) $TabSheet1 = GUICtrlCreateTabItem("Files") $fileList = GUICtrlCreateListView("File Name|Location", 12, 49, 593, 193) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 600) $TabSheet2 = GUICtrlCreateTabItem("Folders") GUICtrlSetState(-1,$GUI_SHOW) $foldList = GUICtrlCreateListView("Folder Name|Location", 12, 49, 593, 193) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 600) GUICtrlCreateTabItem("") GUICtrlSetState($TabSheet1,$GUI_SHOW) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") #EndRegion ### END Koda GUI section ### While 1 Sleep(20) WEnd func dupcheck($col1, $col2, $listview) $count = 0 $founddup = 0 while $count < _GUICtrlListView_GetItemCount($listview) if _GUICtrlListView_GetItemText($listview, $count, 0) == $col1 And _GUICtrlListView_GetItemText($listview, $count, 1) == $col2 Then $count = _GUICtrlListView_GetItemCount($listview) $founddup = 1 EndIf $Count = $Count + 1 WEnd Return $founddup EndFunc func addfiletolist() $filenam = "" $fileloc = "" $message = "Hold down Ctrl or Shift to choose multiple files." $filefpath = FileOpenDialog($message, "", "All (*.*)", 1 + 4 ) If StringInStr($filefpath, "|") <> 0 Then $paths = StringSplit($filefpath,"|") MsgBox(0,"test",@ScriptDir & "\bset.txt") $savs = FileOpen(@ScriptDir & "bset.txt", 1) If $savs = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf For $i = 2 to $paths[0] $filenam = $paths[$i] $fileloc = $paths[1] If dupcheck($filenam, $fileloc, $filelist) == 1 Then MsgBox(0,"Already in list", "selection already in list") Else FileWrite($savs, ($fileloc & $filenam & ",1,0,")) If _GUICtrlListView_GetItemCount($filelist) == 0 Then _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, 0, $fileloc, 1) else _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, _GUICtrlListView_GetItemCount($filelist)-1, $fileloc, 1) EndIf EndIf next FileFlush($savs) FileClose($savs) Else $filenam = StringRight($filefpath, stringlen($filefpath )- StringInStr($filefpath, "\", 0, -1)) $fileloc = StringLeft($filefpath, StringInStr($filefpath, "\", 0, -1)) If dupcheck($filenam, $fileloc, $filelist) == 1 Then MsgBox(0,"Already in list", "selection already in list") Else MsgBox(0,"test",@ScriptDir & "\bset.txt") $savs = FileOpen(@ScriptDir &"\bset.txt", 1) If $savs = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($savs, ($fileloc & $filenam & ",1,0,")) FileFlush($savs) FileClose($savs) If _GUICtrlListView_GetItemCount($filelist) == 0 Then _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, 0, $fileloc, 1) else _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, _GUICtrlListView_GetItemCount($filelist)-1, $fileloc, 1) EndIf EndIf EndIf endfunc func addfoldtolist() $foldnam = "" $fileloc = "" $message = "Select folder and click ok." $foldfpath = FileSelectFolder($message, "") $foldnam = StringRight($foldfpath, stringlen($foldfpath )- StringInStr($foldfpath, "\", 0, -1)) $foldloc = $foldfpath If dupcheck($foldnam, $foldloc, $foldlist) == 1 Then MsgBox(0,"Already in list", "selection already in list") Else If _GUICtrlListView_GetItemCount($foldlist) == 0 Then _GUICtrlListView_AddItem($foldlist, $foldnam) _GUICtrlListView_AddSubItem($foldlist, 0, $foldloc, 1) else _GUICtrlListView_AddItem($foldlist, $foldnam) _GUICtrlListView_AddSubItem($foldlist, _GUICtrlListView_GetItemCount($foldlist)-1, $foldloc, 1) EndIf EndIf endfunc Func ssettings() EndFunc Func lsettings() EndFunc func copyfiles() $count = 0 while $count < _GUICtrlListView_GetItemCount($filelist) $dir = _GUICtrlListView_GetItemText($filelist, $count, 1) & _GUICtrlListView_GetItemText($filelist, $count, 0) $dest = GUICtrlRead($desInput) $newdest = $dest & stringright(_GUICtrlListView_GetItemText($filelist, $count, 1), stringlen(_GUICtrlListView_GetItemText($filelist, $count, 1)) -3) MsgBox(0,"test",$newdest) if FileExists($newdest & _GUICtrlListView_GetItemText($filelist, $count, 0)) == 0 Then FileCopy($dir, $newdest,8) Sleep(100) Else EndIf $count = $count + 1 WEnd endfunc Func OnExit() Exit EndFunc ;==>OnExit
-
The code mentioned is in the addfiletolist() function. Ive just figured out that its placing the file where in what ever folder i selected a file using the fileopendialog. I figure the solution would be for me to simply specify the folder during the fileopen process. This should resolve any issues. Now just need to find a function to return the current script location and i should start moving forward again. Even tho i think i know how to make it work it would be great if someone could actually tell me whats happening. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=C:\Documents and Settings\kris\My Documents\Scripts\gui\Forms\backupform.kxf $Form1 = GUICreate("Backup Util", 627, 412, 192, 124) $afileBut = GUICtrlCreateButton("Add File", 56, 304, 89, 25) GUICtrlSetOnEvent($afileBut, "addfiletolist") $afoldBut = GUICtrlCreateButton("Add Folder", 160, 304, 83, 25) GUICtrlSetOnEvent($afoldBut, "addfoldtolist") $remBut = GUICtrlCreateButton("Remove", 256, 304, 75, 25) $Label1 = GUICtrlCreateLabel("Insert 'To' Folder:", 360, 264, 91, 17) $desInput = GUICtrlCreateInput("c:\backup\", 456, 264, 121, 21) $browBut = GUICtrlCreateButton("Browse", 408, 296, 121, 25) $Label2 = GUICtrlCreateLabel("Overwrite with no prompt?:", 16, 344, 130, 17) $overCom = GUICtrlCreateCombo("yes", 160, 344, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "no") $Label3 = GUICtrlCreateLabel("", 32, 384, 4, 4) $Label4 = GUICtrlCreateLabel("Backup Backup File?", 32, 376, 106, 17) $bbCom = GUICtrlCreateCombo("no", 160, 368, 105, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "yes") $startBut = GUICtrlCreateButton("Start Backup", 464, 352, 139, 41) GUICtrlSetOnEvent($startBut, "copyfiles") $savBut = GUICtrlCreateButton("Save Settings", 296, 352, 147, 41) GUICtrlSetOnEvent($savBut, "ssettings") $File = GUICtrlCreateTab(8, 24, 609, 225) $TabSheet1 = GUICtrlCreateTabItem("Files") $fileList = GUICtrlCreateListView("File Name|Location", 12, 49, 593, 193) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 600) $TabSheet2 = GUICtrlCreateTabItem("Folders") GUICtrlSetState(-1,$GUI_SHOW) $foldList = GUICtrlCreateListView("Folder Name|Location", 12, 49, 593, 193) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 600) GUICtrlCreateTabItem("") GUICtrlSetState($TabSheet1,$GUI_SHOW) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func dupcheck($col1, $col2, $listview) $count = 0 $founddup = 0 while $count < _GUICtrlListView_GetItemCount($listview) if _GUICtrlListView_GetItemText($listview, $count, 0) == $col1 And _GUICtrlListView_GetItemText($listview, $count, 1) == $col2 Then $count = _GUICtrlListView_GetItemCount($listview) $founddup = 1 EndIf $Count = $Count + 1 WEnd Return $founddup EndFunc func addfiletolist() $filenam = "" $fileloc = "" $message = "Hold down Ctrl or Shift to choose multiple files." $filefpath = FileOpenDialog($message, "", "All (*.*)", 1 + 4 ) If StringInStr($filefpath, "|") <> 0 Then $paths = StringSplit($filefpath,"|") $file1 = FileOpen("bset.txt", 1) If $file1 = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf For $i = 2 to $paths[0] $filenam = $paths[$i] $fileloc = $paths[1] If dupcheck($filenam, $fileloc, $filelist) == 1 Then MsgBox(0,"Already in list", "selection already in list") Else FileWrite($file1, $fileloc & $filenam & ",1,0,") If _GUICtrlListView_GetItemCount($filelist) == 0 Then _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, 0, $fileloc, 1) else _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, _GUICtrlListView_GetItemCount($filelist)-1, $fileloc, 1) EndIf EndIf next FileFlush($file1) FileClose($file1) Else $filenam = StringRight($filefpath, stringlen($filefpath )- StringInStr($filefpath, "\", 0, -1)) $fileloc = StringLeft($filefpath, StringInStr($filefpath, "\", 0, -1)) If dupcheck($filenam, $fileloc, $filelist) == 1 Then MsgBox(0,"Already in list", "selection already in list") Else $savs = FileOpen("bset.txt", 1) If $savs = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ;FileWrite($file1, ($fileloc & $filenam & ",1,0,")) FileClose($savs) If _GUICtrlListView_GetItemCount($filelist) == 0 Then _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, 0, $fileloc, 1) else _GUICtrlListView_AddItem($filelist, $filenam) _GUICtrlListView_AddSubItem($filelist, _GUICtrlListView_GetItemCount($filelist)-1, $fileloc, 1) EndIf EndIf EndIf endfunc func addfoldtolist() $foldnam = "" $fileloc = "" $message = "Select folder and click ok." $foldfpath = FileSelectFolder($message, "") $foldnam = StringRight($foldfpath, stringlen($foldfpath )- StringInStr($foldfpath, "\", 0, -1)) $foldloc = $foldfpath If dupcheck($foldnam, $foldloc, $foldlist) == 1 Then MsgBox(0,"Already in list", "selection already in list") Else If _GUICtrlListView_GetItemCount($foldlist) == 0 Then _GUICtrlListView_AddItem($foldlist, $foldnam) _GUICtrlListView_AddSubItem($foldlist, 0, $foldloc, 1) else _GUICtrlListView_AddItem($foldlist, $foldnam) _GUICtrlListView_AddSubItem($foldlist, _GUICtrlListView_GetItemCount($foldlist)-1, $foldloc, 1) EndIf EndIf endfunc Func ssettings() EndFunc Func lsettings() EndFunc func copyfiles() $count = 0 while $count < _GUICtrlListView_GetItemCount($filelist) $dir = _GUICtrlListView_GetItemText($filelist, $count, 1) & _GUICtrlListView_GetItemText($filelist, $count, 0) $dest = GUICtrlRead($desInput) $newdest = $dest & stringright(_GUICtrlListView_GetItemText($filelist, $count, 1), stringlen(_GUICtrlListView_GetItemText($filelist, $count, 1)) -3) MsgBox(0,"test",$newdest) if FileExists($newdest & _GUICtrlListView_GetItemText($filelist, $count, 0)) == 0 Then FileCopy($dir, $newdest,8) Sleep(100) Else EndIf $count = $count + 1 WEnd endfunc Func OnExit() Exit EndFunc ;==>OnExit
-
in the scipt i want it to work in. The scipt continues on and does not create the file. When i create a fresh empty script with this code. It script creates the file as it should. sorry im never as clear/to the point as i should be (tested by deleting file when it does actually exist)
-
hey all sorry to ask a stupid question. Ive been staring at this one little bit of basic code for an hour and its doing my head in. basically it works in one script but not another and i cannot figure out why. I have put indicators in my code to ensure it is reaching it and it does nothing but continue on. When tested in a fresh script it works fine(as in creates the file when it does not exist and allow writing). If somone could tell me why its not working that would be great.....
-
Thank you so much have something to work with now
-
Can somone please point me in the direction of AUTOIT sending requests to PHP???
-
So do you mean to actually create a page to be brought up in IE and the information accessed?/would i imbeded a webpage into the form somhow? or is there another way i can pass information between AUTOIt and PHP? Hehe definitely will not do this. have thought about the logic behind the login process a little but as i have been focusing on the other workings of it. This will probably be the last step.
-
sorry if i am asking the wrong people. But any help would be appreciated. Basically i am creating a instant messenger program for a game re in game logistics I need to create a login system. Then once the user is logged in they will be able to view/modify upto about 10 differant values at a time. This i can do. Thinking forward. When accessing MYSQL via autoit though a webhost. My ip address has to be entered in to the remote sql/allow list. I assume this is here for security and me allowing the entire WWW will cause friction between me and my host. So my understanding is i have 2 options at this time. I can either find a MYSQL host with unrestricted remote MYSQL access allowed(any ip can access DB) Or i can teach myself tcp/ip connections via auto it. Then make my home computer a "server" that recieves requests from the user's and pass's it on to my webhosts MYSQL database. The second option is obviously not prefered as it will slow the whole process down. If what i have said makes sense :S. Can anyone suggest what to do here. If my thinking is correct?/are either of these the correct option?/what other options do i have?/Can anyone suggest a MYSQL host?. Once again i understand if i have asked in the wrong place and i do very much thank anyone for any assistance they can provide....
-
This might be a stupid way of getting around it but couldnt i just have another script running that waits for a hotkey to be pressed and closes the script from the icon tray? Unfortunately random things happen and scripts get stuck. People cant seem to understand that they simply have to right click on the icon and hit Exit to end the script !!!!!!!!!!!!!!!!
-
Error "function has no matching end function"
kra55 replied to jimboza's topic in AutoIt General Help and Support
Func AFK() While 1 = 1 $COORD = PixelSearch(350, 600, 1000, 690, 6750208, 10) If Not @error Then MouseMove($COORD[0], $COORD[1]) ToolTip("BG has ended, re-starting queing process in 10 seconds", 0, 0) Sleep(2000) MouseClick("left") Sleep(8000) QUEUE() EndIf ToolTip("BG not over, starting afk script", 0, 0) Sleep(2000) Send("{SPACE}") Sleep(1000) For $I = 29 To 1 Step - 1 ToolTip("Waiting 60 seconds to repeat ( | )", 0, 0) Sleep(500) ToolTip("Waiting 60 seconds to repeat ( \ )", 0, 0) Sleep(500) ToolTip("Waiting 60 seconds to repeat ( | )", 0, 0) Sleep(500) ToolTip("Waiting 60 seconds to repeat ( / )", 0, 0) Sleep(500) Next WEnd EndFunc ;<---------here is ur error -
Hey everyone, A problem i have had for a while is that people get impatient during certain sleeps in my scripts. They will get impatient and click one of the buttons which will que that event to start as soon as the current event has finished. I would like to know if it is possible to make my macro ignore all keypress's while an event is occuring. Except maybe esc. It would be good if Esc was pressed it would ask if you wish to end the script or allow it to continue. I apologise if this has already been answered. If so i was using the wrong search terms Thanking you in advance...Thank you.
-
I have searched google and the forums and am obviously searching the wrong way As an example i would like to add an additional option to the right click pop up menu and create an event associated with what i click on. Could someone please please please point me in the direction of some documentation to do this or a forum post .......Thanking you in advance
-
right in front of me - $GUI_HIDE Control will not be visible.
-
Hey all I'm guessing this is a pretty easy one but i am unable to find a function for hiding controls. I plan on having certain controls displayed based on check box's selected and need to hide/display controls can someone point me in the right direction for this Thanking you in advance
-
If I put _GUICtrlListView_GetSelectedIndices($hListView) into a msg box it returns the selected row but for some reason the GetItemText is not working can somone pleae tell me where I am going wrong been trying to figure it out for an hour then decided would be best to take a lunch break and ask everyone Im guessing im missing somthing silly and am thanking you in advance _GUICtrlListView_GetItemText($hListView, _GUICtrlListView_GetSelectedIndices($hListView), 1)
-
Ok so what i have done below basically searchs the tabs for a particular label once this is found it stops..... Im guessing i could prob make this more efficiant but im happy to just have somthing Now i am dealing with SysListControl....omfg what a pain..... ;go to first tab While ControlCommand("chicken", "", "[CLASS:SysTabControl32; INSTANCE:2]", "CurrentTab", "") <> 1 ControlCommand("chicken", "", "[CLASS:SysTabControl32; INSTANCE:2]", "TabLeft", "") Sleep(50) WEnd ; Search Tabs forcontacts to show we are on the contacts tab While ControlGetText("chicken", "", "Static19") <> "contacts:" ControlCommand("chicken", "", "[CLASS:SysTabControl32; INSTANCE:2]", "TabRight", "") Sleep(50) WEnd
-
As no replies guessing this may not be possible - Im guessing the alternative will be for valadate what tab i am on by what is displayed in the tab......Assuming they are all differant which they are.....
-
Sorry that is correct the text/heading off the tab itself And once again you are correct this is a separate window/ not a user created Autoit gui Im not sure if this makes a difference but when I use the info tool it does show the headings under the visible text.. Thank you
-
Hey all have been playing around with Tabs now So far i can tabright and left and also retrive the current tab as a number/instance.....I have looked around and cannot see how retrive the name of the selected tab rather then the number. If this is possible please advise...Thanking you in advance Below is what i am using atm but as the tabs change i really need this to be based on name.... $test = ControlCommand("Chicken", "", "[CLASS:SysTabControl32; INSTANCE:2]", "CurrentTab", "")
-
Possible to get hidden text? - As per Autoinfo tool
kra55 replied to kra55's topic in AutoIt General Help and Support
Thank you so much for your reply can see this being extremely useful