Jump to content

kra55

Active Members
  • Posts

    35
  • Joined

  • Last visited

kra55's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. 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
  2. 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
  3. 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
  4. 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)
  5. 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.....
  6. Thank you so much have something to work with now
  7. Can somone please point me in the direction of AUTOIT sending requests to PHP???
  8. 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.
  9. 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....
  10. YAY - Thank you gotta love the basic things i overlook !!!!
  11. 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 !!!!!!!!!!!!!!!!
  12. Now to be a pain is there anyway i can make esc interupt the script and ask if i wish to continue or quit?
  13. hahahhahaha silly me Thank you for the info - will just create a disable all fuction that starts at the begining of every event
  14. 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
  15. 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.
×
×
  • Create New...