Jump to content

bird42

Active Members
  • Posts

    40
  • Joined

  • Last visited

Profile Information

  • Location
    somewhere in nowhere

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

bird42's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. i love this forum 'cause it is full of kind helpful peoples thank you! Well, it does not have to be firefox... I tried both, but i always get messy code I'll try to get an html example. Anyway there are textboxes, radio buttons, drop down menus and checkboxes usually.
  2. Hello all, i need a script to complete surveys for me... something like this: open firefox go to specified URL wait till loaded fill forms submit wait till loaded check new URL repeat Could someone please suggest me the best way to do this?
  3. ; #INDEX# ======================================================================================================================= ; Title .........: _GUIResourcePic ; Version .......: 1.8.2012.2600b ; AutoIt Version.: 3.3.8.1 ; Language.......: English ; Description ...: Load image (.bmp, .jpg, .png, .gif {animated} and other formats.) resources from .exe, .dll, .ocx, .cpl... ; Author ........: João Carlos (jscript) ; Remarks .......: Based on http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=1776 and Prog@ndy work concept! ; ======================================================================================================================== I found it on the forum... can't remeber where at the moment. You linked a very useful example!! Thank you very much AZJIO.
  4. I wrote this because windows 8 picture viewer does not support animated gifs. It's a really basic script as i code as an hobbist. Any useful comments welcome ;simple image viewer by Zentral #include <GuiconstantsEx.au3> #include <_GUIResourcePic.au3> #include <WindowsConstants.au3> #include <FileListToArray.au3> #include <Misc.au3> If UBound(ProcessList(@ScriptName)) > 2 Then MsgBox(4096, "Error", @ScriptName&" is already running.", 5) Exit EndIf $gui=GUICreate("Simple Image Viewer",800,650, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SIZEBOX), $WS_EX_ACCEPTFILES) $picture=_GUICtrlPic_Create('', 5, 5) Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 2) GUISetOnEvent($GUI_EVENT_CLOSE, '_exit') GUISetOnEvent($GUI_EVENT_MINIMIZE, '_mintray') GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, '_movepic') $open = TrayCreateItem("Open Folder") TrayItemSetOnEvent(-1,"_folder") TrayCreateItem("") $open = TrayCreateItem("Set Recusion") TrayItemSetOnEvent(-1,"_setrec") TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayItemSetOnEvent(-1,"_about") $restoreitem = TrayCreateItem("Restore") TrayItemSetOnEvent(-1,"RestoreTray") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"_exit") TraySetToolTip("Simple Image Viewer") GUISetState(@SW_SHOW) Global $picture, $files = '', $recursion = 0, $currentpos = 1 While 1 sleep(50) ;~ left arrow If _IsPressed('25') Then _previous() While _IsPressed("25") Sleep(10) WEnd EndIf ;~ up arrow If _IsPressed('26') Then _first() While _IsPressed("26") Sleep(10) WEnd EndIf ;~ right arrow If _IsPressed('27') Then _next() While _IsPressed("27") Sleep(10) WEnd EndIf ;~ down arrow If _IsPressed('28') Then _last() While _IsPressed("28") Sleep(10) WEnd EndIf WEnd Func _movepic() $cInfo = GUIGetCursorInfo($gui) ; Is it over a control $iControl = $cInfo[4] Switch $iControl ; If it is a control we want to move Case $picture ; Work out offset of mouse on control $aPos = ControlGetPos($gui, "", $iControl) $iSubtractX = $cInfo[0] - $aPos[0] $iSubtractY = $cInfo[1] - $aPos[1] ; And then move the control until the mouse button is released Do $cInfo = GUIGetCursorInfo($gui) ControlMove($gui, "", $iControl, $cInfo[0] - $iSubtractX, $cInfo[1] - $iSubtractY) Until Not $cInfo[2] EndSwitch EndFunc Func _folder() _GUICtrlPic_Delete($picture) $files=_RecFileListToArray(InputBox('','Path:'),'*.jpg;*.png;*.gif;*.bmp',1,$recursion,0,2) $currentpos = 1 $picture=_GUICtrlPic_Create($files[$currentpos], 5, 5) EndFunc Func _next() If $files = '' Then _folder() $currentpos+=1 If $currentpos > $files[0] then $currentpos=1 _GUICtrlPic_Delete($picture) $picture=_GUICtrlPic_Create($files[$currentpos], 5, 5) EndFunc Func _previous() If $files = '' Then _folder() $currentpos-=1 If $currentpos < 1 then $currentpos=$files[0] _GUICtrlPic_Delete($picture) $picture=_GUICtrlPic_Create($files[$currentpos], 5, 5) EndFunc Func _last() If $files = '' Then _folder() $currentpos=$files[0] _GUICtrlPic_Delete($picture) $picture=_GUICtrlPic_Create($files[$currentpos], 5, 5) EndFunc Func _first() If $files = '' Then _folder() $currentpos=1 _GUICtrlPic_Delete($picture) $picture=_GUICtrlPic_Create($files[$currentpos], 5, 5) EndFunc Func _setrec() $recusion=InputBox('','Set recursion:'&@CRLF&@CRLF&'1 - Search in all subfolders (unlimited recursion)'&@CRLF&'0 - Do not search in subfolders (Default)'&@CRLF&'Negative integer - Search in subfolders to specified depth','0','',400) EndFunc Func _MinTray() GuiSetState(@SW_HIDE) TraySetState(1) EndFunc Func RestoreTray() GuiSetState(@SW_SHOW) GuiSetState(@SW_RESTORE) TraySetState(2) EndFunc Func _about() MsgBox(0,"Author: Zentral","Function: simple image viewer."&@CRLF&'Navigate with arrows') EndFunc Func _exit() Exit 1 EndFunc Thanks to João Carlos (jscript) and Melba23 for includes.
  5. Don't worry it's just for personal use;) My basic knowledge let me write this script: Opt("TrayOnEventMode",1) Opt("TrayMenuMode",1) HotKeySet("{esc}","ExitScript") $1 = TrayCreateItem("Go!",-1,-1,1) TrayItemSetOnEvent(-1,"_go") TrayCreateItem("") $a = TrayCreateItem("About") TrayItemSetOnEvent(-1,"_about") TrayCreateItem("") $e = TrayCreateItem("Exit (Esc)") TrayItemSetOnEvent(-1,"ExitScript") TraySetToolTip("IMDB lookup") Global $result[7] While True ; Forever Sleep(100) WEnd Func _about() TrayTip(" IMDB lookup","Script Function: Retrieve a movie's infos from IMDB",10) EndFunc Func exitscript() Exit EndFunc Func _go() For $i=0 to 6 $result[$i]='not found' Next Local $title = InputBox('IMDB lookup','Please enter movie title') Local $dummy If @error Then MsgBox(0,'ERROR','Invalid parameters') SetError(0) Return 0 EndIf StringReplace($title,' ','+') TrayTip('Working...',$title,30) Local $response = _INetGetSource('http://mymovieapi.com/?title='&$title&'&type=json&plot=none&episode=0&limit=1&yg=0&mt=none&lang=en-US&offset=&aka=simple&release=simple&business=0&tech=0') $dummy=_StringBetween($response, '"title": "','", "filming_locations":') If Not @error then $result[0]=$dummy[0] Else SetError(0) EndIf $dummy=_StringBetween($response, '"year":',', "country":') If Not @error then $result[1]=$dummy[0] Else SetError(0) EndIf $dummy=_StringBetween($response, '[{"runtime": ["',' min"],') If Not @error then $result[2]=$dummy[0] Else SetError(0) EndIf $dummy=_StringBetween($response, '"genres": [','], "rated"') If Not @error then $result[3]=$dummy[0] Else SetError(0) EndIf $dummy=_StringBetween($response, '"writers":','], "imdb_id"') If Not @error then $result[4]=$dummy[0] Else SetError(0) EndIf $dummy=_StringBetween($response, '"directors": ["', '], "rating_count":') If Not @error then $result[5]=$dummy[0] Else SetError(0) EndIf $dummy=_StringBetween($response, '"actors": [','], "also_known_as":') If Not @error then $result[6]=$dummy[0] Else SetError(0) EndIf _ArrayDisplay($result) EndFunc I believe there is a better way to extract the data from the json string, but the json udf i found seemed a bit too complicated for me. Any suggestions?
  6. Thank you very much! I'm gonna try this way.
  7. Hi all! I'm trying to write a script that automatically retrieves some data from IMDB for an array of movie titles. I want it to output something like this: title,year,genre,duration,writer,director,maincast . Can you suggest me the smoothest way to do it?
  8. For $j= 1 to $avLinks[0] TrayTip('Downloading',$avLinks[$j]&' to'& $ddir&$j&StringRight($avLinks[$j], 4),30) InetGet($avLinks[$j],$ddir&$j&StringRight($avLinks[$j], 4)) Next TrayTip('Done','',30) This way?
  9. Thank you very much sir! Really appreciated. I'll study your code:)
  10. I'll do. Thanks anyway
  11. It does. However if you have a better way to scan for all the links to a .pdf file in a webpage it would be awesome
  12. Ahem. As i don't know how to read links from a webpage i figured out to get the source, split it and get the links from here. So this gets the source of the desired webpage.
  13. Hi all I'm trying to make a script that automatically downloads issues of my favourite free comic book Here is the code: #include <Inet.au3> #include <File.au3> If UBound(ProcessList(@ScriptName)) > 2 Then MsgBox(4096, "Error", @ScriptName&" is already running.", 5) Exit EndIf Global $main = 'site url' Global $file = @ScriptDir&'\log.txt' If FileExists($file)=0 Then FileWrite($file,'First run: '&@YEAR&' '&@MON&@CRLF) TrayTip('No log file found','Assuming this is the first run. Donwloading of all content starting...',30) _getall() Else If FileReadLine($file,-1) <> 'Last run '&@YEAR&' '&@MON Then _checknew() EndIf Exit Func _download($year,$month) TrayTip('Downloading',$main&$year&'/'&StringFormat('%02d',$month),30) $source = StringSplit(_INetGetSource($main&$year&'/'&StringFormat('%02d',$month)),'"') If @error then FileWriteLine($file,'---'&@CRLF&'Not found '&$year&' '&StringFormat('%02d',$month)) SetError(0) Return 0 EndIf For $n= 1 to $source[0] If StringInStr($source[$n],'.pdf') then InetGet($main&$year&'/'&StringFormat('%02d',$month)&'/'&$source[$n],@ScriptDir&'\'&$year&'\'&StringFormat('%02d',$month)&'\'&$n&'.pdf') If @error then MsgBox(16,'ERROR','Download error at '&@CRLF&$main&$year&'/'&StringFormat('%02d',$month)&'/'&$source[$n]) FileWriteLine($file,'---'&@CRLF&'Download error at '&$main&$year&'/'&StringFormat('%02d',$month)&'/'&$source[$n]) SetError(0) Return 0 EndIf Next FileWriteLine($file,'---'&@CRLF&'Success'&$year&' '&StringFormat('%02d',$month)) EndFunc Func _getall() For $i='2012' to @YEAR For $j='01' to '12' _download($i,$j) Next Next FileWriteLine($file,'---'&@CRLF&'Last run '&@YEAR&' '&@MON) EndFunc Func _checknew() TrayTip('Checking...','',30) _download (@YEAR,@MON) EndFunc The problem is that even if i can retrieve the right link i always get download error. Any other suggestions welcome. Regards and sorry for my 'newbieness'.
  14. Yes, i mean my own post Thanks you all. p.s.: dani thx for your script. Obviously i have a lot to learn.
  15. Damn i wrote an useless post . i'm really sry... Btw any suggestions about the script?
×
×
  • Create New...